]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/WikiDB/adodb/drivers/adodb-mysqlt.inc.php
Reformat code
[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 include_once(ADODB_DIR . "/drivers/adodb-mysql.inc.php");
17
18 class ADODB_mysqlt extends ADODB_mysql
19 {
20     var $databaseType = 'mysqlt';
21     var $ansiOuter = true; // for Version 3.23.17 or later
22     var $hasTransactions = true;
23
24     function BeginTrans()
25     {
26         if ($this->transOff) return true;
27         $this->transCnt += 1;
28         $this->Execute('SET AUTOCOMMIT=0');
29         $this->Execute('BEGIN');
30         return true;
31     }
32
33     function CommitTrans($ok = true)
34     {
35         if ($this->transOff) return true;
36         if (!$ok) return $this->RollbackTrans();
37
38         if ($this->transCnt) $this->transCnt -= 1;
39         $this->Execute('COMMIT');
40         $this->Execute('SET AUTOCOMMIT=1');
41         return true;
42     }
43
44     function RollbackTrans()
45     {
46         if ($this->transOff) return true;
47         if ($this->transCnt) $this->transCnt -= 1;
48         $this->Execute('ROLLBACK');
49         $this->Execute('SET AUTOCOMMIT=1');
50         return true;
51     }
52
53 }
54
55 class ADORecordSet_mysqlt extends ADORecordSet_mysql
56 {
57     var $databaseType = "mysqlt";
58
59     function ADORecordSet_mysqlt($queryID, $mode = false)
60     {
61         return $this->ADORecordSet_mysql($queryID, $mode);
62     }
63
64     function MoveNext()
65     {
66         if ($this->EOF) return false;
67
68         $this->_currentRow++;
69         // using & below slows things down by 20%!
70         $this->fields = @mysql_fetch_array($this->_queryID, $this->fetchMode);
71         if ($this->fields) return true;
72         $this->EOF = true;
73
74         return false;
75     }
76 }