2003-06-20 17:31:55 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
2005-08-18 16:10:45 +00:00
<!-- $Revision: 1.18 $ -->
2003-06-20 17:31:55 +00:00
<reference id= "ref.sqlite" >
2005-01-14 05:29:07 +00:00
<title > SQLite Functions</title>
2003-06-20 17:31:55 +00:00
<titleabbrev > SQLite</titleabbrev>
2003-06-20 18:26:30 +00:00
2003-06-20 17:31:55 +00:00
<partintro >
2003-06-20 18:26:30 +00:00
<section id= "sqlite.intro" >
2003-06-20 19:08:05 +00:00
&reftitle.intro;
2003-06-20 18:26:30 +00:00
<para >
This is an extension for the SQLite Embeddable SQL Database Engine.
SQLite is a C library that implements an embeddable SQL database engine.
Programs that link with the SQLite library can have SQL database access
without running a separate RDBMS process.
</para>
<para >
SQLite is not a client library used to connect to a big database server.
SQLite is the server. The SQLite library reads and writes directly to and from
the database files on disk.
</para>
<note >
2003-06-20 17:31:55 +00:00
<para >
2003-06-20 18:26:30 +00:00
For further information see the SQLite Website
2003-06-20 19:31:15 +00:00
(<ulink url= "&url.sqlite;" > &url.sqlite; </ulink> ).
2003-06-20 17:31:55 +00:00
</para>
2003-06-20 18:26:30 +00:00
</note>
</section>
2003-06-20 17:31:55 +00:00
2003-06-20 18:26:30 +00:00
<section id= "sqlite.install" >
<title > Installation</title>
<para >
Read the INSTALL file, which comes with the package. Or just use the PEAR
installer with "pear install sqlite".
SQLite itself is already included, You do not need to install
any additional software.
</para>
<para >
2003-06-20 19:31:15 +00:00
Windows users may download the DLL version of the SQLite extension here:
2003-06-20 20:19:29 +00:00
(<ulink url= "&url.pecl.get.win;php_sqlite.dll" > php_sqlite.dll</ulink> ).
2003-06-20 18:26:30 +00:00
</para>
2004-03-12 15:26:05 +00:00
<para >
In PHP 5, the SQLite extension and the engine itself are bundled and
2004-08-13 01:00:48 +00:00
compiled by default.
2004-03-12 15:26:05 +00:00
</para>
2005-02-15 18:29:02 +00:00
<note >
2005-02-16 19:57:56 +00:00
<title > Windows installation for unprivileged accounts</title>
2005-02-15 18:29:02 +00:00
<para >
2005-02-16 19:57:56 +00:00
On Windows operating systems, unprivileged accounts don't have the
2005-02-15 18:29:02 +00:00
<varname > TMP</varname> environment variable set by default. This will
2005-02-18 11:31:30 +00:00
make sqlite create temporary files in the windows directory, which is
not desirable. So, you should set the <varname > TMP</varname> environment
variable for the web server or the user account the web server is
running under. If Apache is your web server, you can accomplish this via
a <command > SetEnv</command> directive in your &httpd.conf; file. For
2005-02-15 18:29:02 +00:00
example:
<informalexample >
<programlisting role= "apache-conf" >
< ![CDATA[
SetEnv TMP c:/temp
]]>
</programlisting>
</informalexample>
If you are unable to establish this setting at the server
level, you can implement the setting in your script:
<informalexample >
<programlisting role= "php" >
< ![CDATA[
putenv('TMP=C:/temp');
]]>
</programlisting>
</informalexample>
The setting must refer to a directory that the web server
has permission to create files in and subsequently write
to and delete the files it created.
Otherwise, you may receive the following error message:
<computeroutput >
malformed database schema -
unable to open a temporary database file for storing temporary tables
</computeroutput>
</para>
</note>
2003-06-20 18:26:30 +00:00
</section>
<section id= "sqlite.requirements" >
&reftitle.required;
<para >
In order to have these functions available, you must compile PHP with
SQLite support, or load the SQLite extension dynamically from your
2003-07-16 15:05:51 +00:00
&php.ini; .
2003-06-20 18:26:30 +00:00
</para>
</section>
<section id= "sqlite.resources" >
&reftitle.resources;
<para >
There are two resources used in the SQLite Interface. The first one is the
database connection, the second one the result set.
</para>
</section>
2003-06-20 17:31:55 +00:00
2004-08-03 17:25:34 +00:00
&reference.sqlite.constants;
2005-01-12 08:56:59 +00:00
<section id= "sqlite.classes" >
&reftitle.classes;
<section id= "sqlite.class.sqlitedatabase" >
<title > <classname > SQLiteDatabase</classname> </title>
<para >
Represents an opened SQLite database.
</para>
<section id= 'sqlite.class.sqlitedatabase.constructor' >
&reftitle.constructor;
<itemizedlist >
<listitem >
<para > <link linkend= 'function.sqlite-open' > __construct</link> - construct a new SQLiteDatabase object</para>
</listitem>
</itemizedlist>
</section>
<section id= 'sqlite.class.sqlitedatabase.methods' >
&reftitle.methods;
<itemizedlist >
<listitem >
<para > <link linkend= 'function.sqlite-query' > query</link> - Execute a query</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-exec' > queryExec</link> - Execute a result-less query</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-array-query' > arrayQuery</link> - Execute a query and return the result as an array</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-single-query' > singleQuery</link> - Execute a query and return either an array for one single column or the value of the first row</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-unbuffered-query' > unbufferedQuery</link> - Execute an unbuffered query</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-last-insert-rowid' > lastInsertRowid</link> - Returns the rowid of the most recently inserted row</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-changes' > changes</link> - Returns the number of rows changed by the most recent statement</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-create-aggregate' > createAggregate</link> - Register an aggregating UDF for use in SQL statements</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-create-function' > createFunction</link> - Register a UDF for use in SQL statements</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-busy-timeout' > busyTimeout</link> - Sets or disables busy timeout duration</para>
</listitem>
<listitem >
2005-08-18 16:10:45 +00:00
<para > <link linkend= 'function.sqlite-last-error' > lastError</link> - Returns the last error code of the most recently encountered error</para>
2005-01-12 08:56:59 +00:00
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-fetch-column-types' > fetchColumnTypes</link> - Return an array of column types from a particular table</para>
</listitem>
</itemizedlist>
</section>
</section>
<section id= "sqlite.class.sqliteresult" >
<title > <classname > SQLiteResult</classname> </title>
<para >
Represents a buffered SQLite result set.
</para>
<section id= 'sqlite.class.sqliteresult.methods' >
&reftitle.methods;
<itemizedlist >
<listitem >
<para > <link linkend= 'function.sqlite-fetch-array' > fetch</link> - Fetches the next row from the result set as an array</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-fetch-object' > fetchObject</link> - Fetches the next row from the result set as an object</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-fetch-single' > fetchSingle</link> - Fetches the first column from the result set as a string</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-fetch-all' > fetchAll</link> - Fetches all rows from the result set as an array of arrays</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-column' > column</link> - Fetches a column from the current row of the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-num-fields' > numFields</link> - Returns the number of fields in the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-field-name' > fieldName</link> - Returns the name of a particular field in the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-current' > current</link> - Fetches the current row from the result set as an array</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-key' > key</link> - Return the current row index</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-next' > next</link> - Seek to the next row number</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-valid' > valid</link> - Returns whether more rows are available</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-rewind' > rewind</link> - Seek to the first row number of the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-prev' > prev</link> - Seek to the previous row number of the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-has-prev' > hasPrev</link> - Returns whether or not a previous row is available</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-num-rows' > numRows</link> - Returns the number of rows in the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-seek' > seek</link> - Seek to a particular row number</para>
</listitem>
</itemizedlist>
</section>
</section>
<section id= "sqlite.class.sqliteunbuffered" >
<title > <classname > SQLiteUnbuffered</classname> </title>
<para >
2005-02-14 04:13:17 +00:00
Represents an unbuffered SQLite result set. Unbuffered results sets are sequential, forward-seeking only.
2005-01-12 08:56:59 +00:00
</para>
<section id= 'sqlite.class.sqliteunbuffered.methods' >
&reftitle.methods;
<itemizedlist >
<listitem >
<para > <link linkend= 'function.sqlite-fetch-array' > fetch</link> - Fetches the next row from the result set as an array</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-fetch-object' > fetchObject</link> - Fetches the next row from the result set as an object</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-fetch-single' > fetchSingle</link> - Fetches the first column from the result set as a string</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-fetch-all' > fetchAll</link> - Fetches all rows from the result set as an array of arrays</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-column' > column</link> - Fetches a column from the current row of the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-num-fields' > numFields</link> - Returns the number of fields in the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-field-name' > fieldName</link> - Returns the name of a particular field in the result set</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-current' > current</link> - Fetches the current row from the result set as an array</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-next' > next</link> - Seek to the next row number</para>
</listitem>
<listitem >
<para > <link linkend= 'function.sqlite-valid' > valid</link> - Returns whether more rows are available</para>
</listitem>
</itemizedlist>
</section>
</section>
</section>
2004-08-03 17:25:34 +00:00
&reference.sqlite.ini;
2003-06-20 18:26:30 +00:00
</partintro>
2004-08-03 17:25:34 +00:00
2003-06-20 18:26:30 +00:00
&reference.sqlite.functions;
2003-06-20 17:31:55 +00:00
2003-06-20 18:26:30 +00:00
</reference>
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
indent-tabs-mode:nil
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
-->