procedure TCustomSQLQuery.Prepare does not work
Original Reporter info from Mantis: klemmo
-
Reporter name: Holger Klemt
Original Reporter info from Mantis: klemmo
- Reporter name: Holger Klemt
Description:
at least on Firebird, a prepared query saves a lot of time when the same sql text is executed with changed parameters multiple times.
Calling prepare and unprepare does not work as expected, since anytime a query is closed, an unprepare is done.
Steps to reproduce:
see attached example, i added sqldb.pas and ibconnection.pas in the directory to make debugging, test changes and breakpoints easier to be set.
in the example the statement id is taken from mon$statements, if prepapre works fine, there should be not 100 as a result, 1 (or 2 incl first stement) would be the expected result.
Additional information:
this procedure in sqldb seems to not recognize the correct info if manual prepare was called an always initiates unprepare, visible also in fb25/fb30 in traceapi .
procedure TCustomSQLQuery.SetActive(Value: Boolean);
begin
inherited SetActive(Value);
// The query is UnPrepared, so that if a transaction closes all datasets
// they also get unprepared
if not Value and IsPrepared then UnPrepare;
end;
Mantis conversion info:
- Mantis ID: 31231
- Platform: Windows
- Fixed in version: 3.3.1
- Target version: 4.0.0
- FPCTarget: 3.2.2