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

search for in the

sqlite_busy_timeout> <SQLite Funktionen
Last updated: Fri, 10 Oct 2008

view this page in

sqlite_array_query

(PHP 5, PECL sqlite:1.0-1.0.3)

sqlite_array_queryFührt eine Datenbankabfrage durch und liefert das komplette Abfrageergebnis als Array zurück.

Beschreibung

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

sqlite_array_query() ist vergleichbar mit der Nutzung von sqlite_query() und dann sqlite_fetch_array() für jede Zeile des Abfrageergebnisses und dem Speichern desselben in ein Array, wie im Beispiel unten beschrieben. Die Nutzung von sqlite_array_query() ist deutlich schneller als solch ein Script.

Beispiel #1 sqlite_array_query() selbst gebaut

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

sqlite_array_query() ist am besten für Queries geeignet, die 45 und weniger Ergebniszeilen zurückliefern. Wenn Sie mehr Daten haben, sollten Sie Ihre Scripte eher mit sqlite_unbuffered_query() schreiben, um eine optimale Geschwindigkeit zu erzielen.



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 Funktionen
Last updated: Fri, 10 Oct 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites