Using Local Transactions

From RAD Studio
Jump to: navigation, search

Go Up to Using transactions with the BDE Index

Attention: The Borland Database Engine (BDE) has been deprecated, so it will not be enhanced. For instance, BDE will never have Unicode support. You should not undertake new development with BDE. Consider migrating your existing database applications from BDE to dbExpress.

The BDE supports local transactions against Paradox, dBASE, Access, and FoxPro tables. From a coding perspective, there is no difference to you between a local transaction and a transaction against a remote database server.

Note: When using transactions with local Paradox, dBASE, Access, and FoxPro tables, set TransIsolation to tiDirtyRead instead of using the default value of tiReadCommitted. A BDE error is returned if TransIsolation is set to anything but tiDirtyRead for local tables.

When a transaction is started against a local table, updates performed against the table are logged. Each log record contains the old record buffer for a record. When a transaction is active, records that are updated are locked until the transaction is committed or rolled back. On rollback, old record buffers are applied against updated records to restore them to their pre-update states.

Local transactions are more limited than transactions against SQL servers or ODBC drivers. In particular, the following limitations apply to local transactions:

  • Automatic crash recovery is not provided.
  • Data definition statements are not supported.
  • Transactions cannot be run against temporary tables.
  • TransIsolation level must only be set to tiDirtyRead.
  • For Paradox, local transactions can only be performed on tables with valid indexes. Data cannot be rolled back on Paradox tables that do not have indexes.
  • Only a limited number of records can be locked and modified. With Paradox tables, you are limited to 255 records. With dBASE, the limit is 100.
  • Transactions cannot be run against the BDE ASCII driver.
  • Closing a cursor on a table during a transaction rolls back the transaction unless:
    • Several tables are open.
    • The cursor is closed on a table to which no changes were made.

See Also