ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:transactions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
v5:userguide:transactions [2016/04/14 15:29]
mnewnham
v5:userguide:transactions [2018/07/01 23:02] (current)
peterdd prefer functions start lowercase (#430)
Line 79: Line 79:
 [[v5:​reference:​connection:​transCnt|Checking Transaction Status]]\\ [[v5:​reference:​connection:​transCnt|Checking Transaction Status]]\\
 </​WRAP>​ </​WRAP>​
-Smart Transactions are much easier to use in large procedures because you do not have to track the error status. You start a smart transaction by calling ​StartTrans():+Smart Transactions are much easier to use in large procedures because you do not have to track the error status. You start a smart transaction by calling ​startTrans():
  
 <code php> <code php>
Line 90: Line 90:
 * Execute some SQL * Execute some SQL
 */ */
-$conn->Execute($sql);+$conn->execute($sql);
  
 /* /*
 * Execute some more SQL * Execute some more SQL
 */ */
-$conn->Execute($sql2);+$conn->execute($sql2);
  
 /* /*
Line 113: Line 113:
 $conn->​execute($sql);​ $conn->​execute($sql);​
  
-if (!CheckRecords()) +if (!checkRecords()) 
     $conn->​failTrans();​     $conn->​failTrans();​
  
Line 120: Line 120:
 * it will also be rolled back * it will also be rolled back
 */ */
-$conn->Execute($sql2);+$conn->execute($sql2);
  
-$conn->CompleteTrans();+$conn->completeTrans();
 </​code>​ </​code>​
  
Line 129: Line 129:
   * There was an error in the SQL execution. This execution comprises all scenarios where the SQL statement was successfully issued, but failed to complete. This does not include scenarios where the construction of the statement failed, and an error occurred that was trapped by PHP error handling.   * There was an error in the SQL execution. This execution comprises all scenarios where the SQL statement was successfully issued, but failed to complete. This does not include scenarios where the construction of the statement failed, and an error occurred that was trapped by PHP error handling.
  
-Make sure you call ''​hasFailedTrans()''​ before you call ''​completeTrans()'',​ as it is only works between ​StartTrans/CompleteTrans.+Make sure you call ''​hasFailedTrans()''​ before you call ''​completeTrans()'',​ as it is only works between ​startTrans/completeTrans.
  
  
Line 148: Line 148:
 */ */
 $conn->​startTrans();​ $conn->​startTrans();​
-if (!CheckRecords()) +if (!checkRecords()) 
     /*     /*
     * This is applied to the outer block     * This is applied to the outer block
v5/userguide/transactions.txt · Last modified: 2018/07/01 23:02 by peterdd