[fpc-pascal] Using sqldb/firebird
Luiz Americo
pascalive at bol.com.br
Tue Jan 31 00:29:31 CET 2006
> You can execute only 1 statement at a time in SQLDB.
>
> So you should change:
>
> for i:= 0 to 100 do //if i comment this line it works
> Sql.Add('insert into test (AInt, AFloat, AStr) values ('+IntToStr(i)+', 2.1 , ''AText'');');
>
> to
> with FDataSet do
> begin
> Database:=FConnection;
> Transaction:=FTransaction;
> ParseSQL:=True;
> ReadOnly:=False;
> FTransaction.StartTransaction;
> for i:= 0 to 100 do //if i comment this line it works
> begin
> Sql.Text:='insert into test (AInt, AFloat, AStr) values ('+IntToStr(i)+', 2.1 , ''AText'')';
> ExecSql;
> end;
> FTransaction.Commit;
> end;
>
> I use a similar routine to execute 600.000 statements and it definitely works OK :-)
>
> Michael.
Thank you. It works.
Luiz
More information about the fpc-pascal
mailing list