You are not logged in.
Pages: 1
@ab,
In situations like in a loop, can `ISQLDBStatement` be reused? Or do I have to get a new instance via `NewThreadSafeStatementPrepared` before calling `Bind*` and `Step` in the loop?
By 'in a loop' I mean something like following:
var
stmt: ISQLDBStatement;
begin
stmt := FDatabase.NewThreadSafeStatementPrepared('update...', False);
for i := 0 to 10 do
begin
stmt.Bind(0, i);
stmt.Step;
stmt.Reset; // possible?
end;
end;
Does mORMot has a something like Reset method for ISQLDBStatement? Or do I have to call `NewThreadSafeStatementPrepared` to get a new instance in the for loop?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Update 1: I just checked `TSQLDBConnection.NewThreadSafeStatementPrepared`, it seems that caching of the statement objects are already taking into account, so calling NewThreadSafeStatementPrepared is already very optimal, no need of things like `Reset` as I suggested in the OP?
Last edited by edwinsn (2022-11-20 03:27:23)
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Pages: 1