]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/adodb/drivers/adodb-mysqlt.inc.php
locking table specific for better databases
[SourceForge/phpwiki.git] / lib / WikiDB / adodb / drivers / adodb-mysqlt.inc.php
1 <?php
2
3 /*
4 V4.22 15 Apr 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). 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.
9   
10   MySQL code that supports transactions. For MySQL 3.23 or later.
11   Code from James Poon <jpoon88@yahoo.com>
12   
13   Requires mysql client. Works on Windows and Unix.
14 */
15
16
17 include_once(ADODB_DIR."/drivers/adodb-mysql.inc.php");
18
19
20 class ADODB_mysqlt extends ADODB_mysql {
21         var $databaseType = 'mysqlt';
22         var $ansiOuter = true; // for Version 3.23.17 or later
23         var $hasTransactions = true;
24         
25         function BeginTrans()
26         {         
27                 if ($this->transOff) return true;
28                 $this->transCnt += 1;
29                 $this->Execute('SET AUTOCOMMIT=0');
30                 $this->Execute('BEGIN');
31                 return true;
32         }
33         
34         function CommitTrans($ok=true) 
35         {
36                 if ($this->transOff) return true; 
37                 if (!$ok) return $this->RollbackTrans();
38                 
39                 if ($this->transCnt) $this->transCnt -= 1;
40                 $this->Execute('COMMIT');
41                 $this->Execute('SET AUTOCOMMIT=1');
42                 return true;
43         }
44         
45         function RollbackTrans()
46         {
47                 if ($this->transOff) return true;
48                 if ($this->transCnt) $this->transCnt -= 1;
49                 $this->Execute('ROLLBACK');
50                 $this->Execute('SET AUTOCOMMIT=1');
51                 return true;
52         }
53         
54 }
55
56 class ADORecordSet_mysqlt extends ADORecordSet_mysql{   
57         var $databaseType = "mysqlt";
58         
59         function ADORecordSet_mysqlt($queryID,$mode=false) {
60                 return $this->ADORecordSet_mysql($queryID,$mode);
61         }
62         
63         function MoveNext() 
64         {       
65                 if ($this->EOF) return false;
66
67                 $this->_currentRow++;
68                 // using & below slows things down by 20%!
69                 $this->fields =  @mysql_fetch_array($this->_queryID,$this->fetchMode);
70                 if ($this->fields) return true;
71                 $this->EOF = true;
72                 
73                 return false;
74         }       
75 }
76 ?>