MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
mquery.class
Ir para a documentação deste ficheiro.
1<?php
6class SQLiteQuery extends MQuery
7{
12
20 function __construct()
21 {
22 parent::__construct();
23 }
24
32 function _query()
33 {
34 $this->fetched = false;
35 $this->sql = $this->maxrows ? $this->sql . " LIMIT $this->maxrows" : $this->sql;
36 $this->sql = $this->offset ? $this->sql . " OFFSET $this->offset" : $this->sql;
37 $this->id_result = sqlite_query($this->conn->id, $this->sql);
38 $this->error = $this->_error();
39
40 if (!$this->error)
41 {
42 $this->rowCount = sqlite_num_rows($this->id_result);
43
44 for ($n = 0; $n < $this->rowCount; $this->result[$n++] = sqlite_fetch_array($this->id_result, SQLITE_NUM))
45 ;
46
47 $this->fetched = true;
48 $this->colCount = sqlite_num_fields($this->id_result);
49 }
50 else
51 {
52 throw new EDatabaseQueryException($this->error);
53 }
54
55 return (!$this->error);
56 }
57
65 function _error()
66 {
67 return (($error = sqlite_last_error($this->conn->id)) ? sqlite_error_string($error) : false);
68 }
69
77 function _close()
78 {
79 if ($this->id_result)
80 unset ($this->id_result);
81 }
82
90 function _setmetadata()
91 {
92 $numCols = $this->colCount;
93 $this->metadata = array
94 (
95 );
96
97 for ($i = 0; $i < $numCols; $i++)
98 {
99 $name = strtoupper(sqlite_field_name($this->id_result, $i));
100 $name = ($p = strpos($name, '.')) ? substr($name, $p + 1) : $name;
101 $this->metadata['fieldname'][$i] = $name;
102 $this->metadata['fieldtype'][$name] = 'C';
103 $this->metadata['fieldlength'][$name] = 0;
104 $this->metadata['fieldpos'][$name] = $i;
105 }
106 }
107
118 {
120 $rType = 'N';
121
122 if ($type == "VARCHAR")
123 {
124 $rType = 'C';
125 }
126 elseif ($type == "CHAR")
127 {
128 $rType = 'C';
129 }
130 elseif ($type == "NUMBER")
131 {
132 $rType = 'N';
133 }
134 elseif ($type == "INTEGER")
135 {
136 $rType = 'N';
137 }
138 elseif ($type == "DATE")
139 {
140 $rType = 'T';
141 }
142 elseif ($type == "TIMESTAMP")
143 {
144 $rType = 'T';
145 }
146
147 return $rType;
148 }
149}
150?>
$error
Definição mquery.class:7
_setmetadata()
Definição mquery.class:90
_getmetatype($type)
Definição mquery.class:117