MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mquery.class
Ir para a documentação deste ficheiro.
1<?php
6class MysqlQuery extends MQuery
7{
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 {
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
117 {
118 switch ($type)
119 {
124 case MYSQLI_TYPE_BIT:
125 case MYSQLI_TYPE_TINY:
127 case MYSQLI_TYPE_LONG:
130 case MYSQLI_TYPE_YEAR:
131 case MYSQLI_TYPE_ENUM:
132 return 'N';
133
135 case MYSQLI_TYPE_TIME:
138 case MYSQLI_TYPE_SET:
141 case MYSQLI_TYPE_CHAR:
143 return 'C';
144
145 case MYSQLI_TYPE_DATE:
147 return 'T';
148 default:
149 return 'N';
150 }
151 }
152}
153?>
__construct()
Definição mquery.class:20
_setmetadata()
Definição mquery.class:90
_getmetatype($type)
Definição mquery.class:116