Kreiranje se odrati OK.
SQL-ovi su u file-u: Baza.sql
Htio bih povezati ProgressBar sa izvršavanjem SQL scripti. Na web-u nisam našao ništa što bi pomoglo.
pokušao sam:
Code:
FDScript1.ExecuteFile('Baza.sql');
FDScript1.ExecuteFile('Baza.sql');
program kreira sve objekte u bazi...
Dodao sam proceduru OnProgress
- variable:
Code:
FDScript1.Position.X;
FDScript1.Position.y;
FDScript1.Position.X;
FDScript1.Position.y;
su uvijek 0.
Pokušao sam razbucati sql u više scritpi i dodati ih posebno u
FDScript1.SQLScripts
nije pomoglo. Ovo je kod:
Code:
tl.LoadFromFile(ExtractFilePath(Application.ExeName) + 'baza.sql');
ts := FDScript1.SQLScripts.Add;
while i < tl.Count do begin
if tl.Strings[i] = '/*TAG*/' then begin
inc(i);
with FDScript1.SQLScripts do begin
with Add do begin
inc(uks);
Name := 'script' + uks.ToString;
while (i < tl.Count) and (tl.Strings[i] <> '/*TAG*/') do begin
sql.Add(tl.Strings[i]);
inc(i);
end;
end;
end;
end else Inc(i);
end;
tl.Free;
ts.Name := 'root';
for i := 1 to uks do begin
ts.SQL.Add('@script' + i.ToString);
end;
tl.LoadFromFile(ExtractFilePath(Application.ExeName) + 'baza.sql');
ts := FDScript1.SQLScripts.Add;
while i < tl.Count do begin
if tl.Strings[i] = '/*TAG*/' then begin
inc(i);
with FDScript1.SQLScripts do begin
with Add do begin
inc(uks);
Name := 'script' + uks.ToString;
while (i < tl.Count) and (tl.Strings[i] <> '/*TAG*/') do begin
sql.Add(tl.Strings[i]);
inc(i);
end;
end;
end;
end else Inc(i);
end;
tl.Free;
ts.Name := 'root';
for i := 1 to uks do begin
ts.SQL.Add('@script' + i.ToString);
end;
Ima tko ideju kako:
1. dobiti ukupan broj scripti koje će se izvršiti (create table, create index, ....)?
2. kako u OnProgress dobiti trenutno aktivni index skripte koji se izvršava?