[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/adodb_lite/adodbSQL_drivers/mysql/ -> mysql_transaction_module.inc (source)

   1  <?php
   2  /**

   3   * ADOdb Lite Transaction Module for Mysql

   4   * 

   5   */
   6  
   7  eval('class mysql_transaction_EXTENDER extends '. $last_module . '_ADOConnection { }');
   8  
   9  class mysql_transaction_ADOConnection extends mysql_transaction_EXTENDER
  10  {
  11      var $autoCommit = true;
  12      var $transOff = 0;
  13      var $transCnt = 0;
  14      var $transaction_status = true;
  15  
  16  	function StartTrans($errfn = 'ADODB_TransMonitor')
  17      {
  18          if ($this->transOff > 0) {
  19              $this->transOff += 1;
  20              return;
  21          }
  22  
  23          $this->transaction_status = true;
  24  
  25          if ($this->debug && $this->transCnt > 0)
  26              ADOConnection::outp("Bad Transaction: StartTrans called within BeginTrans");
  27  
  28          $this->BeginTrans();
  29          $this->transOff = 1;
  30      }
  31  
  32  	function BeginTrans()
  33      {
  34          return false;
  35      }
  36  
  37  	function CompleteTrans($autoComplete = true)
  38      {
  39          if ($this->transOff > 1) {
  40              $this->transOff -= 1;
  41              return true;
  42          }
  43  
  44          $this->transOff = 0;
  45          if ($this->transaction_status && $autoComplete) {
  46              if (!$this->CommitTrans()) {
  47                  $this->transaction_status = false;
  48                  if ($this->debug)
  49                      ADOConnection::outp("Smart Commit failed");
  50              } else
  51                  if ($this->debug)
  52                      ADOConnection::outp("Smart Commit occurred");
  53          } else {
  54              $this->transaction_status = false;
  55              $this->RollbackTrans();
  56              if ($this->debug)
  57                  ADOCOnnection::outp("Smart Rollback occurred");
  58          }
  59  
  60          return $this->transaction_status;
  61      }
  62  
  63  	function CommitTrans($ok=true) 
  64      {
  65          return true;
  66      }
  67  
  68  	function RollbackTrans() 
  69      {
  70          return false;
  71      }
  72  
  73  	function FailTrans()
  74      {
  75          if ($this->debug) 
  76              if ($this->transOff == 0) {
  77                  ADOConnection::outp("FailTrans outside StartTrans/CompleteTrans");
  78              } else {
  79                  ADOConnection::outp("FailTrans was called");
  80              }
  81          $this->transaction_status = false;
  82      }
  83  
  84  	function HasFailedTrans()
  85      {
  86          if ($this->transOff > 0)
  87              return $this->transaction_status == false;
  88  
  89          return false;
  90      }
  91  
  92  	function RowLock($table,$where)
  93      {
  94          return false;
  95      }
  96  
  97  	function CommitLock($table)
  98      {
  99          return $this->CommitTrans();
 100      }
 101  
 102  	function RollbackLock($table)
 103      {
 104          return $this->RollbackTrans();
 105      }
 106  }
 107  
 108  eval('class mysql_transaction_resultset_EXTENDER extends '. $last_module . '_ResultSet { }');
 109  
 110  class mysql_transaction_ResultSet extends mysql_transaction_resultset_EXTENDER
 111  {
 112  }
 113  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7