"TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/adodb/adodb/drivers/adodb-mysqlt.inc.php Source File", "datetime" => "Sat Dec 2 19:22:26 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>
00001 <?php 00002 00003 /* 00004 V4.90 8 June 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 /* set transaction mode 00034 00035 SET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL 00036 { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } 00037 00038 */ 00039 function SetTransactionMode( $transaction_mode ) 00040 { 00041 $this->_transmode = $transaction_mode; 00042 if (empty($transaction_mode)) { 00043 $this->Execute('SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ'); 00044 return; 00045 } 00046 if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode; 00047 $this->Execute("SET SESSION TRANSACTION ".$transaction_mode); 00048 } 00049 00050 function BeginTrans() 00051 { 00052 if ($this->transOff) return true; 00053 $this->transCnt += 1; 00054 $this->Execute('SET AUTOCOMMIT=0'); 00055 $this->Execute('BEGIN'); 00056 return true; 00057 } 00058 00059 function CommitTrans($ok=true) 00060 { 00061 if ($this->transOff) return true; 00062 if (!$ok) return $this->RollbackTrans(); 00063 00064 if ($this->transCnt) $this->transCnt -= 1; 00065 $this->Execute('COMMIT'); 00066 $this->Execute('SET AUTOCOMMIT=1'); 00067 return true; 00068 } 00069 00070 function RollbackTrans() 00071 { 00072 if ($this->transOff) return true; 00073 if ($this->transCnt) $this->transCnt -= 1; 00074 $this->Execute('ROLLBACK'); 00075 $this->Execute('SET AUTOCOMMIT=1'); 00076 return true; 00077 } 00078 00079 function RowLock($tables,$where='',$flds='1 as adodb_ignore') 00080 { 00081 if ($this->transCnt==0) $this->BeginTrans(); 00082 if ($where) $where = ' where '.$where; 00083 $rs =& $this->Execute("select $flds from $tables $where for update"); 00084 return !empty($rs); 00085 } 00086 00087 } 00088 00089 class ADORecordSet_mysqlt extends ADORecordSet_mysql{ 00090 var $databaseType = "mysqlt"; 00091 00092 function ADORecordSet_mysqlt($queryID,$mode=false) 00093 { 00094 if ($mode === false) { 00095 global $ADODB_FETCH_MODE; 00096 $mode = $ADODB_FETCH_MODE; 00097 } 00098 00099 switch ($mode) 00100 { 00101 case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break; 00102 case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break; 00103 00104 case ADODB_FETCH_DEFAULT: 00105 case ADODB_FETCH_BOTH: 00106 default: $this->fetchMode = MYSQL_BOTH; break; 00107 } 00108 00109 $this->adodbFetchMode = $mode; 00110 $this->ADORecordSet($queryID); 00111 } 00112 00113 function MoveNext() 00114 { 00115 if (@$this->fields = mysql_fetch_array($this->_queryID,$this->fetchMode)) { 00116 $this->_currentRow += 1; 00117 return true; 00118 } 00119 if (!$this->EOF) { 00120 $this->_currentRow += 1; 00121 $this->EOF = true; 00122 } 00123 return false; 00124 } 00125 } 00126 00127 class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt { 00128 00129 function ADORecordSet_ext_mysqlt($queryID,$mode=false) 00130 { 00131 if ($mode === false) { 00132 global $ADODB_FETCH_MODE; 00133 $mode = $ADODB_FETCH_MODE; 00134 } 00135 switch ($mode) 00136 { 00137 case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break; 00138 case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break; 00139 00140 case ADODB_FETCH_DEFAULT: 00141 case ADODB_FETCH_BOTH: 00142 default: 00143 $this->fetchMode = MYSQL_BOTH; break; 00144 } 00145 $this->adodbFetchMode = $mode; 00146 $this->ADORecordSet($queryID); 00147 } 00148 00149 function MoveNext() 00150 { 00151 return adodb_movenext($this); 00152 } 00153 } 00154 00155 ?>