SqlDb: Calling TSQLQuery.Prepare directly, opening, closing and re opening does not work with IBConnection
Original Reporter info from Mantis: luizamerico
-
Reporter name: Luiz Americo
Original Reporter info from Mantis: luizamerico
- Reporter name: Luiz Americo
Description:
When TSQLQuery.Prepare is called directly, query is open, closed and re opened, it does not work with IBConnection.
This use case is tested in TTestTSQLQuery.TestPrepareCount2 from DBTestFramework
Below is a patch that disposes cursor memory on UnPrepareStatement instead of FreeFldBuffers, making the cursor memory allocation balanced between PrepareStatement and UnPrepareStatement. This fixes the access violation, but now fails with another error:
TIBConnection : Fetch :
-Dynamic SQL Error
-SQL error code = -502
-Attempt to reopen an open cursor
Exception class: EIBDatabaseError
at $006B6208 TIBCONNECTION__CHECKERROR, line 195 of D:/repositories/fpc-playground/packages/fcl-db/src/sqldb/interbase/ibconnection.pp
Mantis conversion info:
- Mantis ID: 37645
- OS: Windows
- OS Build: 10
- Platform: i386
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 47400 (#06f5e293)
- Target version: 3.2.2