TdwsSynDBDataBase and StartTransaction's bug
Issue #102
resolved
There is a bug in the "TdwsSynDBDataBase" class within the "dwsSynDBDatabase" unit and specifically in the implementation of the "BeginTransaction" method. In fact, the current code of the method is as follows:
Procedures TdwsSynDBDataBase.BeginTransaction;
Begin
FConn.StartTransaction;
End;
But in my opinion the implementation should be as follows:
Procedures TdwsSynDBDataBase.BeginTransaction;
Begin
If not FConn.IsConnected then
FConn.Connect;
FConn.StartTransaction;
End;
This is to prevent a script from failing in a script when it invokes the "BeginTransaction" method before executing any other query, as it is highlighted in the following sample script:
Var Database: = DataBase.Create ('OleDB MSSQL', ['HOST \ SQLEXPRESS', 'DatabaseTest']);
Database.BeginTransaction;
Var Query: = Database.Query ('select * from table');
// ... some write field operations on Query ...
Database.Commit;
Without the proposed correction, when the script arrives to execute the "BeginTransaction" statement, it has a malfunction because the connection to the DB has not been executed yet.
Comments (2)
-
Account Deleted reporter -
repo owner - changed status to resolved
Fixed Issue
#102→ <<cset 8a67a0d38111>>
- Log in to comment
Or better: