3 * MySQL driver in transactional mode
7 * This driver only supports the original MySQL driver in transactional mode. It
8 * is deprecated in PHP version 5.5 and removed in PHP version 7. It is deprecated
9 * as of ADOdb version 5.20.0. Use the mysqli driver instead, which supports both
10 * transactional and non-transactional updates
12 * This file is part of ADOdb, a Database Abstraction Layer library for PHP.
15 * @link https://adodb.org Project's web site and documentation
16 * @link https://github.com/ADOdb/ADOdb Source code and issue tracker
18 * The ADOdb Library is dual-licensed, released under both the BSD 3-Clause
19 * and the GNU Lesser General Public Licence (LGPL) v2.1 or, at your option,
20 * any later version. This means you can use it in proprietary products.
21 * See the LICENSE.md file distributed with this source code for details.
22 * @license BSD-3-Clause
23 * @license LGPL-2.1-or-later
25 * @copyright 2000-2013 John Lim
26 * @copyright 2014 Damien Regad, Mark Newnham and the ADOdb community
29 // security - hide paths
30 if (!defined('ADODB_DIR')) die();
32 include_once(ADODB_DIR
."/drivers/adodb-mysql.inc.php");
35 class ADODB_mysqlt
extends ADODB_mysql
{
36 var $databaseType = 'mysqlt';
37 var $ansiOuter = true; // for Version 3.23.17 or later
38 var $hasTransactions = true;
39 var $autoRollback = true; // apparently mysql does not autorollback properly
41 /* set transaction mode
43 SET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL
44 { READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE }
47 function SetTransactionMode( $transaction_mode )
49 $this->_transmode
= $transaction_mode;
50 if (empty($transaction_mode)) {
51 $this->Execute('SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ');
54 if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode;
55 $this->Execute("SET SESSION TRANSACTION ".$transaction_mode);
60 if ($this->transOff
) return true;
62 $this->Execute('SET AUTOCOMMIT=0');
63 $this->Execute('BEGIN');
67 function CommitTrans($ok=true)
69 if ($this->transOff
) return true;
70 if (!$ok) return $this->RollbackTrans();
72 if ($this->transCnt
) $this->transCnt
-= 1;
73 $ok = $this->Execute('COMMIT');
74 $this->Execute('SET AUTOCOMMIT=1');
75 return $ok ?
true : false;
78 function RollbackTrans()
80 if ($this->transOff
) return true;
81 if ($this->transCnt
) $this->transCnt
-= 1;
82 $ok = $this->Execute('ROLLBACK');
83 $this->Execute('SET AUTOCOMMIT=1');
84 return $ok ?
true : false;
87 function RowLock($tables,$where='',$col='1 as adodbignore')
89 if ($this->transCnt
==0) $this->BeginTrans();
90 if ($where) $where = ' where '.$where;
91 $rs = $this->Execute("select $col from $tables $where for update");
97 class ADORecordSet_mysqlt
extends ADORecordSet_mysql
{
98 var $databaseType = "mysqlt";
100 function __construct($queryID,$mode=false)
102 if ($mode === false) {
103 global $ADODB_FETCH_MODE;
104 $mode = $ADODB_FETCH_MODE;
109 case ADODB_FETCH_NUM
: $this->fetchMode
= MYSQL_NUM
; break;
110 case ADODB_FETCH_ASSOC
:$this->fetchMode
= MYSQL_ASSOC
; break;
112 case ADODB_FETCH_DEFAULT
:
113 case ADODB_FETCH_BOTH
:
114 default: $this->fetchMode
= MYSQL_BOTH
; break;
117 $this->adodbFetchMode
= $mode;
118 parent
::__construct($queryID);
123 if (@$this->fields
= mysql_fetch_array($this->_queryID
,$this->fetchMode
)) {
124 $this->_currentRow +
= 1;
128 $this->_currentRow +
= 1;
135 class ADORecordSet_ext_mysqlt
extends ADORecordSet_mysqlt
{
139 return adodb_movenext($this);