Opened 13 years ago

Closed 13 years ago

#3745 closed enhancement (fixed)

Add transaction support to the CPL ODBC layer

Reported by: tamas Owned by: tamas
Priority: normal Milestone: 1.8.0
Component: default Version: unspecified
Severity: normal Keywords: odbc


This patch would include transaction support to the current ODBC implementation in GDAL. Transactions in ODBC are managed at the connection level. When an application completes a transaction, it commits or rolls back all work completed through all statement handles on that connection. To commit or roll back a transaction, applications should call SQLEndTran instead of submitting a COMMIT or ROLLBACK statement directly in order to let ODBC the driver manage the transaction state correctly. An application calls SQLSetConnectAttr to switch between the two ODBC modes of managing transactions: the Autocommit mode (the default) and Manual Commit mode.

The suggested implementation would provide the following approach in order to keep this option as simple as possible:

  1. The connection operates in autocommit mode by default, which preserves the compatibility with the existing applications
  1. Application (ie. an OGR driver) should call CPLODBCSession:BeginTransaction to begin a transaction scope. This function switch the transaction to manual commit mode.
  1. Application should call CPLODBCSession:CommitTransaction to commit the changes made since the BeginTransaction has been called.
  1. CPLODBCSession:RollbackTransaction is implemented, but it may not necessarily be called since it is called automatically if there was a failure within a transaction.
  1. The connection is switched back to autocommit mode if a sql operation is called outside of the scope of a transaction.

Attachments (1)

cpl_odbc.patch (6.2 KB ) - added by tamas 13 years ago.

Download all attachments as: .zip

Change History (4)

by tamas, 13 years ago

Attachment: cpl_odbc.patch added

comment:1 by warmerdam, 13 years ago

Keywords: odbc added


It looks good to me. I think you should go ahead and commit it.

comment:2 by tamas, 13 years ago

Added in r20569

comment:3 by Even Rouault, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.