~registry/clubdistro/anoochit-clubdistro

« back to all changes in this revision

Viewing changes to concrete5-5.2ubuntu1/concrete5.2.0RC2/concrete/libraries/3rdparty/adodb/drivers/adodb-mysqlpo.inc.php

  • Committer: Anuchit Chalothorn
  • Date: 2009-01-19 08:26:13 UTC
  • Revision ID: anoochit@gmail.com-20090119082613-jyxv9tam9ktfa73t
add concrete5 package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php 
 
2
 
 
3
/*
 
4
V5.02 24 Sept 2007   (c) 2000-2007 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
// security - hide paths
 
17
if (!defined('ADODB_DIR')) die();
 
18
 
 
19
include_once(ADODB_DIR."/drivers/adodb-mysql.inc.php");
 
20
 
 
21
 
 
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 
 
27
        
 
28
        function ADODB_mysqlt() 
 
29
        {                       
 
30
        global $ADODB_EXTENSION; if ($ADODB_EXTENSION) $this->rsPrefix .= 'ext_';
 
31
        }
 
32
        
 
33
        function BeginTrans()
 
34
        {         
 
35
                if ($this->transOff) return true;
 
36
                $this->transCnt += 1;
 
37
                $this->Execute('SET AUTOCOMMIT=0');
 
38
                $this->Execute('BEGIN');
 
39
                return true;
 
40
        }
 
41
        
 
42
        function CommitTrans($ok=true) 
 
43
        {
 
44
                if ($this->transOff) return true; 
 
45
                if (!$ok) return $this->RollbackTrans();
 
46
                
 
47
                if ($this->transCnt) $this->transCnt -= 1;
 
48
                $this->Execute('COMMIT');
 
49
                $this->Execute('SET AUTOCOMMIT=1');
 
50
                return true;
 
51
        }
 
52
        
 
53
        function RollbackTrans()
 
54
        {
 
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;
 
60
        }
 
61
        
 
62
        function RowLock($tables,$where='',$flds='1 as adodb_ignore') 
 
63
        {
 
64
                if ($this->transCnt==0) $this->BeginTrans();
 
65
                if ($where) $where = ' where '.$where;
 
66
                $rs = $this->Execute("select $flds from $tables $where for update");
 
67
                return !empty($rs); 
 
68
        }
 
69
        
 
70
}
 
71
 
 
72
class ADORecordSet_mysqlt extends ADORecordSet_mysql{   
 
73
        var $databaseType = "mysqlt";
 
74
        
 
75
        function ADORecordSet_mysqlt($queryID,$mode=false) 
 
76
        {
 
77
                if ($mode === false) { 
 
78
                        global $ADODB_FETCH_MODE;
 
79
                        $mode = $ADODB_FETCH_MODE;
 
80
                }
 
81
                
 
82
                switch ($mode)
 
83
                {
 
84
                case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
 
85
                case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
 
86
                
 
87
                case ADODB_FETCH_DEFAULT:
 
88
                case ADODB_FETCH_BOTH:
 
89
                default: $this->fetchMode = MYSQL_BOTH; break;
 
90
                }
 
91
        
 
92
                $this->adodbFetchMode = $mode;
 
93
                $this->ADORecordSet($queryID);  
 
94
        }
 
95
        
 
96
        function MoveNext()
 
97
        {
 
98
                if (@$this->fields = mysql_fetch_array($this->_queryID,$this->fetchMode)) {
 
99
                        $this->_currentRow += 1;
 
100
                        return true;
 
101
                }
 
102
                if (!$this->EOF) {
 
103
                        $this->_currentRow += 1;
 
104
                        $this->EOF = true;
 
105
                }
 
106
                return false;
 
107
        }
 
108
}
 
109
 
 
110
class ADORecordSet_ext_mysqlt extends ADORecordSet_mysqlt {     
 
111
 
 
112
        function ADORecordSet_ext_mysqlt($queryID,$mode=false) 
 
113
        {
 
114
                if ($mode === false) { 
 
115
                        global $ADODB_FETCH_MODE;
 
116
                        $mode = $ADODB_FETCH_MODE;
 
117
                }
 
118
                switch ($mode)
 
119
                {
 
120
                case ADODB_FETCH_NUM: $this->fetchMode = MYSQL_NUM; break;
 
121
                case ADODB_FETCH_ASSOC:$this->fetchMode = MYSQL_ASSOC; break;
 
122
                
 
123
                case ADODB_FETCH_DEFAULT:
 
124
                case ADODB_FETCH_BOTH:
 
125
                default: 
 
126
                        $this->fetchMode = MYSQL_BOTH; break;
 
127
                }
 
128
                $this->adodbFetchMode = $mode;
 
129
                $this->ADORecordSet($queryID);  
 
130
        }
 
131
        
 
132
        function MoveNext()
 
133
        {
 
134
                return adodb_movenext($this);
 
135
        }
 
136
}
 
137
 
 
138
?>
 
 
b'\\ No newline at end of file'