Manuál PHP | ||
---|---|---|
Předcházející | Další |
sqlite_array_query
(PHP 5)
sqlite_array_query(no version information, might be only in CVS)
SQLiteDatabase->arrayQuery -- Execute a query against a given database and returns an arrayPopis
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]] )
Object oriented style (method):
class SQLiteDatabase {array arrayQuery ( string query [, int result_type [, bool decode_binary]] )
}
sqlite_array_query() executes the given query and returns an array of the entire result set. It is similar to calling sqlite_query() and then sqlite_fetch_array() for each row in the result set. sqlite_array_query() is significantly faster than the aforementioned.
Tip: sqlite_array_query() is best suited to queries returning 45 rows or less. If you have more data than that, it is recommended that you write your scripts to use sqlite_unbuffered_query() instead for more optimal performance.
Seznam parametrů
query
The query to be executed.
dbhandle
The SQLite Database resource; returned from sqlite_open() when used procedurally. This parameter is not required when using the object-oriented method.
result_type
Nepovinný parametr
result_type
přijímá konstantu a určuje, jak bude indexováno vrácené pole. Konstanta SQLITE_ASSOC způsobí vracení pouze asociativních indexů (pojmenované prvky), kdežto SQLITE_NUM znamená vracení jen numerických indexů. Hodnota SQLITE_BOTH způsobí, že budou použity obě formy indexace. Výchozí hodnota pro tuto funkci je SQLITE_BOTH.decode_binary
Když je parametr
decode_binary
nastaven na TRUE (výchozí hodnota), PHP bude dekódovat binární kódování; týká se to dat, která byla zakódována pomocí sqlite_escape_string(). Toto byste normálně měli ponechat ve výchozím nastavení, s výjimkou případu, kdy potřebujete zajistit interoperabilitu s databázemi, které byly vytvořeny pomocí jiných aplikací využívajících sqlite.
Poznámka: Pro kompatibilitu s jinými databázovými rozšířeními (např. MySQL) jsou podporovány dvě alternativní syntaxe. Preferována je první z nich, kde parametr
dbhandle
je prvním parametrem funkce.
Návratové hodnoty
Returns an array of the entire result set; FALSE otherwise.
Názvy sloupců zjištěné pomocí SQLITE_ASSOC a SQLITE_BOTH will be upraveny z hlediska malých/velkých písmen podle hodnoty konfiguračního parametru sqlite.assoc_case.
Předcházející | Domů | Další |
SQLite Functions | Nahoru |