]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/adodb/drivers/adodb-mysqlt.inc.php
new ADODB library 4.22 with multiple drivers (not only mysql as before), major change...
[SourceForge/phpwiki.git] / lib / WikiDB / adodb / drivers / adodb-mysqlt.inc.php
1 <?php\r
2 \r
3 /*\r
4 V4.22 15 Apr 2004  (c) 2000-2004 John Lim (jlim@natsoft.com.my). All rights reserved.\r
5   Released under both BSD license and Lesser GPL library license. \r
6   Whenever there is any discrepancy between the two licenses, \r
7   the BSD license will take precedence.\r
8   Set tabs to 8.\r
9   \r
10   MySQL code that supports transactions. For MySQL 3.23 or later.\r
11   Code from James Poon <jpoon88@yahoo.com>\r
12   \r
13   Requires mysql client. Works on Windows and Unix.\r
14 */\r
15 \r
16 \r
17 include_once(ADODB_DIR."/drivers/adodb-mysql.inc.php");\r
18 \r
19 \r
20 class ADODB_mysqlt extends ADODB_mysql {\r
21         var $databaseType = 'mysqlt';\r
22         var $ansiOuter = true; // for Version 3.23.17 or later\r
23         var $hasTransactions = true;\r
24         \r
25         function BeginTrans()\r
26         {         \r
27                 if ($this->transOff) return true;\r
28                 $this->transCnt += 1;\r
29                 $this->Execute('SET AUTOCOMMIT=0');\r
30                 $this->Execute('BEGIN');\r
31                 return true;\r
32         }\r
33         \r
34         function CommitTrans($ok=true) \r
35         {\r
36                 if ($this->transOff) return true; \r
37                 if (!$ok) return $this->RollbackTrans();\r
38                 \r
39                 if ($this->transCnt) $this->transCnt -= 1;\r
40                 $this->Execute('COMMIT');\r
41                 $this->Execute('SET AUTOCOMMIT=1');\r
42                 return true;\r
43         }\r
44         \r
45         function RollbackTrans()\r
46         {\r
47                 if ($this->transOff) return true;\r
48                 if ($this->transCnt) $this->transCnt -= 1;\r
49                 $this->Execute('ROLLBACK');\r
50                 $this->Execute('SET AUTOCOMMIT=1');\r
51                 return true;\r
52         }\r
53         \r
54 }\r
55 \r
56 class ADORecordSet_mysqlt extends ADORecordSet_mysql{   \r
57         var $databaseType = "mysqlt";\r
58         \r
59         function ADORecordSet_mysqlt($queryID,$mode=false) {\r
60                 return $this->ADORecordSet_mysql($queryID,$mode);\r
61         }\r
62         \r
63         function MoveNext() \r
64         {       \r
65                 if ($this->EOF) return false;\r
66 \r
67                 $this->_currentRow++;\r
68                 // using & below slows things down by 20%!\r
69                 $this->fields =  @mysql_fetch_array($this->_queryID,$this->fetchMode);\r
70                 if ($this->fields) return true;\r
71                 $this->EOF = true;\r
72                 \r
73                 return false;\r
74         }       \r
75 }\r
76 ?>