From 6854cb3f4d8219cf1829e32122eb2502a916eae9 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 1 Feb 2020 09:05:48 +0100 Subject: initial checkin --- .../adodb/adodb-php/drivers/adodb-mysqlt.inc.php | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 vendor/adodb/adodb-php/drivers/adodb-mysqlt.inc.php (limited to 'vendor/adodb/adodb-php/drivers/adodb-mysqlt.inc.php') diff --git a/vendor/adodb/adodb-php/drivers/adodb-mysqlt.inc.php b/vendor/adodb/adodb-php/drivers/adodb-mysqlt.inc.php new file mode 100644 index 0000000..0e31926 --- /dev/null +++ b/vendor/adodb/adodb-php/drivers/adodb-mysqlt.inc.php @@ -0,0 +1,137 @@ +rsPrefix .= 'ext_'; + } + + /* set transaction mode + + SET [GLOBAL | SESSION] TRANSACTION ISOLATION LEVEL +{ READ UNCOMMITTED | READ COMMITTED | REPEATABLE READ | SERIALIZABLE } + + */ + function SetTransactionMode( $transaction_mode ) + { + $this->_transmode = $transaction_mode; + if (empty($transaction_mode)) { + $this->Execute('SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ'); + return; + } + if (!stristr($transaction_mode,'isolation')) $transaction_mode = 'ISOLATION LEVEL '.$transaction_mode; + $this->Execute("SET SESSION TRANSACTION ".$transaction_mode); + } + + function BeginTrans() + { + if ($this->transOff) return true; + $this->transCnt += 1; + $this->Execute('SET AUTOCOMMIT=0'); + $this->Execute('BEGIN'); + return true; + } + + function CommitTrans($ok=true) + { + if ($this->transOff) return true; + if (!$ok) return $this->RollbackTrans(); + + if ($this->transCnt) $this->transCnt -= 1; + $ok = $this->Execute('COMMIT'); + $this->Execute('SET AUTOCOMMIT=1'); + return $ok ? true : false; + } + + function RollbackTrans() + { + if ($this->transOff) return true; + if ($this->transCnt) $this->transCnt -= 1; + $ok = $this->Execute('ROLLBACK'); + $this->Execute('SET AUTOCOMMIT=1'); + return $ok ? true : false; + } + + function RowLock($tables,$where='',$col='1 as adodbignore') + { + if ($this->transCnt==0) $this->BeginTrans(); + if ($where) $where = ' where '.$where; + $rs = $this->Execute("select $col from $tables $where for update"); + return !empty($rs); + } + +} + +class ADORecordSet_mysqlt extends ADORecordSet_mysql{ + var $databaseType = "mysqlt"; + + function __construct($queryID,$mode=false) + { + if ($mode === false) { + global $ADODB_FETCH_MODE; + $mode = $ADODB_FETCH_MODE; + } + + switch ($mode) + { + case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break; + case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break; + + case ADODB_FETCH_DEFAULT: + case ADODB_FETCH_BOTH: + default: $this->fetchMode = MYSQL_BOTH; break; + } + + $this->adodbFetchMode = $mode; + parent::__construct($queryID); + } + + function MoveNext() + { + if (@$this->fields = mysql_fetch_array($this->_queryID,$this->fetchMode)) { + $this->_currentRow += 1; + return true; + } + if (!$this->EOF) { + $this->_currentRow += 1; + $this->EOF = true; + } + return false; + } +} + +class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt { + + function MoveNext() + { + return adodb_movenext($this); + } +} -- cgit v1.2.3-70-g09d2