TMySQL51Connection + TSQLTransaction Operation cannot be performed on an active transaction
Original Reporter info from Mantis: desmondc
-
Reporter name: Desmond C
Original Reporter info from Mantis: desmondc
- Reporter name: Desmond C
Description:
Check "Steps to reproduce" section.
TMySQL51Connection + TSQLTransaction Operation cannot be performed on an active transaction.
Seems that TMySQL51Connection.RollBack function is not populated. The base class function TConnectionName.RollBack is implemented, but no code. Default function result value I assume to be false always.
mysqlconn.inc line 1022:
function TConnectionName.RollBack(trans: TSQLHandle): boolean;
begin
// Do nothing
end;
This results in sqldb line 784:
procedure TSQLTransaction.Rollback;
begin
if active then
begin
closedatasets;
If LogEvent(detRollback) then
Log(detRollback,SRollingBack);
if TSQLConnection(Database).RollBack(FTrans) then
begin
CloseTrans;
FreeAndNil(FTrans);
end;
end;
end;
CloseTrans is never called because RollBack returns false always.
I think modifying base TConnectionName will at least prevent exceptions when destroying transactions, until someone implemented transaction handling in the production class.
mysqlconn.inc line 1022:
function TConnectionName.RollBack(trans: TSQLHandle): boolean;
begin
// Do nothing
Result := True;
end;
Steps to reproduce:
Create TMySQL51Connection, TSQLTransaction & TQuery
Assign TSQLTransaction.DataBase
Assign TSQLQuery.Database & .Transaction
Populate select statement in TSQLQuery.Text
Exec TSQLQuery.Open;
Unassign TSQLQuery.Transaction
Destroy TSQLQuery
Destroy TSQLTransaction - Exception "Operation cannot be performed on an active transaction"
Destroy TMySQL51Connection
Mantis conversion info:
- Mantis ID: 18841
- Build: svn trunk rev 16744
- Version: 2.5.1
- Fixed in version: 3.0.0
- Fixed in revision: 22598 (#d0fbfe45)
- Target version: 2.6.1