PHP
downloads | documentation | faq | getting help | mailing lists | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

sqlite_busy_timeout> <SQLite Funções
Last updated: Fri, 14 Nov 2008

view this page in

sqlite_array_query

(PHP 5, PECL sqlite:1.0-1.0.3)

sqlite_array_queryExecuta uma query ao banco de dados e retorna uma matriz

Descrição

array sqlite_array_query ( resource $dbhandle , string $query [, int $result_type [, bool $decode_binary ]] )
array sqlite_array_query ( string $query , resource $dbhandle [, int $result_type [, bool $decode_binary ]] )

sqlite_array_query() é similar a usar sqlite_query() e então sqlite_fetch_array() para cada linha do conjunto de resultados e coloca-lo em uma matriz, como mostrado no exemplo abaixo. Usar sqlite_array_query() é significativamente mais rápido do que usar um script como este.

Exemplo #1 sqlite_array_query() implementado por você mesmo

<?php
$q 
sqlite_query($database"SELECT * from foo LIMIT 100");
$rows = array();
while (
$r sqlite_fetch_array($q)) {
    
$rows[] = $r;
}
?>
Dica

sqlite_array_query() é melhor utilizado para queries que retornam 45 linhas ou menos. Se você tem mais dados do que isto, é recomendado que você escreva os seus script para usar sqlite_unbuffered_query() para ter uma performance melhor.

Veja também sqlite_query(), sqlite_fetch_array() e sqlite_fetch_string().



add a note add a note User Contributed Notes
sqlite_array_query
kendlj at NOSPAM dot web dot de
18-Apr-2005 04:21
Do not use this code, whenever you may get no result:

<?
$return_data=@sqlite_array_query($query,$databaseHandle);
if(!$return_data)
{
   //Errorhandling code
   die( sqlite_error_string( sqlite_last_error($this->databaseHandle) ) );
}
?>

It will execute the Errorhandling code although there is no error, cause if there is nothing found, sqlite_array_query returns an empty array, which is interpreted as 'false' here.
You will get an Message like:
'not an error'

Instead use:

<?
$return_data=@sqlite_array_query($query,$databaseHandle);
if($return_data===false)
{
   //Errorhandling code
}
?>

sqlite_busy_timeout> <SQLite Funções
Last updated: Fri, 14 Nov 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites