MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mconnection.class
Ir para a documentação deste ficheiro.
1<?php
7{
17 function __construct($conf)
18 {
19 parent::__construct($conf);
20 }
21
35 function _connect($dbhost, $LoginDB, $LoginUID, $LoginPWD, $persistent = true, $port='')
36 {
37 $this->id = mysqli_connect($dbhost, $LoginUID, $LoginPWD, $LoginDB, $port);
38 mysqli_select_db($this->id, $LoginDB);
39 }
40
48 function _close()
49 {
50 mysqli_close($this->id);
51 }
52
61 {
62 $this->_execute("begin transaction");
63 }
64
72 function _commit()
73 {
74 $this->_execute("commit");
75 }
76
84 function _rollback()
85 {
86 $this->_execute("rollback");
87 }
88
96 function _error()
97 {
98 return mysqli_error($this->id);
99 }
100
110 function _execute($sql)
111 {
112 $rs = mysqli_query($this->id, $sql);
113 $success = false;
114
115 if ($rs)
116 {
117 $success = true;
118 mysqli_free_result ($rs);
119 }
120 else
121 {
122 $this->traceback[] = $this->GetError();
123 }
124
125 return $success;
126 }
127
135 function _createquery()
136 {
137 return new MysqlQuery();
138 }
139
149 function _chartotimestamp($timestamp)
150 {
151 return " TO_DATE(" . $timestamp . ",'DD/MM/YYYY HH24:MI:SS') ";
152 }
153
163 function _chartodate($date)
164 {
165 return " TO_DATE(" . $date . ",'DD/MM/YYYY') ";
166 }
167
177 function _timestamptochar($timestamp)
178 {
179 return " TO_CHAR(" . $timestamp . ",'DD/MM/YYYY HH24:MI:SS') ";
180 }
181
191 function _datetochar($date)
192 {
193 return " TO_CHAR(" . $date . ",'DD/MM/YYYY') ";
194 }
195
208 function _sqljoin(&$sql, $table1, $table2, $cond)
209 {
210 if ($sql->join)
211 {
212 $sql->join = "($sql->join INNER JOIN $table2 ON ($cond))";
213 }
214 else
215 {
216 $sql->join = "($table1 INNER JOIN $table2 ON ($cond))";
217 }
218 }
219
232 function _sqlleftjoin(&$sql, $table1, $table2, $cond)
233 {
234 if ($sql->join)
235 {
236 $sql->join = "($sql->join LEFT JOIN $table2 ON ($cond))";
237 }
238 else
239 {
240 $sql->join = "($table1 LEFT JOIN $table2 ON ($cond))";
241 }
242 }
243
256 function _sqlrightjoin(&$sql, $table1, $table2, $cond)
257 {
258 if ($sql->join)
259 {
260 $sql->join = "($sql->join RIGHT JOIN $table2 ON ($cond))";
261 }
262 else
263 {
264 $sql->join = "($table1 RIGHT JOIN $table2 ON ($cond))";
265 }
266 }
267}
268?>
_timestamptochar($timestamp)
_sqlleftjoin(&$sql, $table1, $table2, $cond)
_sqlrightjoin(&$sql, $table1, $table2, $cond)
_connect($dbhost, $LoginDB, $LoginUID, $LoginPWD, $persistent=true, $port='')
_sqljoin(&$sql, $table1, $table2, $cond)
_chartotimestamp($timestamp)