Documentation TYPO3 par Ameos

adodb-mysqlt.inc.php

00001 <?php
00002 
00003 /*
00004 V4.80 8 Mar 2006  (c) 2000-2006 John Lim (jlim@natsoft.com.my). All rights reserved.
00005   Released under both BSD license and Lesser GPL library license. 
00006   Whenever there is any discrepancy between the two licenses, 
00007   the BSD license will take precedence.
00008   Set tabs to 8.
00009   
00010   MySQL code that supports transactions. For MySQL 3.23 or later.
00011   Code from James Poon <jpoon88@yahoo.com>
00012   
00013   Requires mysql client. Works on Windows and Unix.
00014 */
00015 
00016 // security - hide paths
00017 if (!defined('ADODB_DIR')) die();
00018 
00019 include_once(ADODB_DIR."/drivers/adodb-mysql.inc.php");
00020 
00021 
00022 class ADODB_mysqlt extends ADODB_mysql {
00023         var $databaseType = 'mysqlt';
00024         var $ansiOuter = true; // for Version 3.23.17 or later
00025         var $hasTransactions = true;
00026         var $autoRollback = true; // apparently mysql does not autorollback properly 
00027         
00028         function ADODB_mysqlt() 
00029         {                       
00030         global $ADODB_EXTENSION; if ($ADODB_EXTENSION) $this->rsPrefix .= 'ext_';
00031         }
00032         
00033         function BeginTrans()
00034         {         
00035                 if ($this->transOff) return true;
00036                 $this->transCnt += 1;
00037                 $this->Execute('SET AUTOCOMMIT=0');
00038                 $this->Execute('BEGIN');
00039                 return true;
00040         }
00041         
00042         function CommitTrans($ok=true) 
00043         {
00044                 if ($this->transOff) return true; 
00045                 if (!$ok) return $this->RollbackTrans();
00046                 
00047                 if ($this->transCnt) $this->transCnt -= 1;
00048                 $this->Execute('COMMIT');
00049                 $this->Execute('SET AUTOCOMMIT=1');
00050                 return true;
00051         }
00052         
00053         function RollbackTrans()
00054         {
00055                 if ($this->transOff) return true;
00056                 if ($this->transCnt) $this->transCnt -= 1;
00057                 $this->Execute('ROLLBACK');
00058                 $this->Execute('SET AUTOCOMMIT=1');
00059                 return true;
00060         }
00061         
00062         function RowLock($tables,$where='',$flds='1 as adodb_ignore') 
00063         {
00064                 if ($this->transCnt==0) $this->BeginTrans();
00065                 if ($where) $where = ' where '.$where;
00066                 $rs =& $this->Execute("select $flds from $tables $where for update");
00067                 return !empty($rs); 
00068         }
00069         
00070 }
00071 
00072 class ADORecordSet_mysqlt extends ADORecordSet_mysql{   
00073         var $databaseType = "mysqlt";
00074         
00075         function ADORecordSet_mysqlt($queryID,$mode=false) 
00076         {
00077                 if ($mode === false) { 
00078                         global $ADODB_FETCH_MODE;
00079                         $mode = $ADODB_FETCH_MODE;
00080                 }
00081                 
00082                 switch ($mode)
00083                 {
00084                 case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
00085                 case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
00086                 
00087                 case ADODB_FETCH_DEFAULT:
00088                 case ADODB_FETCH_BOTH:
00089                 default: $this->fetchMode = MYSQL_BOTH; break;
00090                 }
00091         
00092                 $this->adodbFetchMode = $mode;
00093                 $this->ADORecordSet($queryID);  
00094         }
00095         
00096         function MoveNext()
00097         {
00098                 if (@$this->fields = mysql_fetch_array($this->_queryID,$this->fetchMode)) {
00099                         $this->_currentRow += 1;
00100                         return true;
00101                 }
00102                 if (!$this->EOF) {
00103                         $this->_currentRow += 1;
00104                         $this->EOF = true;
00105                 }
00106                 return false;
00107         }
00108 }
00109 
00110 class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt {     
00111 
00112         function ADORecordSet_ext_mysqlt($queryID,$mode=false) 
00113         {
00114                 if ($mode === false) { 
00115                         global $ADODB_FETCH_MODE;
00116                         $mode = $ADODB_FETCH_MODE;
00117                 }
00118                 switch ($mode)
00119                 {
00120                 case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
00121                 case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
00122                 
00123                 case ADODB_FETCH_DEFAULT:
00124                 case ADODB_FETCH_BOTH:
00125                 default: 
00126                         $this->fetchMode = MYSQL_BOTH; break;
00127                 }
00128                 $this->adodbFetchMode = $mode;
00129                 $this->ADORecordSet($queryID);  
00130         }
00131         
00132         function MoveNext()
00133         {
00134                 return adodb_movenext($this);
00135         }
00136 }
00137 
00138 ?>


Généré par Les experts TYPO3 avec  doxygen 1.4.6