Request Quote

Using Transactions In Joomla to maintaining ACID Property

Using Transactions In Joomla to maintaining ACID Property: A transaction is a very small unit of a program and it may contain several lowlevel tasks. A transaction in a database system must maintain Atomicity, Consistency, Isolation, and Durability − commonly known as ACID properties − in order to ensure accuracy, completeness, and data integrity.

Atomicity :

A transaction must be an atomic unit of work; either all of its data modifications are performed, or none of them is performed.

Consistency :

When completed, a transaction must leave all data in a consistent state. In a relational database, all rules must be applied to the transaction’s modifications to maintain all data integrity. All internal data structures, such as B-tree indexes or doubly-linked lists, must be correct at the end of the transaction.

Isolation :

Modifications made by concurrent transactions must be isolated from the modifications made by any other concurrent transactions. A transaction either recognizes data in the state it was in before another concurrent transaction modified it, or it recognizes the data after the second transaction has completed, but it does not recognize an intermediate state.

Durability :

After a transaction has completed, its effects are permanently in place in the system. The modifications persist even in the event of a system failure.


This will play an important role where we have to perform operations on more than one table at a time.

eg: we have 4 separate Insert query for 4 different tables and we want that if any one of query fails, then all query must be rollback. i.e. either all 4 query execute successfully or none of them.

 * Webkul Software.
 * @category Webkul
 * @author Webkul <>
 * @copyright Copyright (c) 2010-2018 Webkul Software Private Limited
 * @license
 //to get instance of JDatabaseDriver class
 try {
  //Method to initialize a transaction
  //initialize JDatabaseQuery object for query
  $values = array($db->quote('VALUE_1'),
  $result = $db->execute();
  //It is used to commit Transaction. 
 catch (Exception $e) {
  // catch any database errors.
  //It is used to rollback Transactions if query fails.


  • transactionStart:  Method to initialize a transaction.

Definition : transactionStart(boolean $asSavepoint = false) : void

  • transactionCommit: Method to commit a transaction.

Definition :transactionCommit(boolean $toSavepoint = false) : void

  • transactionRollback: Method to roll back a transaction.

Definition :transactionRollback(boolean $toSavepoint = false) : void




For any query regarding Joomla virtuemart Extensions and add-ons you can communicate with us at:

Please visit this link to find more extensions of joomla Webkul Joomla extensions


. . .


Add Your Comment

Be the first to comment.