1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
|
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.23 $ -->
<!-- Purpose: database.vendors -->
<!-- Membership: bundled -->
<reference id="ref.sqlite">
<title>SQLite Functions</title>
<titleabbrev>SQLite</titleabbrev>
<partintro>
<section id="sqlite.intro">
&reftitle.intro;
<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>
<para>
For further information see the SQLite Website
(<ulink url="&url.sqlite;">&url.sqlite;</ulink>).
</para>
</note>
</section>
<section id="sqlite.install">
<title>Installation</title>
<para>
Read the INSTALL file, which comes with the package. Or just use the PEAR
installer with <command>pear install sqlite</command>.
SQLite itself is already included, You do not need to install
any additional software.
</para>
<para>
Windows users may download the DLL version of the SQLite extension here:
(<ulink url="&url.pecl.get.win;php_sqlite.dll">php_sqlite.dll</ulink>).
</para>
<para>
In PHP 5, the SQLite extension and the engine itself are bundled and
compiled by default. However, since PHP 5.1.0 you need to manually
activate the extension in &php.ini; (because it is now bundled as
shared). Moreover, since PHP 5.1.0 SQLite depends on <link
linkend="ref.pdo">PDO</link> it must be enabled too, by adding the
following lines to &php.ini; (in order):
<informalexample>
<programlisting role="ini">
<![CDATA[
extension=php_pdo.dll
extension=php_sqlite.dll
]]>
</programlisting>
</informalexample>
On Linux or Unix operating systems, if you build PDO as a shared
extension, you must build SQLite as a shared extension using the
<command>--with-sqlite=shared</command> configure option.
</para>
<para>
SQLite 3 is supported through <link
linkend="ref.pdo-sqlite">PDO SQLite</link>.
</para>
<note>
<title>Windows installation for unprivileged accounts</title>
<para>
On Windows operating systems, unprivileged accounts don't have the
<varname>TMP</varname> environment variable set by default. This will
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
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>
</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
&php.ini;.
</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>
&reference.sqlite.constants;
<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>
<para><link linkend='function.sqlite-last-error'>lastError</link> - Returns the last error code of the most recently encountered error</para>
</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>
Represents an unbuffered SQLite result set. Unbuffered results sets are sequential, forward-seeking only.
</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>
&reference.sqlite.ini;
</partintro>
&reference.sqlite.functions;
</reference>
<!-- 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
-->
|