Hello
I'm calling
TD.TransactionID := 1;
TD.IsolationLevel := xilREADCOMMITTED;
SqlConnection.StartTransaction(TD);
against MSSQL 2000 with dbxsda driver, but in Profiler nothing happens after that call. The old BDE TDatabase.StartTransaction call works as expected.
OS: Windows XP Pro
Delphi: 7.0 with service pack (build 8.1)
Thanks in advance,
Marcos
SQLConnection.StartTransaction does nothing
Re: SQLConnection.StartTransaction does nothing
It is an optimization from OLE DB side. Actually a transaction is started on
executing the first query in this connection.
executing the first query in this connection.
There's no workaround? I need to manually start a transaction in several places. What's happening is that every call to applyupdates in my transaction is generating its own begin trans and commit, thus the operation isn't atomic anymore...
It's the expected behavior of cds.ApplyUpdates, but only when there's not another transaction opened.
It's the expected behavior of cds.ApplyUpdates, but only when there's not another transaction opened.
This optimization doesn't influence on essence of the transaction. All queries
between StartTransaction and Commit will be within the same context.
For example, for the next code
before execution of SQLConnection.Commit(TD) data from ClientDataSet will not be committed.
between StartTransaction and Commit will be within the same context.
For example, for the next code
Code: Select all
TD.TransactionID := 1;
TD.IsolationLevel := xilREADCOMMITTED;
SQLConnection.StartTransaction(TD);
ClientDataSet.ApplyUpdates(0);
SQLQuery1.SQL.Text := 'update "SDAC_BLOB" set "Name" = ''ssss'' where UID =111';
SQLQuery1.ExecSQL();
SQLConnection.Commit(TD);