-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappdbfolder.pas
More file actions
648 lines (527 loc) · 20.7 KB
/
appdbfolder.pas
File metadata and controls
648 lines (527 loc) · 20.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
unit AppDbFolder;
{$mode ObjFPC}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Windows, Dialogs, StdCtrls,
ExtCtrls, ComCtrls, typinfo,
AppDb, appdbFQ, Visual;
type
{ TFolder }
TFolder = class(TAppDatabase)
private
FFPguid : String;
FUnsavedFolder : Boolean;
procedure SetFolderStatusInArray;
procedure InsertFolder(ObjectGuid : String);
procedure UpdateFolder(ObjectGuid : String);
procedure DeleteFolder(ObjectGuid : String);
procedure DeleteFolderFromSettingsTbl;
// Read data into Treeview
procedure ReadFolderList(var fd : AllApiObjectData);
procedure ReadQueryList(var fd : AllApiObjectData); // !!!
procedure PopulateTreeView();
protected
public
constructor Create; overload;
destructor Destroy; override;
function PrepareNewFolder(FolderName : String): PtrApiObject;
procedure MarkFolderForDeletion;
procedure SaveFolders;
property FolderParentGuid : string Read FFPguid Write FFPguid;
property UnsavedFolders : Boolean read FUnsavedFolder Write FUnsavedFolder;
// Read data into Treeview
procedure GetFoldersAndQueries(aTrv : TTreeView);
published
end;
var
FolderList : array of ApiObjectData;
FoldersToSearch : array of ApiObjectData;
ParentNodes : Array of TTreeNode;
ChildNodes : Array of ApiObjectData;
fd: AllApiObjectData;
Trv : TTreeView;
TrvVisual : TVisual;
implementation
uses Form_Main, DataModule, Db, Encryption;
{ TFolder }
{%region constructor - destructor}
constructor TFolder.Create;
begin
inherited;
TrvVisual := TVisual.Create;
end;
destructor TFolder.Destroy;
begin
if assigned(TrvVisual) then TrvVisual.Free;
inherited Destroy;
end;
{%endregion constructor - destructor}
function TFolder.PrepareNewFolder(FolderName: String): PtrApiObject;
var
NewFolder : PtrApiObject;
Counter : Integer;
begin
new(NewFolder);
NewFolder^.Name := FolderName;
NewFolder^.Guid := TGUID.NewGuid.ToString();
NewFolder^.ObjectType := appdbFQ.Folder;
NewFolder^.ParentFolder := FolderParentGuid;
NewFolder^.Action := 'Insert'; // overbodig
UnsavedFolders := true;
// Add the new folder tot the FolderList
Counter := Length(FolderList)+1;
SetLength(FolderList, Counter); // Create or expand the Folderlist (array).
FolderList[Counter-1].Name := NewFolder^.Name;
FolderList[Counter-1].Guid := NewFolder^.Guid;
FolderList[Counter-1].ParentFolder := FolderParentGuid;
FolderList[Counter-1].ObjectType := appdbFQ.Folder;
FolderList[Counter-1].Action := 'Insert';
FolderList[Counter-1].CreatedBy := SysUtils.GetEnvironmentVariable('USERNAME');
FolderList[Counter-1].Date_Created := Now; //FormatDateTime('DD MM YYYY hh:mm:ss', Now); ;
result := NewFolder;
end;
procedure TFolder.MarkFolderForDeletion;
begin
SetFolderStatusInArray;
end;
procedure TFolder.SetFolderStatusInArray;
var
i, j : Integer;
Counter : Integer;
begin
if Length(FolderList) > 0 then begin
if Length(FoldersToSearch) > 0 then begin
for i := 0 to length(FoldersToSearch) -1 do begin
for j:= 0 to Length(FolderList) -1 do begin
if (FoldersToSearch[i].Guid = FolderList[j].Guid) and (FolderList[j].Guid <> '') then begin
FolderList[j].Name := FoldersToSearch[i].Name; // Just for debugging
FolderList[j].Action := 'Delete';
UnsavedFolders := True;
FrmMain.Logging.WriteToLogInfo('Set Folder status (mark for deletion) : ' + FolderList[j].Guid + ' - '+ FolderList[j].Name);
{ #todo : Test of Break; uit de eerste for loop springt }
end;
end;
end;
end;
end;
if Length(FoldersToSearch) > 0 then begin // Folderlist is empty but FoldersToSearch is not empty (Delete after saved)
Counter := Length(FolderList)+1;
for i := 0 to length(FoldersToSearch) -1 do begin
if FoldersToSearch[i].Guid <> '' then begin
SetLength(FolderList, Counter);
FolderList[Counter-1].Guid := FoldersToSearch[i].Guid;
FolderList[Counter-1].Name := FoldersToSearch[i].Name; // just for debugging
FolderList[Counter-1].Action := 'Delete';
UnsavedFolders := True;
FrmMain.Logging.WriteToLogInfo('Set Folder status (mark for deletion) : ' + FolderList[Counter-1].Guid + ' - '+ FolderList[Counter-1].Name);
Counter += 1;
end;
end;
end;
end;
procedure TFolder.SaveFolders;
var
i : integer;
begin
if Length(FolderList) > 0 then begin
for i := 0 to Length(FolderList) -1 do begin
if FolderList[i].Action = 'Insert' then begin
FrmMain.Logging.WriteToLogInfo('Insert nieuwe Folder.');
InsertFolder(FolderList[i].Guid);
end
else if FolderList[i].Action = 'Update' then begin
FrmMain.Logging.WriteToLogInfo('Update folder.');
UpdateFolder(FolderList[i].Guid);
end
else if FolderList[i].Action = 'Delete' then begin
FrmMain.Logging.WriteToLogInfo('Delete Folder.');
DeleteFolder(FolderList[i].Guid);
end;
end;
end;
DeleteFolderFromSettingsTbl; // Delete folder from the SETTINGS_APP table.
end;
procedure TFolder.InsertFolder(ObjectGuid : String);
var
SqlText : String;
i : Integer;
FName : String;
begin
SqlText := 'insert into ' + FOLDER_LIST + ' (GUID, NAME, OBJECTTYPE, PARENT_FOLDER, DATE_CREATED, CREATED_BY) ' +
'select :GUID, :NAME, :OBJECTTYPE, :PARENT_FOLDER, :DATE_CREATED, :CREATED_BY ' +
'where not exists (select GUID from ' + FOLDER_LIST + ' where GUID = :GUID);';
try
With DataModule1 do begin
SQLQuery.Close;
SQLite3Connection.Close();
SQLite3Connection.DatabaseName := dbFile;
SQLQuery.SQL.Text := SqlText;
for i := 0 to Length(FolderList)-1 do begin
if ObjectGuid = FolderList[i].Guid then begin
SQLQuery.Params.ParamByName('GUID').AsString := ObjectGuid;
SQLQuery.Params.ParamByName('NAME').AsString := FolderList[i].Name;
SQLQuery.Params.ParamByName('OBJECTTYPE').AsString := FolderList[i].ObjectType;
SQLQuery.Params.ParamByName('PARENT_FOLDER').AsString := FolderList[i].ParentFolder;
SQLQuery.Params.ParamByName('DATE_CREATED').AsString := FormatDateTime('DD MM YYYY hh:mm:ss', FolderList[i].Date_Created);
SQLQuery.Params.ParamByName('CREATED_BY').AsString := FolderList[i].CreatedBy;
FName := FolderList[i].Name;
Break;
end;
end;
SQLite3Connection.Open;
SQLTransaction.Active:=True;
SQLQuery.ExecSQL;
SQLTransaction.Commit;
SQLite3Connection.Close();
FrmMain.Logging.WriteToLogInfo('Folder ' + FName + ' is toegevoegd aan tabel '+ FOLDER_LIST + '.');
end;
except
on E: EDatabaseError do
begin
FrmMain.Logging.WriteToLogInfo('Het invoeren van een nieuwe folder in de tabel ' + FOLDER_LIST + ' is mislukt.');
FrmMain.Logging.WriteToLogError('Melding:');
FrmMain.Logging.WriteToLogError(E.Message);
messageDlg('Fout.', 'Het opslaan van de ' + FName + ' is mislukt.', mtError, [mbOK],0);
end;
end;
end;
procedure TFolder.UpdateFolder(ObjectGuid : String);
var
SqlText : String;
i : Integer;
FName : String;
begin
SqlText := 'update ' + FOLDER_LIST + ' ' +
'set NAME = :NAME, '+
'PARENT_FOLDER = :PARENT_FOLDER, ' +
'ALTERED_BY = :ALTERED_BY, ' +
'DATE_ALTERED = :DATE_ALTERED ' +
'where GUID = :GUID;';
try
With DataModule1 do begin
SQLQuery.Close;
SQLite3Connection.Close();
SQLite3Connection.DatabaseName := dbFile;
SQLQuery.SQL.Text := SqlText;
for i := 0 to Length(FolderList)-1 do begin
if ObjectGuid = FolderList[i].Guid then begin
SQLQuery.Params.ParamByName('GUID').AsString := ObjectGuid;
SQLQuery.Params.ParamByName('NAME').AsString := FolderList[i].Name;
SQLQuery.Params.ParamByName('PARENT_FOLDER').AsString := FolderList[i].ParentFolder;
SQLQuery.Params.ParamByName('ALTERED_BY').AsString := FolderList[i].ModifiedBy;
SQLQuery.Params.ParamByName('DATE_ALTERED').AsString := FormatDateTime('DD MM YYYY hh:mm:ss', FolderList[i].Date_Modified);
FName := FolderList[i].Name;
Break;
end;
end;
SQLite3Connection.Open;
SQLTransaction.Active:=True;
SQLQuery.ExecSQL;
SQLTransaction.Commit;
SQLite3Connection.Close();
FrmMain.Logging.WriteToLogInfo('De folder ' + FName + ' is bijgewerkt (Tabel ' + FOLDER_LIST + '.');
end;
except
on E: EDatabaseError do
begin
FrmMain.Logging.WriteToLogInfo('Het bijwerken van de tabel ' + FOLDER_LIST + ' is mislukt.');
FrmMain.Logging.WriteToLogError('Melding:');
FrmMain.Logging.WriteToLogError(E.Message);
messageDlg('Fout.', 'Het bijwerken van de tabel ' + FOLDER_LIST + ' is mislukt. Betreft Folder ' +FName+ '.', mtError, [mbOK],0);
end;
end;
end;
procedure TFolder.DeleteFolder(ObjectGuid : String);
var
SqlText : String;
i : Integer;
FName : String;
begin
SqlText := 'delete from ' + FOLDER_LIST +
' where PARENT_FOLDER = :PARENT_FOLDER;';
With DataModule1 do begin
try
SQLQuery.Close;
SQLite3Connection.Close();
SQLite3Connection.DatabaseName := dbFile;
SQLQuery.SQL.Text := SqlText;
for i := 0 to Length(FolderList)-1 do begin
if ObjectGuid = FolderList[i].Guid then begin
SQLQuery.Params.ParamByName('PARENT_FOLDER').AsString := FolderList[i].Guid;
FName := FolderList[i].Name;
Break;
end;
end;
SQLite3Connection.Open;
SQLTransaction.Active:=True;
SQLQuery.ExecSQL;
SQLTransaction.Commit;
SQLite3Connection.Close();
SqlText := 'delete from ' + FOLDER_LIST +
' where GUID = :GUID;';
SQLQuery.Close;
SQLQuery.SQL.Text := SqlText;
for i := 0 to Length(FolderList)-1 do begin
if ObjectGuid = FolderList[i].Guid then begin
SQLQuery.Params.ParamByName('GUID').AsString := FolderList[i].Guid;
FName := FolderList[i].Name;
Break;
end;
end;
SQLite3Connection.Open;
SQLTransaction.Active:=True;
SQLQuery.ExecSQL;
SQLTransaction.Commit;
SQLite3Connection.Close();
FrmMain.Logging.WriteToLogInfo('Folder ' + FName + ' is verwijderd uit de tabel ' + FOLDER_LIST + '.');
except
on E : Exception do begin
FrmMain.Logging.WriteToLogError('Fout bij het verwijderen van een Folder.');
FrmMain.Logging.WriteToLogError('Melding:');
FrmMain.Logging.WriteToLogError(E.Message);
messageDlg('Fout.', 'Fout bij het verwijderen van een Folder.', mtError, [mbOK],0);
end;
end;
end;
end;
procedure TFolder.DeleteFolderFromSettingsTbl;
var
SqlText : String;
begin
SqlText := 'delete from ' + SETTINGS_APP +
' where GUID_NODE not in (select guid from ' + FOLDER_LIST + ');';
With DataModule1 do begin
try
SQLQuery.Close;
SQLite3Connection.Close();
SQLite3Connection.DatabaseName := dbFile;
SQLQuery.SQL.Text := SqlText;
SQLite3Connection.Open;
SQLTransaction.Active:=True;
SQLQuery.ExecSQL;
SQLTransaction.Commit;
SQLite3Connection.Close();
except
on E : Exception do begin
FrmMain.Logging.WriteToLogError('Fout bij het verwijderen van een Folder uit ' + SETTINGS_APP);
FrmMain.Logging.WriteToLogError('Melding:');
FrmMain.Logging.WriteToLogError(E.Message);
messageDlg('Fout.', 'Fout bij het verwijderen van een Folder uit de tabel ' + SETTINGS_APP, mtError, [mbOK],0);
end;
end;
end;
end;
{Read Data into Treeview-------------------------------------------------------}
procedure TFolder.GetFoldersAndQueries(aTrv: TTreeView);
begin
Screen.Cursor := crHourGlass;
aTrv.BeginUpdate;
ReadFolderList(fd); // add Folder data to array
ReadQueryList(fd); // add Query data to array
Trv := aTrv;
Trv.Items.Clear;
PopulateTreeView(); // Read the folders and Queries from the arrays into the TreeView.
aTrv.EndUpdate;
Screen.Cursor := crDefault;
end;
procedure TFolder.PopulateTreeView();
var
i, p, Counter : Integer;
ParentTn : TTreeNode;
aod : PtrApiObject;
begin
if (ParentNodes <> nil) and ( ChildNodes <> nil) then begin // search for ChildNodes in fd[i].ParentFolder
for p := 0 to Length(ParentNodes) do begin
for i:= 0 to Length(fd)-1 do begin
if ChildNodes[p].Guid = fd[i].ParentFolder then begin
Counter := Length(ParentNodes);
New(aod);
aod^.Guid := fd[i].Guid;
aod^.ParentFolder := fd[i].ParentFolder;
aod^.ObjectType := fd[i].ObjectType;
aod^.Name := fd[i].Name;
if fd[i].ObjectType = appdbFQ.Query then begin
aod^.Url := fd[i].Url;
aod^.Token := fd[i].Token;
aod^.Description_short := fd[i].Description_short;
aod^.Description_long := fd[i].Description_long;
aod^.Authentication := fd[i].Authentication;
aod^.AuthenticationUserName := fd[i].AuthenticationUserName;
aod^.AuthenticationPassword := fd[i].AuthenticationPassword;
aod^.Salt := fd[i].Salt;
aod^.Paging_searchtext := fd[i].Paging_searchtext;
aod^.Request_body := fd[i].Request_body;
aod^.HTTP_Methode := fd[i].HTTP_Methode;
end;
ParentTn := Trv.Items.AddChildObject(ParentNodes[p], fd[i].Name, aod);
if fd[i].ObjectType = appdbFQ.Folder then
ParentTn.ImageIndex := 1;
//Add checkbox to child notes
{if fd[i].ObjectType = appdbFQ.Query then begin
TrvVisual.CheckNode(ParentTn, false);
end;}
SetLength(ParentNodes, Counter+1);
ParentNodes[Counter] := ParentTn;
SetLength(ChildNodes, Counter+1);
ChildNodes[Counter].Guid := fd[i].Guid;
end;
end;
delete(ChildNodes, p, 1); //Syntax is Delete(fromArray, Index, NumberOfItems); Index is zero based.
delete(ParentNodes, p, 1);
if (ParentNodes <> nil) and (ChildNodes <> nil) then begin
PopulateTreeView();
end;
if (ParentNodes = nil) and (ChildNodes = nil) then begin
Exit;
end;
end;
end
else begin
Counter := Length(ParentNodes);
for i:= 0 to Length(fd)-1 do begin
if (fd[i].Guid <> '') and (fd[i].ParentFolder = '') then begin // rootnode
New(aod);
aod^.Guid := fd[i].Guid;
aod^.ParentFolder := fd[i].ParentFolder;
aod^.ObjectType := fd[i].ObjectType;
aod^.Name := fd[i].Name;
ParentTn := Trv.Items.AddObject(nil, fd[i].Name, aod);
ParentTn.ImageIndex := 0; // Rootnode image
SetLength(ParentNodes, Counter + 1);
ParentNodes[Counter] := ParentTn;
SetLength(ChildNodes, Counter + 1);
ChildNodes[Counter].Guid := fd[Counter].Guid;
break;
end;
end;
if (ParentTn <> nil) then begin
PopulateTreeView();
end;
end;
end;
procedure TFolder.ReadFolderList(var fd: AllApiObjectData);
var
SqlText : String;
i : Integer;
begin
SqlText := 'Select GUID, PARENT_FOLDER, OBJECTTYPE, NAME ' +
'from ' + FOLDER_LIST;
With DataModule1 do begin
try
SQLQuery.Close;
SQLite3Connection.Close();
SQLite3Connection.DatabaseName := dbFile;
SQLite3Connection.Open;
SQLQuery.SQL.Text := SqlText;
SQLQuery.Open;
SQLQuery.First;
i := 0;
SetLength(fd, SQLQuery.RecordCount);
SQLQuery.PacketRecords := -1;
SQLQuery.First;
while not SQLQuery.Eof do begin
fd[i].Id := i;
fd[i].Name := SQLQuery.FieldByName('NAME').AsString;
fd[i].Guid := SQLQuery.FieldByName('GUID').AsString;
fd[i].ParentFolder := SQLQuery.FieldByName('PARENT_FOLDER').AsString;
fd[i].ObjectType := appdbFQ.Folder;
SQLQuery.next;
i +=1;
end;
SQLQuery.Close;
SQLite3Connection.Close();
except
on E : Exception do begin
FrmMain.Logging.WriteToLogError('Fout bij het lezen van de tabel ' + FOLDER_LIST + '.');
FrmMain.Logging.WriteToLogError('Melding:');
FrmMain.Logging.WriteToLogError(E.Message);
messageDlg('Fout.', 'Fout bij het lezen van de folders.', mtError, [mbOK],0);
end;
end;
end;
end;
procedure TFolder.ReadQueryList(var fd: AllApiObjectData);
var
SqlText : String;
i : Integer;
Encrypt : TEncryptDecrypt;
Salt : String;
begin
SqlText := 'Select GUID, PARENT_FOLDER, OBJECTTYPE, NAME, URL, TOKEN, ' +
'DESCRIPTION_SHORT, DESCRIPTION_LONG, AUTHENTICATION, ' +
'AUTHENTICATION_USER, AUTHENTICATION_PWD, PAGING_SEARCHTEXT, '+
'SALT, REQUEST_BODY, HTTP_METHOD '+
'from ' + QUERY_LIST;
With DataModule1 do begin
try
SQLQuery.Close;
SQLite3Connection.Close();
SQLite3Connection.DatabaseName := dbFile;
SQLite3Connection.Open;
SQLQuery.SQL.Text := SqlText;
SQLQuery.Open;
SQLQuery.First;
i := Length(fd);
if SQLQuery.RecordCount > 0 then begin
SetLength(fd, SQLQuery.RecordCount+i);
SQLQuery.PacketRecords := -1;
SQLQuery.First;
while not SQLQuery.Eof do begin
fd[i].Id := i;
fd[i].Name := SQLQuery.FieldByName('NAME').AsString;
fd[i].Guid := SQLQuery.FieldByName('GUID').AsString;
fd[i].ParentFolder := SQLQuery.FieldByName('PARENT_FOLDER').AsString;
fd[i].ObjectType := appdbFQ.Query;
fd[i].Url := SQLQuery.FieldByName('URL').AsString;
fd[i].Description_short := SQLQuery.FieldByName('DESCRIPTION_SHORT').AsString;
fd[i].Description_long := SQLQuery.FieldByName('DESCRIPTION_LONG').AsString;
fd[i].Authentication := SQLQuery.FieldByName('AUTHENTICATION').AsBoolean;
fd[i].Paging_searchtext := SQLQuery.FieldByName('PAGING_SEARCHTEXT').AsString;
fd[i].Salt := SQLQuery.FieldByName('SALT').AsString;
fd[i].Request_body := SQLQuery.FieldByName('REQUEST_BODY').AsString;
fd[i].HTTP_Methode := SQLQuery.FieldByName('HTTP_METHOD').AsString;
if fd[i].Salt <> '' then begin
Salt := fd[i].Salt;
Encrypt := TEncryptDecrypt.Create(USER_NAMETXT);
if SQLQuery.FieldByName('TOKEN').AsString <> '' then begin
fd[i].Token := Encrypt.Decrypt_String(SQLQuery.FieldByName('TOKEN').AsString, Salt);
end
else begin
fd[i].Token := SQLQuery.FieldByName('TOKEN').AsString;
end;
if SQLQuery.FieldByName('AUTHENTICATION_USER').AsString <> '' then begin
fd[i].AuthenticationUserName := Encrypt.Decrypt_String(SQLQuery.FieldByName('AUTHENTICATION_USER').AsString, Salt);
end
else begin
fd[i].AuthenticationUserName := SQLQuery.FieldByName('AUTHENTICATION_USER').AsString;
end;
if SQLQuery.FieldByName('AUTHENTICATION_PWD').AsString <> '' then begin
fd[i].AuthenticationPassword := Encrypt.Decrypt_String(SQLQuery.FieldByName('AUTHENTICATION_PWD').AsString, Salt);
end
else begin
fd[i].AuthenticationPassword := SQLQuery.FieldByName('AUTHENTICATION_PWD').AsString;
end;
Encrypt.Free;
end
else begin
fd[i].Token := SQLQuery.FieldByName('TOKEN').AsString;
fd[i].AuthenticationUserName := SQLQuery.FieldByName('AUTHENTICATION_USER').AsString;
fd[i].AuthenticationPassword := SQLQuery.FieldByName('AUTHENTICATION_PWD').AsString;
end;
SQLQuery.next;
i += 1;
end;
end;
SQLQuery.Close;
SQLite3Connection.Close();
except
on E : Exception do begin
FrmMain.Logging.WriteToLogError('Fout bij het lezen van de tabel ' + FOLDER_LIST + '.');
FrmMain.Logging.WriteToLogError('Melding:');
FrmMain.Logging.WriteToLogError(E.Message);
messageDlg('Fout.', 'Fout bij het lezen van de folders.', mtError, [mbOK],0);
end;
end;
end;
end;
end.