Changeset 279


Ignore:
Timestamp:
Mar 5, 2010, 8:52:50 PM (15 years ago)
Author:
george
Message:
  • Upraveno: Aktualizována třída TSqlDatabase.
  • Upraveno: Binární sestavené soubory se nyní vytváří v podsložce bin.
Location:
branches/web
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/web

    • Property svn:ignore
      •  

        old new  
        33*.o
        44backup
        5 
        65index.cgi
        7 
        86index.compiled
        9 
        107UConfig.pas
         8bin
  • branches/web/UBill.pas

    r158 r279  
    153153procedure TBill.Store;
    154154var
    155   Data: TAssocArray;
    156 begin
    157   Data := TAssocArray.Create;
     155  Data: TAssociativeArray;
     156begin
     157  Data := TAssociativeArray.Create;
    158158  Data.AddKeyValue('BillCode', BillCode);
    159159  Data.AddKeyValue('time_due', IntToStr(DateTimeToUnix(TimeDue)));
     
    312312procedure TBillItem.Store;
    313313var
    314   DbRows: TDbRows;
    315   Data: TAssocArray;
    316 begin
    317   Data := TAssocArray.Create;
     314  Data: TAssociativeArray;
     315begin
     316  Data := TAssociativeArray.Create;
    318317  Data.AddKeyValue('Quantitiy', IntToStr(Quantity));
    319318  Data.AddKeyValue('Description', Description);
  • branches/web/UCore.pas

    r139 r279  
    3636
    3737uses 
    38   pwenvvar, pwmain, SysUtils, UConfig;
     38  SysUtils, UConfig;
    3939
    4040procedure RegisterPage(Name: string; Producer: TPageProducer);
     
    5454  Navigace: string;
    5555begin
    56   Navigace := CgiEnvVar.RequestURI;
     56  //Navigace := CgiEnvVar.RequestURI;
    5757  Result := '<?xml version="1.0" encoding="utf-8"?>' +
    5858    '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' +
  • branches/web/UDatabase.pas

    r158 r279  
    2020    FDatabase: TDatabase;
    2121    FId: Integer;
    22     FRow: TAssocArray;
    23     procedure WriteProperty(Instance: TDbObject; PropInfo: PPropInfo; Data: TAssocArray; Depth: Integer);
     22    FRow: TAssociativeArray;
     23    procedure WriteProperty(Instance: TDbObject; PropInfo: PPropInfo; Data: TAssociativeArray; Depth: Integer);
    2424    procedure DeleteProperty(Instance: TDbObject; PropInfo: PPropInfo);
    2525    procedure DestroyProperty(Instance: TDbObject; PropInfo: PPropInfo; Depth: Integer);
    26     procedure ReadProperty(Instance: TObject; PropInfo: PPropInfo; Data: TAssocArray; Depth: Integer);
     26    procedure ReadProperty(Instance: TObject; PropInfo: PPropInfo; Data: TAssociativeArray; Depth: Integer);
    2727    function SearchPropertyByPointer(P: Pointer): string;
    2828  public
     
    3333    procedure LoadById(Id: Integer; Depth: Integer = 1);
    3434    procedure Load(Depth: Integer = 1);
    35     procedure LoadFromRow(Row: TAssocArray; Depth: Integer = 1);
     35    procedure LoadFromRow(Row: TAssociativeArray; Depth: Integer = 1);
    3636    destructor Destroy(Depth: Integer = 100); virtual;
    3737    property Database: TDatabase read FDatabase write FDatabase;
     
    126126{ TDbObject }
    127127
    128 procedure TDbObject.WriteProperty(Instance: TDbObject; PropInfo: PPropInfo; Data: TAssocArray; Depth: Integer);
     128procedure TDbObject.WriteProperty(Instance: TDbObject; PropInfo: PPropInfo; Data: TAssociativeArray; Depth: Integer);
    129129var
    130130  PropType: PTypeInfo;
     
    259259
    260260
    261 procedure TDbObject.ReadProperty(Instance: TObject; PropInfo: PPropInfo; Data: TAssocArray; Depth: Integer);
     261procedure TDbObject.ReadProperty(Instance: TObject; PropInfo: PPropInfo; Data: TAssociativeArray; Depth: Integer);
    262262const
    263263  NilMethod: TMethod = (Code: nil; Data: nil);
     
    434434procedure TDbObject.Store(Depth: Integer = 1);
    435435var
    436   Data: TAssocArray;
     436  Data: TAssociativeArray;
    437437  I, Count: Integer;
    438438  PropInfo: PPropInfo;
     
    442442  LogMessage('Write class: ' + Self.ClassName);
    443443  if Depth >= 0 then begin
    444   Data := TAssocArray.Create;
     444  Data := TAssociativeArray.Create;
    445445  if Self.ClassInfo = nil then raise Exception.Create('Trida '+Self.ClassName+' neposkytuje RTTI informace!');
    446446  Count := GetTypeData(Self.ClassInfo)^.PropCount;
     
    585585var
    586586  I: Integer;
    587   Data: TAssocArray;
     587  Data: TAssociativeArray;
    588588begin
    589589  if Depth >= 0 then begin
     
    592592  FDatabase.Delete(Self.ClassName, 'ListId='+IntToStr(FId));
    593593  if Self.ClassName = 'tmeasurepointsetlist' then LogMessage('d');
    594   Data := TAssocArray.Create;
     594  Data := TAssociativeArray.Create;
    595595  Data.AddKeyValue('ListId', IntToStr(FId));
    596596  Data.AddKeyValue('ItemId', '0');
     
    617617begin
    618618  inherited;
    619   inherited OnError := HandleError;
    620619end;
    621620
     
    626625end;
    627626
    628 procedure TDbObject.LoadFromRow(Row: TAssocArray; Depth: Integer = 1);
     627procedure TDbObject.LoadFromRow(Row: TAssociativeArray; Depth: Integer = 1);
    629628var
    630629  I, Count: Integer;
  • branches/web/UFinance.pas

    r135 r279  
    2525        Notice: string;
    2626        Inet: Boolean;
    27         procedure LoadFromDbRecord(DbRow: TAssocArray);
     27        procedure LoadFromDbRecord(DbRow: TAssociativeArray);
    2828        function FullName: string;
    2929  end;
     
    3939        PriceUnits: Double;
    4040        SpeedFactor: Double;
    41         procedure LoadFromDbRecord(DbRow: TAssocArray);
     41        procedure LoadFromDbRecord(DbRow: TAssociativeArray);
    4242        function Agregation: Double;
    4343  end;
     
    6868implementation
    6969
    70 uses 
    71   pwmain;
    72  
    7370{ TMember }
    7471
    75 procedure TMember.LoadFromDbRecord(DbRow: TAssocArray);
     72procedure TMember.LoadFromDbRecord(DbRow: TAssociativeArray);
    7673begin
    7774  Id := StrToInt(DbRow.Values['id']);
     
    8582  InetTariffNow := StrToInt(DbRow.Values['inet_tarif_now']);
    8683  InetTariffNext := StrToInt(DbRow.Values['inet_tarif_next']);
    87   MembershipDate := MysqlDateToDateTime(DbRow.Values['membership_date']);
     84  //MembershipDate := MysqlDateToDateTime(DbRow.Values['membership_date']);
    8885  Hardware := StrToBool(DbRow.Values['hw']);
    8986  Overheads := StrToBool(DbRow.Values['overheads']);
     
    9996{ TTariff }
    10097
    101 procedure TTariff.LoadFromDbRecord(DbRow: TAssocArray);
     98procedure TTariff.LoadFromDbRecord(DbRow: TAssociativeArray);
    10299begin
    103100  Name := DbRow.Values['name'];
     
    144141  BaseTariffPrice := StrToInt(DbRows[0].Values['BaseTariffPrice']);
    145142  DbRows.Free;
    146   WebWriteLn('1');
     143//  WebWriteLn('1');
    147144
    148145  DbRows := Database.Query('SELECT COUNT(*) FROM users WHERE inet=1 AND role=2');
     
    154151  InternetSegmentId := 21;
    155152  DbRows.Free;
    156   WebWriteLn('2');
     153//  WebWriteLn('2');
    157154 
    158155  DbRows := Database.Query('SELECT SUM(consumption) FROM network_segments');
     
    165162  TotalPaid := StrToInt(DbRows[0].Values['real']);
    166163 
    167   WebWriteLn('3');
     164//  WebWriteLn('3');
    168165  LoadTariffs(0);
    169166end;
     
    199196        TariffList.Add(NewTariff);
    200197  end;
    201   WebWriteLn('4');
     198//  WebWriteLn('4');
    202199 
    203200  if Period = 0 then Column := 'now' else Column := 'next';
     
    209206  with TTariff(TariffList[I]) do
    210207  begin
    211   WebWriteLn('5');
     208//  WebWriteLn('5');
    212209    DbRows := Database.Select('users', 'COUNT(*)', 'inet_tarif_' + Column + '=' + IntToStr(I) + ' AND inet=1 AND role=2');
    213210    UserCount := StrToInt(DbRows[0].ValuesAtIndex[0]);   
     
    237234  SpeedPerUnit := ResidualSpeed * 1024 / TotalTarifSpeedUnits;
    238235 
    239   WebWriteLn('7');
     236  //WebWriteLn('7');
    240237  // Recalculate price
    241238  for I := 0 to TariffList.Count - 1 do
  • branches/web/UFinancePage.pas

    r158 r279  
    2424
    2525uses
    26   USqlDatabase, UCore, SysUtils, pwmain, UFinance;
     26  USqlDatabase, UCore, SysUtils, UFinance;
    2727
    2828function FinanceOverviewPage: string;
  • branches/web/UNews.pas

    r158 r279  
    1616    Title: string;
    1717    Permission: Integer;
    18     procedure LoadFromDbRecord(DbRow: TAssocArray);
     18    procedure LoadFromDbRecord(DbRow: TAssociativeArray);
    1919    procedure Store;
    2020  end;
     
    3030    IPAddress: string;
    3131    Category: Integer;
    32     procedure LoadFromDbRecord(DbRow: TAssocArray);
     32    procedure LoadFromDbRecord(DbRow: TAssociativeArray);
    3333    procedure Store;
    3434  end;
     
    4949
    5050uses
    51   URSS, pwmain, dateutils;
     51  URSS, dateutils;
    5252
    5353{ TNewsItem }
    5454
    55 procedure TNewsItem.LoadFromDbRecord(DbRow: TAssocArray);
     55procedure TNewsItem.LoadFromDbRecord(DbRow: TAssociativeArray);
    5656begin
    5757  Id := StrToInt(DbRow.Values['id']);
     
    6666procedure TNewsItem.Store;
    6767var
    68   Values: TAssocArray;
    69 begin
    70   Values := TAssocArray.Create;
     68  Values: TAssociativeArray;
     69begin
     70  Values := TAssociativeArray.Create;
    7171  Values.AddKeyValue('content', Content);
    7272  Values.AddKeyValue('title', Title);
     
    112112*)
    113113
    114   if GetCgiVar('select') = '' then Select := '' else Select := GetCgiVar('select');
     114  //if GetCgiVar('select') = '' then Select := '' else Select := GetCgiVar('select');
    115115  SelectParts := Explode('-', Select);
    116116  Where := '';
     
    182182{ TNewsCategory }
    183183
    184 procedure TNewsCategory.LoadFromDbRecord(DbRow: TAssocArray);
     184procedure TNewsCategory.LoadFromDbRecord(DbRow: TAssociativeArray);
    185185begin
    186186  Id := StrToInt(DbRow.Values['id']);
     
    191191procedure TNewsCategory.Store;
    192192var
    193   Values: TAssocArray;
    194 begin
    195   Values := TAssocArray.Create;
     193  Values: TAssociativeArray;
     194begin
     195  Values := TAssociativeArray.Create;
    196196  Values.AddKeyValue('permission', IntToStr(Permission));
    197197  Values.AddKeyValue('title', Title);
  • branches/web/UNewsPage.pas

    r139 r279  
    1212
    1313uses
    14   USqlDatabase, UCore, SysUtils, pwmain, UNews, UConfig;
     14  USqlDatabase, UCore, SysUtils, UNews, UConfig;
    1515
    1616function NewsChannelBuild: string;
     
    2323  Result := ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Aktuality');
    2424  URL := '';
    25   Count := CountCgiVars;
     25  //Count := CountCgiVars;
    2626  for I := 0 to Count - 1 do begin
    27     Index := FetchCgiVarName(I);
     27    //Index := FetchCgiVarName(I);
    2828    if Copy(Index, 1, 8) = 'category' then URL := URL + '-' + Copy(Index, 9, Length(Index));
    2929  end;
     
    6767  NewsItem := TNewsItem.Create;
    6868  Result := ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Aktuality');
    69   if GetCgiVar('id') = '' then Id := 1 else Id := StrToInt(GetCgiVar('id')); 
     69  //if GetCgiVar('id') = '' then Id := 1 else Id := StrToInt(GetCgiVar('id'));
    7070  DbRows := Database.Query('SELECT `news`.*, UNIX_TIMESTAMP(`news`.date) as time, `User`.`Name` FROM `news` LEFT JOIN `User` ON `User`.`Id`=`news`.`User` WHERE  `news`.`id`=' + IntToStr(Id));
    7171  if DbRows.Count > 0 then begin
     
    110110begin
    111111  Result := ShowHeader('<strong>ZděchovNET</strong> - komunitní počítačová síť', 'Aktuality');
    112   if GetCgiVar('category') = '' then Category := 1 else Category := StrToInt(GetCgiVar('category')); 
     112//  if GetCgiVar('category') = '' then Category := 1 else Category := StrToInt(GetCgiVar('category'));
    113113  NewsItem := TNewsItem.Create;
    114114  DbRows := TDbRows.Create;
     
    116116  PageMax := StrToInt(DbRows[0].ValuesAtIndex[0]);
    117117  DbRows.Free;
    118   if GetCgiVar('page') = '' then Page := 0 else Page := StrToInt(GetCgiVar('page'));
     118//  if GetCgiVar('page') = '' then Page := 0 else Page := StrToInt(GetCgiVar('page'));
    119119  CategoryName := '';
    120120  Result := Result + '<strong>Seznam aktualit kategorie ' + CategoryName + ':</strong><div style="font-size: small;">';
  • branches/web/URSS.pas

    r139 r279  
    66
    77uses
    8   Classes, SysUtils, pwmain, dateutils;
     8  Classes, SysUtils, dateutils;
    99
    1010type
     
    5656  with TRSSChannelItem(Items[I]) do begin
    5757    Result := Result + '<item>' +
    58       '<title>' + FilterHTML(Title) + '</title>' +
    59       '<description>' + FilterHTML(Description) + '</description>' +
     58      //'<title>' + FilterHTML(Title) + '</title>' +
     59      //'<description>' + FilterHTML(Description) + '</description>' +
    6060      '<pubDate>' + RFC2822TimeFormat(Time) + '</pubDate>' +
    6161      '<link>' + Link + '</link>' +
  • branches/web/USqlDatabase.pas

    r142 r279  
    11unit USqlDatabase;
    22
    3 {$mode delphi}{$H+}
     3{$mode Delphi}{$H+}
     4// Upraveno: 16.12.2009
    45
    56interface
    67
    78uses
    8   SysUtils, Classes, mysql50, TypInfo;
     9  SysUtils, Classes, Dialogs, mysql50, TypInfo;
    910
    1011type
     12  EQueryError = Exception;
     13
    1114  TClientCapabilities = (_CLIENT_LONG_PASSWORD, _CLIENT_FOUND_ROWS,
    1215    _CLIENT_LONG_FLAG, _CLIENT_CONNECT_WITH_DB, _CLIENT_NO_SCHEMA,
     
    1619  TSetClientCapabilities = set of TClientCapabilities;
    1720
    18   TAssocArray = class(TStringList)
     21  TAssociativeArray = class(TStringList)
    1922  private
    2023    function GetValues(Index: string): string;
     
    3235  TDbRows = class(TList)
    3336  private
    34     function GetData(Index: Integer): TAssocArray;
    35     procedure SetData(Index: Integer; const Value: TAssocArray);
     37    function GetData(Index: Integer): TAssociativeArray;
     38    procedure SetData(Index: Integer; const Value: TAssociativeArray);
    3639  public
    37     property Data[Index: Integer]: TAssocArray read GetData write SetData; default;
     40    property Data[Index: Integer]: TAssociativeArray read GetData write SetData; default;
    3841    destructor Destroy; override;
    3942  end;
     
    4447    FSession: PMYSQL;
    4548    FConnected: Boolean;
    46     FOnError: TNotifyEvent;
    4749    FDatabase: string;
    4850    function GetConnected: Boolean;
     
    5254    function GetCharset: string;
    5355    procedure SetDatabase(const Value: string);
    54     { Private declarations }
    5556  public
    5657    Hostname: string;
    5758    UserName: string;
    5859    Password: string;
     60    Encoding: string;
    5961    Table: string;
    6062    RepeatLastAction: Boolean;
     
    6264    procedure CreateDatabase;
    6365    procedure CreateTable(Name: string);
    64     procedure CreateColumn(ATable, ColumnName: string; ColumnType: TTypeKind);
     66    procedure CreateColumn(Table, ColumnName: string; ColumnType: TTypeKind);
    6567    function Query(Data: string): TDbRows;
    6668    function Select(ATable: string; Filter: string = '*'; Condition: string = '1'): TDbRows;
    6769    procedure Delete(ATable: string; Condition: string = '1');
    68     procedure Insert(ATable: string; Data: TAssocArray);
    69     procedure Update(ATable: string; Data: TAssocArray; Condition: string = '1');
    70     procedure Replace(ATable: string; Data: TAssocArray);
     70    procedure Insert(ATable: string; Data: TAssociativeArray);
     71    procedure Update(ATable: string; Data: TAssociativeArray; Condition: string = '1');
     72    procedure Replace(ATable: string; Data: TAssociativeArray);
    7173    procedure Connect;
    7274    procedure Disconnect;
     
    7577    property LastErrorNumber: Integer read GetLastErrorNumber;
    7678    property Connected: Boolean read GetConnected;
    77     property OnError: TNotifyEvent read FOnError write FOnError;
    7879    constructor Create;
    7980    destructor Destroy; override;
     
    8485  function MySQLFloatToStr(F: Real): string;
    8586  function MySQLStrToFloat(S: string): Real;
    86   function MySQLDateToDateTime(Date: string): TDateTime;
    8787
    8888implementation
     
    105105  CLIENT_TRANSACTIONS = 8192;    // Client knows about transactions
    106106
    107 { TDataModule2 }
    108 
    109 function MySQLDateToDateTime(Date: string): TDateTime;
    110 begin
    111   Result := 0;
    112 end;
    113 
    114107function MySQLFloatToStr(F: Real): string;
    115108var
     
    117110begin
    118111  S := FloatToStr(F);
    119   if Pos(',',S) > 0 then S[Pos(',',S)] := '.';
     112  if Pos(',', S) > 0 then S[Pos(',',S)] := '.';
    120113  Result := S;
    121114end;
     
    123116function MySQLStrToFloat(S: string): Real;
    124117begin
    125   if Pos('.',S) > 0 then  S[Pos('.',S)] := ',';
     118  if Pos('.', S) > 0 then  S[Pos('.',S)] := ',';
    126119  Result := StrToFloat(S);
    127120end;
     121
     122{ TSqlDatabase }
    128123
    129124procedure TSqlDatabase.Connect;
     
    143138  end else FConnected := False;
    144139  CheckError;
    145   Rows := Query('SET NAMES cp1250');
     140  Rows := Query('SET NAMES ' + Encoding);
    146141  Rows.Free;
    147142end;
    148143
    149 procedure TSqlDatabase.Insert(ATable: string; Data: TAssocArray);
     144procedure TSqlDatabase.Insert(ATable: string; Data: TAssociativeArray);
    150145var
    151146  DbNames: string;
     
    153148  I: Integer;
    154149  Value: string;
    155   DbRows: TDbRows;
     150  DbResult: TDbRows;
    156151begin
    157152  Table := ATable;
    158153  DbNames := '';
    159154  DbValues := '';
    160   for I := 0 to Data.Count-1 do begin
     155  for I := 0 to Data.Count - 1 do begin
    161156    Value := Data.ValuesAtIndex[I];
    162157    StringReplace(Value, '"', '\"', [rfReplaceAll]);
     
    167162  System.Delete(DbNames, 1, 1);
    168163  System.Delete(DbValues, 1, 1);
    169   DbRows := Query('INSERT INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')');
    170   DbRows.Free;
     164  DbResult := Query('INSERT INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')');
     165  DbResult.Free;
    171166end;
    172167
     
    176171  DbResult: PMYSQL_RES;
    177172  DbRow: MYSQL_ROW;
    178 type
    179   PMYSQL_ROW2 = ^TMYSQL_ROW2;  // return data as array of strings
    180   TMYSQL_ROW2 = array[0..MaxInt div SizeOf(pChar) - 1] of pChar;
    181173begin
    182174  //DebugLog('SqlDatabase query: '+Data);
     
    194186    if Assigned(DbResult) then begin
    195187      Result.Count := mysql_num_rows(DbResult);
    196       for I := 0 to Result.Count-1 do begin
     188      for I := 0 to Result.Count - 1 do begin
    197189        DbRow := mysql_fetch_row(DbResult);
    198         Result[I] := TAssocArray.Create;
     190        Result[I] := TAssociativeArray.Create;
    199191        with Result[I] do begin
    200           for II := 0 to mysql_num_fields(DbResult)-1 do begin
    201             Add(mysql_fetch_field_direct(DbResult, II)^.name + NameValueSeparator + PMYSQL_ROW2(DbRow)^[II]);
     192          for II := 0 to mysql_num_fields(DbResult) - 1 do begin
     193            Add(mysql_fetch_field_direct(DbResult, II)^.Name +
     194              NameValueSeparator + PChar((DbRow + II)^));
    202195          end;
    203196        end;
     
    215208end;
    216209
    217 procedure TSqlDatabase.Replace(ATable: string; Data: TAssocArray);
     210procedure TSqlDatabase.Replace(ATable: string; Data: TAssociativeArray);
    218211var
    219212  DbNames: string;
     
    221214  Value: string;
    222215  I: Integer;
    223   DbRows: TDbRows;
     216  DbResult: TDbRows;
    224217begin
    225218  Table := ATable;
    226219  DbNames := '';
    227220  DbValues := '';
    228   for I := 0 to Data.Count-1 do begin
     221  for I := 0 to Data.Count - 1 do begin
    229222    Value := Data.ValuesAtIndex[I];
    230223    StringReplace(Value, '"', '\"', [rfReplaceAll]);
     
    235228  System.Delete(DbNames, 1, 1);
    236229  System.Delete(DbValues, 1, 1);
    237   DbRows := Query('REPLACE INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')');
    238   DbRows.Free;
     230  DbResult := Query('REPLACE INTO `' + Table + '` (' + DbNames + ') VALUES (' + DbValues + ')');
     231  DbResult.Free;
    239232end;
    240233
     
    245238end;
    246239
    247 procedure TSqlDatabase.Update(ATable: string; Data: TAssocArray; Condition: string = '1');
     240procedure TSqlDatabase.Update(ATable: string; Data: TAssociativeArray; Condition: string = '1');
    248241var
    249242  DbValues: string;
    250243  Value: string;
    251244  I: Integer;
    252   DbRows: TDbRows;
     245  DbResult: TDbRows;
    253246begin
    254247  Table := ATable;
    255248  DbValues := '';
    256   for I := 0 to Data.Count-1 do begin
     249  for I := 0 to Data.Count - 1 do begin
    257250    Value := Data.ValuesAtIndex[I];
    258251    StringReplace(Value, '"', '\"', [rfReplaceAll]);
     
    261254  end;
    262255  System.Delete(DbValues, 1, 1);
    263   DbRows := Query('UPDATE `' + Table + '` SET (' + DbValues + ') WHERE ' + Condition);
    264   DBRows.Free;
     256  DbResult := Query('UPDATE `' + Table + '` SET (' + DbValues + ') WHERE ' + Condition);
     257  DbResult.Free;
    265258end;
    266259
     
    270263end;
    271264
    272 { TAssocArray }
    273 
    274 procedure TAssocArray.AddKeyValue(Key, Value: string);
    275 begin
    276   Add(Key + NameValueSeparator + Value);
    277 end;
    278 
    279 constructor TAssocArray.Create;
    280 begin
    281   NameValueSeparator := '|';
    282 end;
    283 
    284 destructor TAssocArray.Destroy;
    285 begin
    286   inherited;
    287 end;
    288 
    289 function TAssocArray.GetAllValues: string;
    290 var
    291   I: Integer;
    292 begin
    293   Result := '';
    294   for I := 0 to Count-1 do begin
    295     Result := Result + Names[I] + '=' + ValuesAtIndex[I] + ',';
    296   end;
    297 end;
    298 
    299 function TAssocArray.GetValues(Index: string): string;
    300 begin
    301   Result := inherited Values[Index];
    302 end;
    303 
    304 function TAssocArray.GetValuesAtIndex(Index: Integer): string;
    305 begin
    306   Result := inherited Values[Names[Index]];
    307 end;
    308 
    309265procedure TSqlDatabase.Delete(ATable: string; Condition: string = '1');
    310266var
    311   DbRows: TDbRows;
     267  DbResult: TDbRows;
    312268begin
    313269  Table := ATable;
    314   DbRows := Query('DELETE FROM `' + Table + '` WHERE ' + Condition);
    315   DbRows.Free;
     270  DbResult := Query('DELETE FROM `' + Table + '` WHERE ' + Condition);
     271  DbResult.Free;
    316272end;
    317273
     
    331287  inherited;
    332288  FSession := nil;
    333 end;
    334 
    335 procedure TAssocArray.SetValues(Index: string; const Value: string);
    336 begin
    337   inherited Values[Index] := Value;
    338 end;
    339 
    340 { TDbRows }
    341 
    342 destructor TDbRows.Destroy;
    343 var
    344   I: Integer;
    345 begin
    346   for I := 0 to Count - 1 do Data[I].Free;
    347   inherited;
    348 end;
    349 
    350 function TDbRows.GetData(Index: Integer): TAssocArray;
    351 begin
    352   Result := Items[Index];
    353 end;
    354 
    355 procedure TDbRows.SetData(Index: Integer; const Value: TAssocArray);
    356 begin
    357   Items[Index] := Value;
     289  Encoding := 'utf8';
    358290end;
    359291
     
    376308begin
    377309  Result := LastErrorNumber <> 0;
    378   if Result and Assigned(OnError) then OnError(Self);
     310  if Result then
     311    raise EQueryError.Create('Database query error: "' + LastErrorMessage + '"');
    379312end;
    380313
     
    394327begin
    395328  Query('CREATE TABLE `' + Name + '`' +
    396   ' (`id` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`));');
    397 end;
    398 
    399 procedure TSqlDatabase.CreateColumn(ATable, ColumnName: string;
     329  ' (`Id` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (`Id`));');
     330end;
     331
     332procedure TSqlDatabase.CreateColumn(Table, ColumnName: string;
    400333  ColumnType: TTypeKind);
    401334const
     
    423356end;
    424357
     358{ TAssociativeArray }
     359
     360procedure TAssociativeArray.AddKeyValue(Key, Value: string);
     361begin
     362  Add(Key + NameValueSeparator + Value);
     363end;
     364
     365constructor TAssociativeArray.Create;
     366begin
     367  NameValueSeparator := '|';
     368end;
     369
     370destructor TAssociativeArray.Destroy;
     371begin
     372  inherited;
     373end;
     374
     375function TAssociativeArray.GetAllValues: string;
     376var
     377  I: Integer;
     378begin
     379  Result := '';
     380  for I := 0 to Count - 1 do begin
     381    Result := Result + Names[I] + '=' + ValuesAtIndex[I] + ',';
     382  end;
     383end;
     384
     385function TAssociativeArray.GetValues(Index: string): string;
     386begin
     387  Result := inherited Values[Index];
     388end;
     389
     390function TAssociativeArray.GetValuesAtIndex(Index: Integer): string;
     391begin
     392  Result := inherited Values[Names[Index]];
     393end;
     394
     395procedure TAssociativeArray.SetValues(Index: string; const Value: string);
     396begin
     397  inherited Values[Index] := Value;
     398end;
     399
     400{ TDbRows }
     401
     402destructor TDbRows.Destroy;
     403var
     404  I: Integer;
     405begin
     406  for I := 0 to Count - 1 do
     407    Data[I].Free;
     408  inherited;
     409end;
     410
     411function TDbRows.GetData(Index: Integer): TAssociativeArray;
     412begin
     413  Result := Items[Index];
     414end;
     415
     416procedure TDbRows.SetData(Index: Integer; const Value: TAssociativeArray);
     417begin
     418  Items[Index] := Value;
     419end;
     420
    425421end.
    426422
  • branches/web/UUser.pas

    r158 r279  
    2626    IC: Integer;
    2727    DIC: string;
    28     procedure LoadFromDbRecord(DbRow: TAssocArray);
     28    procedure LoadFromDbRecord(DbRow: TAssociativeArray);
    2929    procedure Store;
    3030  end;
     
    4141{ TUser }
    4242
    43 procedure TUser.LoadFromDbRecord(DbRow: TAssocArray);
     43procedure TUser.LoadFromDbRecord(DbRow: TAssociativeArray);
    4444begin
    4545  Id := StrToInt(DbRow.Values['id']);
     
    5454procedure TUser.Store;
    5555var
    56   Values: TAssocArray;
     56  Values: TAssociativeArray;
    5757begin
    58   Values := TAssocArray.Create;
     58  Values := TAssociativeArray.Create;
    5959  Values.AddKeyValue('second_name', SecondName);
    6060  Values.AddKeyValue('first_name', FirstName);
  • branches/web/index.lpi

    r167 r279  
    22<CONFIG>
    33  <ProjectOptions>
    4     <PathDelim Value="/"/>
    5     <Version Value="6"/>
     4    <Version Value="7"/>
    65    <General>
    76      <Flags>
     
    98        <MainUnitHasCreateFormStatements Value="False"/>
    109        <MainUnitHasTitleStatement Value="False"/>
     10        <LRSInOutputDirectory Value="False"/>
    1111      </Flags>
    1212      <MainUnit Value="0"/>
    13       <IconPath Value="./"/>
    1413      <TargetFileExt Value=".exe"/>
    15       <ActiveEditorIndexAtStart Value="5"/>
     14      <ActiveEditorIndexAtStart Value="7"/>
    1615    </General>
    1716    <VersionInfo>
    18       <ProjectVersion Value=""/>
     17      <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
    1918    </VersionInfo>
    2019    <PublishOptions>
     
    3534        <IsPartOfProject Value="True"/>
    3635        <UnitName Value="Index"/>
    37         <CursorPos X="29" Y="7"/>
    38         <TopLine Value="1"/>
    39         <EditorIndex Value="5"/>
    40         <UsageCount Value="95"/>
    41         <Loaded Value="True"/>
     36        <CursorPos X="53" Y="22"/>
     37        <TopLine Value="1"/>
     38        <EditorIndex Value="7"/>
     39        <UsageCount Value="96"/>
     40        <Loaded Value="True"/>
     41        <SyntaxHighlighter Value="Delphi"/>
    4242      </Unit0>
    4343      <Unit1>
     
    4747        <CursorPos X="80" Y="21"/>
    4848        <TopLine Value="1"/>
    49         <UsageCount Value="95"/>
     49        <UsageCount Value="96"/>
     50        <SyntaxHighlighter Value="Delphi"/>
    5051      </Unit1>
    5152      <Unit2>
     
    5354        <IsPartOfProject Value="True"/>
    5455        <UnitName Value="USqlDatabase"/>
    55         <CursorPos X="3" Y="111"/>
    56         <TopLine Value="1"/>
     56        <CursorPos X="46" Y="338"/>
     57        <TopLine Value="319"/>
    5758        <EditorIndex Value="0"/>
    58         <UsageCount Value="95"/>
    59         <Loaded Value="True"/>
     59        <UsageCount Value="96"/>
     60        <Loaded Value="True"/>
     61        <SyntaxHighlighter Value="Delphi"/>
    6062      </Unit2>
    6163      <Unit3>
    6264        <Filename Value="UXmlClasses.pas"/>
    6365        <IsPartOfProject Value="True"/>
    64         <UsageCount Value="95"/>
     66        <UsageCount Value="96"/>
     67        <SyntaxHighlighter Value="Delphi"/>
    6568      </Unit3>
    6669      <Unit4>
     
    6871        <IsPartOfProject Value="True"/>
    6972        <UnitName Value="UCore"/>
    70         <CursorPos X="48" Y="104"/>
    71         <TopLine Value="76"/>
    72         <EditorIndex Value="7"/>
    73         <UsageCount Value="95"/>
    74         <Loaded Value="True"/>
     73        <CursorPos X="5" Y="56"/>
     74        <TopLine Value="37"/>
     75        <EditorIndex Value="9"/>
     76        <UsageCount Value="96"/>
     77        <Loaded Value="True"/>
     78        <SyntaxHighlighter Value="Delphi"/>
    7579      </Unit4>
    7680      <Unit5>
     
    7882        <IsPartOfProject Value="True"/>
    7983        <UnitName Value="UFinance"/>
    80         <CursorPos X="1" Y="1"/>
    81         <TopLine Value="81"/>
    82         <UsageCount Value="95"/>
     84        <CursorPos X="5" Y="236"/>
     85        <TopLine Value="217"/>
     86        <EditorIndex Value="11"/>
     87        <UsageCount Value="96"/>
     88        <Loaded Value="True"/>
     89        <SyntaxHighlighter Value="Delphi"/>
    8390      </Unit5>
    8491      <Unit6>
     
    8693        <IsPartOfProject Value="True"/>
    8794        <UnitName Value="UFinancePage"/>
    88         <CursorPos X="42" Y="101"/>
    89         <TopLine Value="75"/>
    90         <EditorIndex Value="8"/>
    91         <UsageCount Value="95"/>
    92         <Loaded Value="True"/>
     95        <CursorPos X="34" Y="26"/>
     96        <TopLine Value="6"/>
     97        <EditorIndex Value="10"/>
     98        <UsageCount Value="96"/>
     99        <Loaded Value="True"/>
     100        <SyntaxHighlighter Value="Delphi"/>
    93101      </Unit6>
    94102      <Unit7>
     
    98106        <CursorPos X="34" Y="30"/>
    99107        <TopLine Value="17"/>
    100         <UsageCount Value="95"/>
     108        <UsageCount Value="96"/>
     109        <SyntaxHighlighter Value="Delphi"/>
    101110      </Unit7>
    102111      <Unit8>
     
    104113        <IsPartOfProject Value="True"/>
    105114        <UnitName Value="UNews"/>
    106         <CursorPos X="1" Y="16"/>
    107         <TopLine Value="12"/>
    108         <UsageCount Value="95"/>
     115        <CursorPos X="25" Y="195"/>
     116        <TopLine Value="176"/>
     117        <EditorIndex Value="2"/>
     118        <UsageCount Value="96"/>
     119        <Loaded Value="True"/>
     120        <SyntaxHighlighter Value="Delphi"/>
    109121      </Unit8>
    110122      <Unit9>
     
    112124        <IsPartOfProject Value="True"/>
    113125        <UnitName Value="UNewsPage"/>
    114         <CursorPos X="28" Y="149"/>
    115         <TopLine Value="106"/>
    116         <EditorIndex Value="6"/>
    117         <UsageCount Value="95"/>
    118         <Loaded Value="True"/>
     126        <CursorPos X="102" Y="121"/>
     127        <TopLine Value="102"/>
     128        <EditorIndex Value="8"/>
     129        <UsageCount Value="96"/>
     130        <Loaded Value="True"/>
     131        <SyntaxHighlighter Value="Delphi"/>
    119132      </Unit9>
    120133      <Unit10>
    121         <Filename Value="../../../../../../../usr/share/fpcsrc/rtl/unix/sysutils.pp"/>
     134        <Filename Value="/usr/share/fpcsrc/rtl/unix/sysutils.pp"/>
    122135        <UnitName Value="sysutils"/>
    123136        <CursorPos X="10" Y="94"/>
     
    126139      </Unit10>
    127140      <Unit11>
    128         <Filename Value="../../../../../../../usr/share/fpcsrc/rtl/objpas/sysutils/sysutils.inc"/>
     141        <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/sysutils.inc"/>
    129142        <CursorPos X="26" Y="17"/>
    130143        <TopLine Value="121"/>
     
    132145      </Unit11>
    133146      <Unit12>
    134         <Filename Value="../../../../../../../usr/share/fpcsrc/rtl/objpas/sysutils/sysstrh.inc"/>
     147        <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/sysstrh.inc"/>
    135148        <CursorPos X="4" Y="33"/>
    136149        <TopLine Value="18"/>
     
    148161        <IsPartOfProject Value="True"/>
    149162        <UnitName Value="URSS"/>
    150         <CursorPos X="56" Y="16"/>
    151         <TopLine Value="1"/>
    152         <UsageCount Value="83"/>
     163        <CursorPos X="9" Y="59"/>
     164        <TopLine Value="40"/>
     165        <EditorIndex Value="3"/>
     166        <UsageCount Value="84"/>
     167        <Loaded Value="True"/>
     168        <SyntaxHighlighter Value="Delphi"/>
    153169      </Unit14>
    154170      <Unit15>
    155         <Filename Value="../../../../../../../usr/share/fpcsrc/rtl/objpas/sysutils/datih.inc"/>
     171        <Filename Value="/usr/share/fpcsrc/rtl/objpas/sysutils/datih.inc"/>
    156172        <CursorPos X="10" Y="117"/>
    157173        <TopLine Value="115"/>
     
    159175      </Unit15>
    160176      <Unit16>
    161         <Filename Value="../../../../../../../usr/share/fpcsrc/rtl/objpas/dateutil.inc"/>
     177        <Filename Value="/usr/share/fpcsrc/rtl/objpas/dateutil.inc"/>
    162178        <CursorPos X="3" Y="624"/>
    163179        <TopLine Value="34"/>
     
    170186        <CursorPos X="3" Y="14"/>
    171187        <TopLine Value="1"/>
    172         <EditorIndex Value="9"/>
    173         <UsageCount Value="70"/>
    174         <Loaded Value="True"/>
     188        <UsageCount Value="71"/>
     189        <SyntaxHighlighter Value="Delphi"/>
    175190      </Unit17>
    176191      <Unit18>
     
    179194        <CursorPos X="1" Y="134"/>
    180195        <TopLine Value="108"/>
    181         <UsageCount Value="70"/>
     196        <UsageCount Value="71"/>
    182197        <SyntaxHighlighter Value="None"/>
    183198      </Unit18>
     
    187202        <CursorPos X="1" Y="1"/>
    188203        <TopLine Value="1"/>
    189         <UsageCount Value="70"/>
     204        <UsageCount Value="71"/>
    190205        <SyntaxHighlighter Value="JScript"/>
    191206      </Unit19>
     
    194209        <IsPartOfProject Value="True"/>
    195210        <UnitName Value="UDatabase"/>
    196         <CursorPos X="17" Y="1129"/>
    197         <TopLine Value="1107"/>
     211        <CursorPos X="44" Y="627"/>
     212        <TopLine Value="608"/>
    198213        <EditorIndex Value="1"/>
    199         <UsageCount Value="64"/>
    200         <Loaded Value="True"/>
     214        <UsageCount Value="65"/>
     215        <Loaded Value="True"/>
     216        <SyntaxHighlighter Value="Delphi"/>
    201217      </Unit20>
    202218      <Unit21>
     
    204220        <IsPartOfProject Value="True"/>
    205221        <UnitName Value="UUser"/>
    206         <CursorPos X="31" Y="36"/>
    207         <TopLine Value="14"/>
    208         <EditorIndex Value="3"/>
    209         <UsageCount Value="64"/>
    210         <Loaded Value="True"/>
     222        <CursorPos X="25" Y="58"/>
     223        <TopLine Value="39"/>
     224        <EditorIndex Value="5"/>
     225        <UsageCount Value="65"/>
     226        <Loaded Value="True"/>
     227        <SyntaxHighlighter Value="Delphi"/>
    211228      </Unit21>
    212229      <Unit22>
     
    216233        <CursorPos X="69" Y="19"/>
    217234        <TopLine Value="1"/>
    218         <EditorIndex Value="2"/>
    219         <UsageCount Value="60"/>
    220         <Loaded Value="True"/>
     235        <EditorIndex Value="4"/>
     236        <UsageCount Value="61"/>
     237        <Loaded Value="True"/>
     238        <SyntaxHighlighter Value="Delphi"/>
    221239      </Unit22>
    222240      <Unit23>
     
    224242        <IsPartOfProject Value="True"/>
    225243        <UnitName Value="UBill"/>
    226         <CursorPos X="36" Y="60"/>
    227         <TopLine Value="34"/>
    228         <EditorIndex Value="4"/>
    229         <UsageCount Value="57"/>
    230         <Loaded Value="True"/>
     244        <CursorPos X="52" Y="8"/>
     245        <TopLine Value="1"/>
     246        <EditorIndex Value="6"/>
     247        <UsageCount Value="58"/>
     248        <Loaded Value="True"/>
     249        <SyntaxHighlighter Value="Delphi"/>
    231250      </Unit23>
    232251      <Unit24>
    233         <Filename Value="../../../../../../../usr/share/fpcsrc/packages/fv/src/dialogs.pas"/>
     252        <Filename Value="/usr/share/fpcsrc/packages/fv/src/dialogs.pas"/>
    234253        <UnitName Value="Dialogs"/>
    235254        <CursorPos X="19" Y="4"/>
     
    240259    <JumpHistory Count="30" HistoryIndex="29">
    241260      <Position1>
    242         <Filename Value="UBill.pas"/>
    243         <Caret Line="146" Column="51" TopLine="136"/>
     261        <Filename Value="UFinance.pas"/>
     262        <Caret Line="198" Column="3" TopLine="179"/>
    244263      </Position1>
    245264      <Position2>
    246         <Filename Value="UBill.pas"/>
    247         <Caret Line="28" Column="24" TopLine="3"/>
     265        <Filename Value="UFinance.pas"/>
     266        <Caret Line="208" Column="3" TopLine="189"/>
    248267      </Position2>
    249268      <Position3>
    250         <Filename Value="UBill.pas"/>
    251         <Caret Line="25" Column="21" TopLine="6"/>
     269        <Filename Value="UNewsPage.pas"/>
     270        <Caret Line="149" Column="28" TopLine="106"/>
    252271      </Position3>
    253272      <Position4>
    254         <Filename Value="UBill.pas"/>
    255         <Caret Line="37" Column="17" TopLine="28"/>
     273        <Filename Value="UNewsPage.pas"/>
     274        <Caret Line="14" Column="34" TopLine="1"/>
    256275      </Position4>
    257276      <Position5>
    258         <Filename Value="UBill.pas"/>
    259         <Caret Line="33" Column="16" TopLine="19"/>
     277        <Filename Value="UNewsPage.pas"/>
     278        <Caret Line="25" Column="5" TopLine="6"/>
    260279      </Position5>
    261280      <Position6>
    262         <Filename Value="UBill.pas"/>
    263         <Caret Line="66" Column="3" TopLine="48"/>
     281        <Filename Value="UNewsPage.pas"/>
     282        <Caret Line="27" Column="7" TopLine="8"/>
    264283      </Position6>
    265284      <Position7>
    266         <Filename Value="UBill.pas"/>
    267         <Caret Line="78" Column="3" TopLine="60"/>
     285        <Filename Value="UNewsPage.pas"/>
     286        <Caret Line="69" Column="5" TopLine="50"/>
    268287      </Position7>
    269288      <Position8>
    270         <Filename Value="UBill.pas"/>
    271         <Caret Line="137" Column="7" TopLine="105"/>
     289        <Filename Value="UNewsPage.pas"/>
     290        <Caret Line="112" Column="3" TopLine="93"/>
    272291      </Position8>
    273292      <Position9>
    274         <Filename Value="UBill.pas"/>
    275         <Caret Line="151" Column="1" TopLine="124"/>
     293        <Filename Value="UUser.pas"/>
     294        <Caret Line="36" Column="31" TopLine="14"/>
    276295      </Position9>
    277296      <Position10>
    278         <Filename Value="UFinancePage.pas"/>
    279         <Caret Line="9" Column="50" TopLine="1"/>
     297        <Filename Value="UUser.pas"/>
     298        <Caret Line="28" Column="51" TopLine="8"/>
    280299      </Position10>
    281300      <Position11>
    282         <Filename Value="UFinancePage.pas"/>
    283         <Caret Line="8" Column="1" TopLine="1"/>
     301        <Filename Value="UUser.pas"/>
     302        <Caret Line="43" Column="53" TopLine="24"/>
    284303      </Position11>
    285304      <Position12>
    286         <Filename Value="UFinancePage.pas"/>
    287         <Caret Line="14" Column="3" TopLine="1"/>
     305        <Filename Value="UUser.pas"/>
     306        <Caret Line="56" Column="23" TopLine="37"/>
    288307      </Position12>
    289308      <Position13>
    290         <Filename Value="UFinancePage.pas"/>
    291         <Caret Line="16" Column="3" TopLine="14"/>
     309        <Filename Value="UBill.pas"/>
     310        <Caret Line="60" Column="36" TopLine="34"/>
    292311      </Position13>
    293312      <Position14>
    294         <Filename Value="UFinancePage.pas"/>
    295         <Caret Line="117" Column="10" TopLine="90"/>
     313        <Filename Value="UBill.pas"/>
     314        <Caret Line="155" Column="21" TopLine="135"/>
    296315      </Position14>
    297316      <Position15>
    298         <Filename Value="UFinancePage.pas"/>
    299         <Caret Line="123" Column="45" TopLine="91"/>
     317        <Filename Value="UBill.pas"/>
     318        <Caret Line="157" Column="23" TopLine="138"/>
    300319      </Position15>
    301320      <Position16>
    302         <Filename Value="UFinancePage.pas"/>
    303         <Caret Line="12" Column="1" TopLine="8"/>
     321        <Filename Value="UBill.pas"/>
     322        <Caret Line="315" Column="21" TopLine="287"/>
    304323      </Position16>
    305324      <Position17>
    306         <Filename Value="UFinancePage.pas"/>
    307         <Caret Line="116" Column="34" TopLine="96"/>
     325        <Filename Value="index.pas"/>
     326        <Caret Line="6" Column="45" TopLine="1"/>
    308327      </Position17>
    309328      <Position18>
    310         <Filename Value="UFinancePage.pas"/>
    311         <Caret Line="118" Column="45" TopLine="96"/>
     329        <Filename Value="index.pas"/>
     330        <Caret Line="14" Column="3" TopLine="1"/>
    312331      </Position18>
    313332      <Position19>
    314         <Filename Value="UFinancePage.pas"/>
    315         <Caret Line="8" Column="21" TopLine="1"/>
     333        <Filename Value="index.pas"/>
     334        <Caret Line="15" Column="5" TopLine="1"/>
    316335      </Position19>
    317336      <Position20>
    318         <Filename Value="UFinancePage.pas"/>
    319         <Caret Line="17" Column="17" TopLine="1"/>
     337        <Filename Value="index.pas"/>
     338        <Caret Line="21" Column="3" TopLine="1"/>
    320339      </Position20>
    321340      <Position21>
    322         <Filename Value="UFinancePage.pas"/>
    323         <Caret Line="122" Column="10" TopLine="95"/>
     341        <Filename Value="UBill.pas"/>
     342        <Caret Line="317" Column="23" TopLine="287"/>
    324343      </Position21>
    325344      <Position22>
    326         <Filename Value="UDatabase.pas"/>
    327         <Caret Line="1164" Column="10" TopLine="1129"/>
     345        <Filename Value="UBill.pas"/>
     346        <Caret Line="8" Column="52" TopLine="1"/>
    328347      </Position22>
    329348      <Position23>
    330         <Filename Value="index.pas"/>
    331         <Caret Line="14" Column="16" TopLine="1"/>
     349        <Filename Value="UBill.pas"/>
     350        <Caret Line="25" Column="29" TopLine="1"/>
    332351      </Position23>
    333352      <Position24>
    334         <Filename Value="UUserPage.pas"/>
    335         <Caret Line="6" Column="31" TopLine="1"/>
     353        <Filename Value="UBill.pas"/>
     354        <Caret Line="314" Column="1" TopLine="286"/>
    336355      </Position24>
    337356      <Position25>
    338         <Filename Value="UUser.pas"/>
    339         <Caret Line="29" Column="21" TopLine="1"/>
     357        <Filename Value="UBill.pas"/>
     358        <Caret Line="168" Column="16" TopLine="149"/>
    340359      </Position25>
    341360      <Position26>
    342         <Filename Value="UDatabase.pas"/>
    343         <Caret Line="442" Column="35" TopLine="434"/>
     361        <Filename Value="UNewsPage.pas"/>
     362        <Caret Line="118" Column="3" TopLine="99"/>
    344363      </Position26>
    345364      <Position27>
    346         <Filename Value="UDatabase.pas"/>
    347         <Caret Line="1132" Column="25" TopLine="1110"/>
     365        <Filename Value="USqlDatabase.pas"/>
     366        <Caret Line="308" Column="13" TopLine="70"/>
    348367      </Position27>
    349368      <Position28>
    350         <Filename Value="UDatabase.pas"/>
    351         <Caret Line="1131" Column="7" TopLine="1109"/>
     369        <Filename Value="UBill.pas"/>
     370        <Caret Line="177" Column="16" TopLine="161"/>
    352371      </Position28>
    353372      <Position29>
    354373        <Filename Value="UBill.pas"/>
    355         <Caret Line="75" Column="26" TopLine="39"/>
     374        <Caret Line="314" Column="3" TopLine="286"/>
    356375      </Position29>
    357376      <Position30>
    358377        <Filename Value="UBill.pas"/>
    359         <Caret Line="10" Column="15" TopLine="1"/>
     378        <Caret Line="168" Column="16" TopLine="149"/>
    360379      </Position30>
    361380    </JumpHistory>
     
    363382  <CompilerOptions>
    364383    <Version Value="8"/>
    365     <Target>
    366       <Filename Value="index.cgi"/>
    367     </Target>
    368384    <SearchPaths>
    369       <OtherUnitFiles Value="/var/www/html/other/powtils/extras/;/var/www/html/other/powtils/main/"/>
     385      <OtherUnitFiles Value="/usr/lib/mysql/;/usr/lib64/mysql/"/>
     386      <UnitOutputDirectory Value="bin"/>
    370387      <LCLWidgetType Value="gtk2"/>
    371388    </SearchPaths>
    372389    <Parsing>
    373390      <SyntaxOptions>
     391        <SyntaxMode Value="Delphi"/>
    374392        <CStyleOperator Value="False"/>
     393        <AllowLabel Value="False"/>
     394        <CPPInline Value="False"/>
    375395      </SyntaxOptions>
    376396    </Parsing>
     
    387407      <Verbosity>
    388408        <ShoLineNum Value="True"/>
     409        <ShowDebugInfo Value="True"/>
    389410      </Verbosity>
     411      <WriteFPCLogo Value="False"/>
    390412      <CompilerPath Value="$(CompPath)"/>
    391413    </Other>
  • branches/web/index.pas

    r142 r279  
    44
    55uses
    6   UCore, USqlDatabase, SysUtils, UMainPage, pwinit, pwmain,
     6  UCore, USqlDatabase, SysUtils, UMainPage,
    77  UFinancePage, UNewsPage, UUserPage, UBill;
    88
     
    1212  PageName: string;
    1313begin
    14   SetHeader('Content-Type', 'text/html; charset=utf-8');
    15   PageName := GetCgiVar('p');
     14//  SetHeader('Content-Type', 'text/html; charset=utf-8');
     15  //PageName := GetCgiVar('p');
    1616  if PageName = '' then PageName := 'index';
    1717  I := 0;
     
    1919  if I < Length(Pages) then Output := Pages[I].Producer
    2020    else Output := 'Stránka nenalezena';
    21   WebWriteLn(FormatOutput(Output));
     21//  WebWriteLn(FormatOutput(Output));
    2222end.
Note: See TracChangeset for help on using the changeset viewer.