Support new security model in the formSubmit function - bug fix
[openemr.git] / library / adodb / drivers / adodb-mysqlpo.inc.php
blob5327834b390e18247d6e83a053d8b5fcd6f5e50d
1 <?php
3 /*
4 V5.14 8 Sept 2011 (c) 2000-2011 John Lim (jlim#natsoft.com). All rights reserved.
5 Released under both BSD license and Lesser GPL library license.
6 Whenever there is any discrepancy between the two licenses,
7 the BSD license will take precedence.
8 Set tabs to 8.
10 MySQL code that supports transactions. For MySQL 3.23 or later.
11 Code from James Poon <jpoon88@yahoo.com>
13 Requires mysql client. Works on Windows and Unix.
16 // security - hide paths
17 if (!defined('ADODB_DIR')) die();
19 include_once(ADODB_DIR."/drivers/adodb-mysql.inc.php");
22 class ADODB_mysqlt extends ADODB_mysql {
23 var $databaseType = 'mysqlt';
24 var $ansiOuter = true; // for Version 3.23.17 or later
25 var $hasTransactions = true;
26 var $autoRollback = true; // apparently mysql does not autorollback properly
28 function ADODB_mysqlt()
30 global $ADODB_EXTENSION; if ($ADODB_EXTENSION) $this->rsPrefix .= 'ext_';
33 function BeginTrans()
35 if ($this->transOff) return true;
36 $this->transCnt += 1;
37 $this->Execute('SET AUTOCOMMIT=0');
38 $this->Execute('BEGIN');
39 return true;
42 function CommitTrans($ok=true)
44 if ($this->transOff) return true;
45 if (!$ok) return $this->RollbackTrans();
47 if ($this->transCnt) $this->transCnt -= 1;
48 $this->Execute('COMMIT');
49 $this->Execute('SET AUTOCOMMIT=1');
50 return true;
53 function RollbackTrans()
55 if ($this->transOff) return true;
56 if ($this->transCnt) $this->transCnt -= 1;
57 $this->Execute('ROLLBACK');
58 $this->Execute('SET AUTOCOMMIT=1');
59 return true;
62 function RowLock($tables,$where='',$col='1 as adodbignore')
64 if ($this->transCnt==0) $this->BeginTrans();
65 if ($where) $where = ' where '.$where;
66 $rs = $this->Execute("select $col from $tables $where for update");
67 return !empty($rs);
72 class ADORecordSet_mysqlt extends ADORecordSet_mysql{
73 var $databaseType = "mysqlt";
75 function ADORecordSet_mysqlt($queryID,$mode=false)
77 if ($mode === false) {
78 global $ADODB_FETCH_MODE;
79 $mode = $ADODB_FETCH_MODE;
82 switch ($mode)
84 case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
85 case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
87 case ADODB_FETCH_DEFAULT:
88 case ADODB_FETCH_BOTH:
89 default: $this->fetchMode = MYSQL_BOTH; break;
92 $this->adodbFetchMode = $mode;
93 $this->ADORecordSet($queryID);
96 function MoveNext()
98 if (@$this->fields = mysql_fetch_array($this->_queryID,$this->fetchMode)) {
99 $this->_currentRow += 1;
100 return true;
102 if (!$this->EOF) {
103 $this->_currentRow += 1;
104 $this->EOF = true;
106 return false;
110 class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt {
112 function ADORecordSet_ext_mysqlt($queryID,$mode=false)
114 if ($mode === false) {
115 global $ADODB_FETCH_MODE;
116 $mode = $ADODB_FETCH_MODE;
118 switch ($mode)
120 case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
121 case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
123 case ADODB_FETCH_DEFAULT:
124 case ADODB_FETCH_BOTH:
125 default:
126 $this->fetchMode = MYSQL_BOTH; break;
128 $this->adodbFetchMode = $mode;
129 $this->ADORecordSet($queryID);
132 function MoveNext()
134 return adodb_movenext($this);