MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mquery.class
Ir para a documentação deste ficheiro.
1
<?php
6
class
MysqlQuery
extends
MQuery
7
{
11
var
$id_result
;
12
20
function
__construct
()
21
{
22
parent::__construct();
23
}
24
32
function
_query
()
33
{
34
$this->
fetched
=
true
;
35
mysqli_set_charset
($this->
conn
->id,
'UTF8'
);
36
$this->
id_result
=
mysqli_query
($this->
conn
->id,
$this
->sql);
37
38
if
($this->
nrows
=
mysqli_num_rows
($this->
id_result
))
39
{
40
$this->
result
=
array
();
41
42
$row
= $this->
offset
? $this->
offset
: 0;
43
$mrows
= $this->
maxrows
? (($this->
maxrows
<
$this->nrows
) ? $this->
maxrows
:
$this->nrows
) :
$this->nrows
;
44
$n
= 0;
45
46
while
( (
$n
<
$mrows
) && (
mysqli_data_seek
($this->
id_result
,
$row
++)) )
47
{
48
$this->
result
[
$n
++] =
mysqli_fetch_row
($this->
id_result
);
49
}
50
51
$this->
nrows
= $this->rowCount =
$n
;
52
}
53
}
54
62
function
_error
()
63
{
64
return
mysqli_error
($this->
conn
->id);
65
}
66
74
function
_close
()
75
{
76
if
($this->
id_result
!=
null
)
77
{
78
mysqli_free_result
($this->
id_result
);
79
$this->
id_result
=
null
;
80
}
81
}
82
90
function
_setmetadata
()
91
{
92
$numCols =
mysqli_num_fields
($this->
id_result
);
93
94
$this->
metadata
=
array
();
95
96
for
(
$i
= 0;
$i
< $numCols;
$i
++)
97
{
98
$field =
mysqli_fetch_field_direct
($this->
id_result
,
$i
);
99
$name =
strtoupper
($field->name);
100
$this->
metadata
[
'fieldname'
][
$i
] = $name;
101
$this->
metadata
[
'fieldtype'
][$name] = $this->
_getmetatype
($field->type);
102
$this->
metadata
[
'fieldlength'
][$name] = $field->length;
103
$this->
metadata
[
'fieldpos'
][$name] =
$i
;
104
}
105
}
106
116
function
_getmetatype
(
$type
)
117
{
118
switch
(
$type
)
119
{
120
case
MYSQLI_TYPE_DECIMAL
:
121
case
MYSQLI_TYPE_NEWDECIMAL
:
122
case
MYSQLI_TYPE_FLOAT
:
123
case
MYSQLI_TYPE_DOUBLE
:
124
case
MYSQLI_TYPE_BIT
:
125
case
MYSQLI_TYPE_TINY
:
126
case
MYSQLI_TYPE_SHORT
:
127
case
MYSQLI_TYPE_LONG
:
128
case
MYSQLI_TYPE_LONGLONG
:
129
case
MYSQLI_TYPE_INT24
:
130
case
MYSQLI_TYPE_YEAR
:
131
case
MYSQLI_TYPE_ENUM
:
132
return
'N'
;
133
134
case
MYSQLI_TYPE_TIMESTAMP
:
135
case
MYSQLI_TYPE_TIME
:
136
case
MYSQLI_TYPE_DATETIME
:
137
case
MYSQLI_TYPE_INTERVAL
:
138
case
MYSQLI_TYPE_SET
:
139
case
MYSQLI_TYPE_VAR_STRING
:
140
case
MYSQLI_TYPE_STRING
:
141
case
MYSQLI_TYPE_CHAR
:
142
case
MYSQLI_TYPE_GEOMETRY
:
143
return
'C'
;
144
145
case
MYSQLI_TYPE_DATE
:
146
case
MYSQLI_TYPE_NEWDATE
:
147
return
'T'
;
148
default
:
149
return
'N'
;
150
}
151
}
152
}
153
?>
MDataSet\$type
$type
Definição
mdataset.class:46
MDataSet\$row
$row
Definição
mdataset.class:16
MQuery
Definição
mquery.class:3
MysqlQuery
Definição
mquery.class:7
MysqlQuery\__construct
__construct()
Definição
mquery.class:20
MysqlQuery\_close
_close()
Definição
mquery.class:74
MysqlQuery\_setmetadata
_setmetadata()
Definição
mquery.class:90
MysqlQuery\_error
_error()
Definição
mquery.class:62
MysqlQuery\_query
_query()
Definição
mquery.class:32
MysqlQuery\$id_result
$id_result
Definição
mquery.class:11
MysqlQuery\_getmetatype
_getmetatype($type)
Definição
mquery.class:116
classes
database
mysql
mquery.class
Gerado por
1.10.0