121 if (!extension_loaded(
'sqlite')) {
122 throw new KumbiaException(
'Debe cargar la extensión de PHP llamada sqlite');
124 if ($this->id_connection = sqlite_open(
APP_PATH .
'config/sql/' .
$config[
'name'])) {
139 $this->
debug($sqlQuery);
144 $this->last_query = $sqlQuery;
145 if ($resultQuery = @sqlite_query($this->id_connection, $sqlQuery)) {
146 $this->last_result_query = $resultQuery;
158 if ($this->id_connection) {
159 return sqlite_close($this->id_connection);
182 return sqlite_fetch_array($resultQuery, $opt);
206 if (($numberRows = sqlite_num_rows($resultQuery)) !==
false) {
229 if (($fieldName = sqlite_field_name($resultQuery, $number)) !==
false) {
251 if (($success = sqlite_rewind($resultQuery, $number)) !==
false) {
273 if (($numberRows = pg_affected_rows($resultQuery)) !==
false) {
287 if (!$this->id_connection) {
288 $this->last_error = sqlite_last_error($this->id_connection) ? sqlite_last_error($this->id_connection) . $err :
"[Error Desconocido en SQLite \"$err\"]";
294 $this->last_error =
'SQLite error: ' . sqlite_error_string(sqlite_last_error($this->id_connection));
295 $this->last_error.= $err;
319 $last_id = $this->
fetch_one(
"SELECT COUNT(*) FROM $table");
331 $table = addslashes(strtolower($table));
332 if (strpos($table,
".")) {
333 list($schema, $table) = explode(
".", $table);
335 $num = $this->
fetch_one(
"SELECT COUNT(*) FROM sqlite_master WHERE name = '$table'");
350 if (isset($params[
'limit']) && is_numeric($params[
'limit'])) {
351 $sql_new.=
" LIMIT $params[limit]";
354 if (isset($params[
'offset']) && is_numeric($params[
'offset'])) {
355 $sql_new.=
" OFFSET $params[offset]";
371 return $this->
query(
"DROP TABLE $table");
376 return $this->
query(
"DROP TABLE $table");
399 return $this->
fetch_all(
"SELECT name FROM sqlite_master WHERE type='table' " .
400 "UNION ALL SELECT name FROM sqlite_temp_master " .
401 "WHERE type='table' ORDER BY name");
413 $results = $this->
fetch_all(
"PRAGMA table_info($table)");
415 foreach ($results as $field) {
417 "Field" => $field[
"name"],
418 "Type" => $field[
"type"],
419 "Null" => $field[
"notnull"] ==
'0' ?
"YES" :
"NO",
420 "Key" => $field[
'pk'] == 1 ?
"PRI" :
""