Bonjour !!
je viens d'ajouter un code a mon application pour pouvoir remplir ma base Sqlite3 depuis un fichier texte (1500 ligne max ) le code marche mais ça prend un temps fou des minutes 3 a 4 min
alors que sur une base BDE ça ne prend que max 3 ou 4 seconds
j'ai fait plusieurs recherche je ne comprend toujours pas ou est le problème

quelqu’un a une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
procedure TForm1.Button1Click(Sender: TObject);
 var Softcam: textfile;
     Softcam_Line:string;
     System1,provider1,index1,key1:string;
     H:integer;
begin
With ZConnection1 do
begin
////vider la table pour un nouveau chargement
 Database :=(IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleAbsolutePath))+'NW_keys.db');
 ExecuteDirect('DELETE from tblSystems');
 Ztable1.Refresh;
end;
 
assignfile(Softcam,(IncludeTrailingPathDelimiter(ExtractFileDir(GetModuleAbsolutePath)))+'Softcam.key');
reset(Softcam);
 
while not eof(Softcam) do
begin
H:=0;
   readln(Softcam,Softcam_Line);
 
    if (((copy(Softcam_Line,1,1))=('I')) or ((copy(Softcam_Line,1,1))=('S')) or
    ((copy(Softcam_Line,1,1))=('N')) or ((copy(Softcam_Line,1,1))=('W')) or
    ((copy(Softcam_Line,1,1))=('F')) or ((copy(Softcam_Line,1,1))=('V')))
    And ((copy(Softcam_Line,2,1))=(' '))
 
    then
        begin
             System1:=copy(Softcam_Line,1,1);
             if (copy(Softcam_Line,7,1)=' ') and (copy(Softcam_Line,10,1)=' ') then
             begin
                 Provider1:=copy(Softcam_Line,3,4);
                 index1:=copy(Softcam_Line,8,2);
                  while (copy(Softcam_Line,H+11,1)<>' ') and (copy(Softcam_Line,H+11,1)<>';') and (copy(Softcam_Line,H+11,1)<>'') do
                  H:=H+1;
                  key1:=copy(Softcam_Line,11,H);
 
                  ZTable1.Open;
                  ZTable1.First;
                  ZTable1.Append;
                  // ajouter les données
                  ZTable1.FieldByName('Name').Value := System1;
                  ZTable1.FieldByName('ProviderID').Value := provider1;
                  ZTable1.FieldByName('KeyIndex').Value := index1;
                  ZTable1.FieldByName('Key').Value := key1;
                  ZTable1.FieldByName('Comments').Value := DateTimeToStr(now);
                  // Valider
                  ZTable1.Post;
                  ZTable1.Close;
             end else
                 if (copy(Softcam_Line,9,1)=' ') and (copy(Softcam_Line,12,1)=' ') then
                 begin
                 Provider1:=copy(Softcam_Line,3,6);
                 index1:=copy(Softcam_Line,10,2);
                  while (copy(Softcam_Line,H+13,1)<>' ') and (copy(Softcam_Line,H+13,1)<>';') and (copy(Softcam_Line,H+13,1)<>'') do
                  H:=H+1;
                  key1:=copy(Softcam_Line,13,H);
 
                  ZTable1.Open;
                  ZTable1.First;
                  ZTable1.Append;
                  // ajouter les données
                  ZTable1.FieldByName('Name').Value := System1;
                  ZTable1.FieldByName('ProviderID').Value := provider1;
                  ZTable1.FieldByName('KeyIndex').Value := index1;
                  ZTable1.FieldByName('Key').Value := key1;
                  ZTable1.FieldByName('Comments').Value := DateTimeToStr(now);
                  // Valider
                  ZTable1.Post;
                  ZTable1.Close;
             end else
                 if (copy(Softcam_Line,11,1)=' ') and (copy(Softcam_Line,14,1)=' ') then
                 begin
                 Provider1:=copy(Softcam_Line,3,8);
                 index1:=copy(Softcam_Line,12,2);
                  while (copy(Softcam_Line,H+15,1)<>' ') and (copy(Softcam_Line,H+15,1)<>';') and (copy(Softcam_Line,H+15,1)<>'') do
                  H:=H+1;
                  key1:=copy(Softcam_Line,15,H);
 
                  ZTable1.Open;
                  ZTable1.First;
                  ZTable1.Append;
                  // ajouter les données
                  ZTable1.FieldByName('Name').Value := System1;
                  ZTable1.FieldByName('ProviderID').Value := provider1;
                  ZTable1.FieldByName('KeyIndex').Value := index1;
                  ZTable1.FieldByName('Key').Value := key1;
                  ZTable1.FieldByName('Comments').Value := DateTimeToStr(now);
                  // Valider
                  ZTable1.Post;
                  ZTable1.Close;
              end;
 
/////////////////
        end;
end;
 
 
MessageBox(Handle,'File Imported succefly ?',
 '',MB_OK ) ;
 
closefile(Softcam);
end;