KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Transactions in 4D
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: May 9, 2002
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Compatibility: 4D v6.7 and above

Transactions are a series of related data modifications made to a database within a process. A transaction is not saved to a database permanently until the transaction is validated. If a transaction is not completed, either because it is canceled or because of some outside event, the modifications are not saved.

During a transaction, all changes made to the database data within a process are stored locally in a temporary buffer. If the transaction is accepted with VALIDATE TRANSACTION, the changes are saved permanently. If the transaction is canceled with CANCEL TRANSACTION, the changes are not saved.

Since transactions deal with temporary record addresses, after a transaction is validated or canceled, the selection for each table of the current process becomes empty. For this reason, you should be cautious when using named selections inside a transaction. After a transaction is validated or canceled, a named selection created before or during the transaction may contain incorrect record addresses. For example, a named selection may contain the address of a deleted record or the temporary address of a record added during the transaction. This warning also applies to sets, because they are based on bit tables with record addresses.

There is no real limit for the number of records that a transaction can contain. However, the first limit that you may encounter will be a memory issue. 4D will try to keep the transaction into the cache. If the transaction becomes too big, 4D will swap the transaction into a temporary file that 4D will create. This temporary file will be created at its default path, i.e. on the C drive under PC and on the volume with the most available free space under Mac OS, or at the path that you may define from the database properties, in the system settings page.