2003-06-20 17:31:55 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-09-17 10:26:59 +00:00
|
|
|
<!-- $Revision: 1.11 $ -->
|
2003-06-20 17:31:55 +00:00
|
|
|
<refentry id="function.sqlite-query">
|
2003-06-20 18:49:38 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>sqlite_query</refname>
|
2003-07-06 04:43:08 +00:00
|
|
|
<refpurpose>
|
2004-07-27 04:48:55 +00:00
|
|
|
Executes a query against a given database and returns a result handle
|
2003-07-06 04:43:08 +00:00
|
|
|
</refpurpose>
|
2003-06-20 18:49:38 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>resource</type><methodname>sqlite_query</methodname>
|
2003-07-21 16:44:20 +00:00
|
|
|
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
2003-06-20 18:49:38 +00:00
|
|
|
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>resource</type><methodname>sqlite_query</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
2003-07-21 16:44:20 +00:00
|
|
|
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
2003-06-20 18:49:38 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Executes an SQL statement given by the <parameter>query</parameter> against
|
2003-07-21 16:44:20 +00:00
|
|
|
a given database handle (specified by the <parameter>dbhandle</parameter>
|
|
|
|
parameter).
|
2003-06-20 18:49:38 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2004-08-18 16:18:48 +00:00
|
|
|
This function will return a result handle or &false; on failure.
|
2004-08-16 09:29:35 +00:00
|
|
|
For queries that return rows, the result handle can then be used with
|
|
|
|
functions such as <function>sqlite_fetch_array</function> and
|
2003-06-20 18:49:38 +00:00
|
|
|
<function>sqlite_seek</function>.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Regardless of the query type, this function will return &false; if the
|
|
|
|
query failed.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<function>sqlite_query</function> returns a buffered, seekable result
|
|
|
|
handle. This is useful for reasonably small queries where you need to
|
|
|
|
be able to randomly access the rows. Buffered result handles will
|
|
|
|
allocate memory to hold the entire result and will not return until it
|
|
|
|
has been fetched. If you only need sequential access to the data, it is
|
|
|
|
recommended that you use the much higher performance
|
|
|
|
<function>sqlite_unbuffered_query</function> instead.
|
|
|
|
</para>
|
|
|
|
<note>
|
|
|
|
<simpara>
|
|
|
|
Two alternative syntaxes are supported for compatibility with other
|
|
|
|
database extensions (such as MySQL).
|
|
|
|
The preferred form is the first one, where the
|
2004-08-24 08:22:37 +00:00
|
|
|
<parameter>dbhandle</parameter> parameter is the first parameter to the
|
2003-06-20 18:49:38 +00:00
|
|
|
function.
|
|
|
|
</simpara>
|
|
|
|
</note>
|
|
|
|
<warning>
|
|
|
|
<simpara>
|
|
|
|
SQLite <emphasis>will</emphasis> execute multiple queries separated by
|
|
|
|
semicolons, so you can use it to execute a batch of SQL that you have
|
2004-05-13 14:32:21 +00:00
|
|
|
loaded from a file or have embedded in a script. However, this works only
|
|
|
|
when the result of the function is not used - if it is used,
|
|
|
|
only the first SQL statement would be executed. Function
|
|
|
|
<function>sqlite_exec</function> will always execute multiple SQL
|
|
|
|
statements.
|
2003-06-20 18:49:38 +00:00
|
|
|
</simpara>
|
|
|
|
<simpara>
|
|
|
|
When executing multiple queries, the return value of this function
|
2004-09-17 10:26:59 +00:00
|
|
|
will be &false; if there was an error, but undefined otherwise (it might
|
2003-06-20 18:49:38 +00:00
|
|
|
be &true; for success or it might return a result handle).
|
|
|
|
</simpara>
|
|
|
|
</warning>
|
|
|
|
<para>
|
2003-07-06 04:43:08 +00:00
|
|
|
See also <function>sqlite_unbuffered_query</function> and
|
|
|
|
<function>sqlite_array_query</function>.
|
2003-06-20 18:49:38 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2003-06-20 17:31:55 +00:00
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
sgml-parent-document:nil
|
|
|
|
sgml-default-dtd-file:"../../manual.ced"
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|