MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mconnection.class
Ir para a documentação deste ficheiro.
1
<?php
6
class
MysqlConnection
extends
MConnection
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
60
function
_begintransaction
()
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
?>
MConnection
Definição
mconnection.class:4
MConnection\GetError
GetError()
Definição
mconnection.class:89
MysqlConnection
Definição
mconnection.class:7
MysqlConnection\_timestamptochar
_timestamptochar($timestamp)
Definição
mconnection.class:177
MysqlConnection\_rollback
_rollback()
Definição
mconnection.class:84
MysqlConnection\_execute
_execute($sql)
Definição
mconnection.class:110
MysqlConnection\_datetochar
_datetochar($date)
Definição
mconnection.class:191
MysqlConnection\_begintransaction
_begintransaction()
Definição
mconnection.class:60
MysqlConnection\_close
_close()
Definição
mconnection.class:48
MysqlConnection\_sqlleftjoin
_sqlleftjoin(&$sql, $table1, $table2, $cond)
Definição
mconnection.class:232
MysqlConnection\_commit
_commit()
Definição
mconnection.class:72
MysqlConnection\_error
_error()
Definição
mconnection.class:96
MysqlConnection\_sqlrightjoin
_sqlrightjoin(&$sql, $table1, $table2, $cond)
Definição
mconnection.class:256
MysqlConnection\_connect
_connect($dbhost, $LoginDB, $LoginUID, $LoginPWD, $persistent=true, $port='')
Definição
mconnection.class:35
MysqlConnection\_chartodate
_chartodate($date)
Definição
mconnection.class:163
MysqlConnection\_sqljoin
_sqljoin(&$sql, $table1, $table2, $cond)
Definição
mconnection.class:208
MysqlConnection\_createquery
_createquery()
Definição
mconnection.class:135
MysqlConnection\_chartotimestamp
_chartotimestamp($timestamp)
Definição
mconnection.class:149
MysqlConnection\__construct
__construct($conf)
Definição
mconnection.class:17
MysqlQuery
Definição
mquery.class:7
classes
database
mysql
mconnection.class
Gerado por
1.10.0