Changeset 137 for trunk/Packages/CoolWeb
- Timestamp:
- Sep 9, 2022, 1:16:58 AM (2 years ago)
- Location:
- trunk/Packages/CoolWeb
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CoolWeb/Common/UHtmlClasses.pas
r84 r137 1 1 unit UHtmlClasses; 2 3 {$mode delphi}{$H+}4 2 5 3 interface … … 242 240 end; 243 241 242 244 243 implementation 245 244 246 245 resourcestring 247 246 SStringToIPConversionError = 'String to IP address conversion error'; 248 249 247 250 248 function LeftCutString(var Source, Output: string; Delimiter: string; Allowed: string = ''): Boolean; … … 322 320 begin 323 321 Value.Free; 324 inherited Destroy;322 inherited; 325 323 end; 326 324 … … 345 343 begin 346 344 Cells.Free; 347 inherited Destroy;345 inherited; 348 346 end; 349 347 … … 370 368 begin 371 369 Rows.Free; 372 inherited Destroy;370 inherited; 373 371 end; 374 372 … … 421 419 constructor THtmlInput.Create; 422 420 begin 423 424 421 end; 425 422 426 423 destructor THtmlInput.Destroy; 427 424 begin 428 inherited Destroy;425 inherited; 429 426 end; 430 427 … … 452 449 begin 453 450 Action.Free; 454 inherited Destroy;451 inherited; 455 452 end; 456 453 … … 754 751 begin 755 752 Levels.Free; 756 inherited Destroy;753 inherited; 757 754 end; 758 755 … … 893 890 begin 894 891 Data.Free; 895 inherited Destroy;892 inherited; 896 893 end; 897 894 -
trunk/Packages/CoolWeb/Common/UMIMEType.pas
r84 r137 1 1 unit UMIMEType; 2 3 {$mode Delphi}{$H+}4 2 5 3 interface … … 12 10 var 13 11 MIMETypeList: TStringList; 12 14 13 15 14 implementation -
trunk/Packages/CoolWeb/Common/UMemoryStreamEx.pas
r84 r137 1 1 unit UMemoryStreamEx; 2 3 {$mode delphi}{$H+}4 2 5 3 interface … … 59 57 end; 60 58 59 61 60 implementation 62 61 … … 261 260 end; 262 261 263 procedure TMemoryStreamEx.WriteString(Data: string);262 procedure TMemoryStreamEx.WriteString(Data: string); 264 263 begin 265 264 if Length(Data) > 0 then … … 314 313 constructor TThreadMemoryStreamEx.Create; 315 314 begin 316 inherited Create;315 inherited; 317 316 Lock := TCriticalSection.Create; 318 317 end; … … 321 320 begin 322 321 Lock.Free; 323 inherited Destroy;322 inherited; 324 323 end; 325 324 -
trunk/Packages/CoolWeb/Common/UXmlClasses.pas
r84 r137 1 1 unit UXmlClasses; 2 3 {$mode delphi}{$H+}4 2 5 3 interface 6 4 7 uses Classes, SysUtils, StrUtils, SpecializedList,8 SpecializedDictionary;5 uses 6 Classes, SysUtils, StrUtils, SpecializedList, SpecializedDictionary; 9 7 10 8 type … … 50 48 property AsString: string read GetAsString; 51 49 end; 50 52 51 53 52 implementation -
trunk/Packages/CoolWeb/LazIDEReg.pas
r132 r137 1 1 unit LazIDEReg; 2 3 {$mode objfpc}{$H+}4 2 5 3 interface … … 9 7 10 8 type 11 9 { TFileDescWebPage } 12 10 13 11 TFileDescWebPage = class(TFileDescPascalUnitWithResource) … … 27 25 function CreateStartFiles(AProject: TLazProject): TModalResult; override; 28 26 end; 29 30 27 31 28 resourcestring … … 158 155 end; 159 156 160 161 157 end. 162 158 -
trunk/Packages/CoolWeb/Modules/UPageList.pas
r84 r137 1 1 unit UPageList; 2 3 {$mode delphi}4 2 5 3 interface -
trunk/Packages/CoolWeb/Modules/UWebUser.pas
r132 r137 1 1 unit UWebUser; 2 3 {$mode Delphi}{$H+}4 2 5 3 interface … … 48 46 end; 49 47 48 50 49 implementation 51 50 -
trunk/Packages/CoolWeb/Network/UTCPServer.pas
r114 r137 1 1 unit UTCPServer; 2 3 {$mode Delphi}{$H+}4 2 5 3 interface … … 68 66 write FOnClientConnect; 69 67 end; 68 70 69 71 70 implementation -
trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas
r103 r137 1 1 unit USqlDatabase; 2 2 3 {$mode Delphi}{$H+} 4 5 // Modified: 2010-12-24 3 // Modified: 2022-09-08 6 4 7 5 interface 8 6 9 7 uses 10 SysUtils, Classes, Dialogs, mysql50, TypInfo, 11 Specialized Dictionary, SpecializedList;8 SysUtils, Classes, Dialogs, mysql50, TypInfo, SpecializedDictionary, 9 SpecializedList; 12 10 13 11 type … … 61 59 procedure CreateColumn(Table, ColumnName: string; ColumnType: TTypeKind); 62 60 procedure Query(DbRows: TDbRows; Data: string); 63 procedure Select(DbRows: TDbRows; ATable: string; Filter: string = '*'; Condition: string = '1'); 64 procedure Delete(ATable: string; Condition: string = '1'; 61 procedure Select(DbRows: TDbRows; ATable: string; Filter: string = '*'; 62 Condition: string = ''); 63 procedure Delete(ATable: string; Condition: string = ''; 65 64 Schema: string = ''); 66 65 procedure Insert(ATable: string; Data: TDictionaryStringString; 67 66 Schema: string = ''); 68 67 procedure Update(ATable: string; Data: TDictionaryStringString; 69 Condition: string = ' 1'; Schema: string = '');68 Condition: string = ''; Schema: string = ''); 70 69 procedure Replace(ATable: string; Data: TDictionaryStringString; 71 70 Schema: string = ''); … … 100 99 101 100 uses 102 DateUtils , Math;101 DateUtils; 103 102 104 103 resourcestring … … 184 183 Rows: TDbRows; 185 184 begin 186 // mySQLClient1.Connect;187 185 FSession := mysql_init(FSession); 188 // FSession.charset := 'latin2';189 186 NewSession := mysql_real_connect(FSession, PChar(HostName), PChar(UserName), 190 187 PChar(Password), PChar(Database), FPort, nil, CLIENT_LONG_PASSWORD + CLIENT_CONNECT_WITH_DB); … … 250 247 251 248 DbResult := mysql_store_result(FSession); 252 if Assigned(DbResult) then begin 253 DbRows.Count := mysql_num_rows(DbResult); 254 for I := 0 to DbRows.Count - 1 do begin 255 DbRow := mysql_fetch_row(DbResult); 256 DbRows[I] := TDictionaryStringString.Create; 257 with DbRows[I] do begin 258 for II := 0 to mysql_num_fields(DbResult) - 1 do begin 259 Add(mysql_fetch_field_direct(DbResult, II)^.Name, 260 PChar((DbRow + II)^)); 249 try 250 if Assigned(DbResult) then begin 251 DbRows.Count := mysql_num_rows(DbResult); 252 for I := 0 to DbRows.Count - 1 do begin 253 DbRow := mysql_fetch_row(DbResult); 254 DbRows[I] := TDictionaryStringString.Create; 255 with DbRows[I] do begin 256 for II := 0 to mysql_num_fields(DbResult) - 1 do begin 257 Add(mysql_fetch_field_direct(DbResult, II)^.Name, 258 PChar((DbRow + II)^)); 261 259 end; 262 260 end; 263 261 end; 264 end; 265 mysql_free_result(DbResult); 262 end; 263 finally 264 mysql_free_result(DbResult); 265 end; 266 266 end; 267 267 … … 296 296 end; 297 297 298 procedure TSqlDatabase.Select(DbRows: TDbRows; ATable: string; Filter: string = '*'; Condition: string = '1'); 298 procedure TSqlDatabase.Select(DbRows: TDbRows; ATable: string; Filter: string = '*'; Condition: string = ''); 299 var 300 QueryText: string; 299 301 begin 300 302 LastUsedTable := ATable; 301 Query(DbRows, 'SELECT ' + Filter + ' FROM `' + ATable + '` WHERE ' + Condition); 303 QueryText := 'SELECT ' + Filter + ' FROM `' + ATable + '`'; 304 if Condition <> '' then QueryText := QueryText + ' WHERE ' + Condition; 305 Query(DbRows, QueryText); 302 306 end; 303 307 304 308 procedure TSqlDatabase.Update(ATable: string; Data: TDictionaryStringString; 305 Condition: string = '1'; Schema: string = ''); 306 var 309 Condition: string = ''; Schema: string = ''); 310 var 311 QueryText: string; 307 312 DbValues: string; 308 313 Value: string; … … 322 327 DbResult := TDbRows.Create; 323 328 if Schema <> '' then Schema := '`' + Schema + '`.'; 324 Query(DbResult, 'UPDATE ' + Schema + '`' + ATable + '` SET ' + DbValues + ' WHERE ' + Condition); 329 QueryText := 'UPDATE ' + Schema + '`' + ATable + '` SET ' + DbValues; 330 if Condition <> '' then QueryText := QueryText + ' WHERE ' + Condition; 331 Query(DbResult, QueryText); 325 332 finally 326 333 DbResult.Free; … … 333 340 end; 334 341 335 procedure TSqlDatabase.Delete(ATable: string; Condition: string = ' 1';342 procedure TSqlDatabase.Delete(ATable: string; Condition: string = ''; 336 343 Schema: string = ''); 337 344 var 345 QueryText: string; 338 346 DbResult: TDbRows; 339 347 begin … … 342 350 DbResult := TDbRows.Create; 343 351 if Schema <> '' then Schema := '`' + Schema + '`.'; 344 Query(DbResult, 'DELETE FROM ' + Schema + '`' + ATable + '` WHERE ' + Condition); 352 QueryText := 'DELETE FROM ' + Schema + '`' + ATable + '`'; 353 if Condition <> '' then QueryText := QueryText + ' WHERE ' + Condition; 354 Query(DbResult, QueryText); 345 355 finally 346 356 DbResult.Free; … … 497 507 end. 498 508 499 -
trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas
r130 r137 1 1 unit UHTTPServer; 2 3 {$mode Delphi}{$H+}4 2 5 3 interface … … 419 417 procedure THTTPSessionStorage.Load(HandlerData: THTTPHandlerData); 420 418 begin 421 422 419 end; 423 420 424 421 procedure THTTPSessionStorage.Save(HandlerData: THTTPHandlerData); 425 422 begin 426 427 423 end; 428 424 -
trunk/Packages/CoolWeb/WebServer/UHTTPServerCGI.pas
r100 r137 1 1 unit UHTTPServerCGI; 2 3 {$mode delphi}{$H+}4 2 5 3 interface … … 21 19 end; 22 20 21 procedure Register; 23 22 24 procedure Register;25 23 26 24 implementation … … 33 31 RegisterComponents('CoolWeb', [THTTPServerCGI]); 34 32 end; 35 36 33 37 34 { THTTPServerCGI } … … 46 43 begin 47 44 EnvVars.Free; 48 inherited Destroy;45 inherited; 49 46 end; 50 47 -
trunk/Packages/CoolWeb/WebServer/UHTTPServerTCP.pas
r130 r137 1 1 unit UHTTPServerTCP; 2 3 {$mode delphi}4 2 5 3 interface … … 141 139 end; 142 140 143 144 141 { THTTPServerTCP } 145 142 -
trunk/Packages/CoolWeb/WebServer/UHTTPServerTurboPower.pas
r84 r137 1 1 unit UHTTPServerTurboPower; 2 3 {$mode delphi}{$H+}4 2 5 3 interface … … 32 30 end; 33 31 34 35 32 { THTTPServerTurboPower } 36 33 … … 62 59 destructor THTTPServerTurboPower.Destroy; 63 60 begin 64 inherited Destroy;61 inherited; 65 62 end; 66 63 -
trunk/Packages/CoolWeb/WebServer/UHTTPSessionFile.pas
r114 r137 1 1 unit UHTTPSessionFile; 2 3 {$mode Delphi}{$H+}4 2 5 3 interface … … 36 34 procedure Register; 37 35 36 38 37 implementation 39 38 … … 45 44 RegisterComponents('CoolWeb', [THTTPSessionStorageFile]); 46 45 end; 47 48 46 49 47 { THTTPSession } … … 119 117 Sessions.Destroy; 120 118 Lock.Destroy; 121 inherited Destroy;119 inherited; 122 120 end; 123 121 -
trunk/Packages/CoolWeb/WebServer/UHTTPSessionMySQL.pas
r100 r137 1 1 unit UHTTPSessionMySQL; 2 3 {$mode Delphi}{$H+}4 2 5 3 interface … … 37 35 procedure Register; 38 36 37 39 38 implementation 40 39 … … 43 42 RegisterComponents('CoolWeb', [THTTPSessionStorageMySQL]); 44 43 end; 45 46 44 47 45 { THTTPSession } … … 138 136 Sessions.Free; 139 137 Lock.Free; 140 inherited Destroy;138 inherited; 141 139 end; 142 140 -
trunk/Packages/CoolWeb/WebServer/UTurboPowerForm.pas
r84 r137 1 1 unit UTurboPowerForm; 2 3 {$mode delphi}4 2 5 3 interface … … 35 33 FormWebBrowser: TFormWebBrowser; 36 34 35 37 36 implementation 38 37 … … 51 50 end; 52 51 53 initialization54 55 52 end. 56 53 -
trunk/Packages/CoolWeb/WebServer/UWebApp.pas
r132 r137 1 1 unit UWebApp; 2 2 3 {$mode Delphi}{$H+}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UWebPage, UHTTPSessionFile, 9 UHTTPServer, Forms, FileUtil, fgl;6 Classes, SysUtils, UWebPage, UHTTPSessionFile, UHTTPServer, Forms, FileUtil, 7 Generics.Collections; 10 8 11 9 type … … 22 20 { TPageList } 23 21 24 TPageList = class(T FPGObjectList<TRegistredPage>)22 TPageList = class(TObjectList<TRegistredPage>) 25 23 RootDir: string; 26 24 function FindByPage(Page: TWebPage): TRegistredPage; … … 221 219 end; 222 220 223 224 initialization225 226 finalization227 228 221 end. 229 222 -
trunk/Packages/CoolWeb/WebServer/UWebPage.pas
r84 r137 1 1 unit UWebPage; 2 3 {$mode objfpc}{$H+}4 2 5 3 interface … … 11 9 TOnProduceEvent = procedure(HandlerData: THTTPHandlerData) of object; 12 10 13 14 11 { TWebPage } 15 12 … … 18 15 FCaption: string; 19 16 FOnProduce: TOnProduceEvent; 17 FRaw: Boolean; 20 18 published 19 property Raw: Boolean read FRaw write FRaw; 21 20 property Caption: string read FCaption write FCaption; 22 21 property OnProduce: TOnProduceEvent read FOnProduce write FOnProduce; 23 22 end; 24 25 23 26 24 TWebPageClass = class of TWebPage;
Note:
See TracChangeset
for help on using the changeset viewer.