2004-05-13 14:27:30 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2005-01-14 05:42:48 +00:00
|
|
|
<!-- $Revision: 1.6 $ -->
|
2004-05-13 14:27:30 +00:00
|
|
|
<refentry id="function.sqlite-exec">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>sqlite_exec</refname>
|
2005-01-12 08:56:59 +00:00
|
|
|
<refname>SQLiteDatabase->exec</refname>
|
|
|
|
<refpurpose>Executes a result-less query against a given database</refpurpose>
|
2004-05-13 14:27:30 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
2004-05-13 14:29:46 +00:00
|
|
|
<type>bool</type><methodname>sqlite_exec</methodname>
|
2004-05-13 14:36:08 +00:00
|
|
|
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
2004-05-13 14:27:30 +00:00
|
|
|
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
2004-05-13 14:36:08 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>sqlite_exec</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
|
|
|
<methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
2005-01-12 08:56:59 +00:00
|
|
|
<para>Object oriented style (method):</para>
|
|
|
|
<classsynopsis>
|
|
|
|
<ooclass><classname>SQLiteDatabase</classname></ooclass>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>exec</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
</classsynopsis>
|
2004-05-13 14:36:08 +00:00
|
|
|
<para>
|
|
|
|
Executes an SQL statement given by the <parameter>query</parameter> against
|
|
|
|
a given database handle (specified by the <parameter>dbhandle</parameter>
|
|
|
|
parameter).
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
This function will return a boolean result; &true; for success or &false; for failure.
|
|
|
|
If you need to run a query that returns rows, see <function>sqlite_query</function>.
|
|
|
|
</para>
|
|
|
|
<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
|
|
|
|
loaded from a file or have embedded in a script.
|
|
|
|
</simpara>
|
|
|
|
</warning>
|
2005-01-14 05:42:48 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>sqlite_exec</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$dbhandle = sqlite_open('mysqlitedb');
|
|
|
|
$query = sqlite_exec($dbhandle, "UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'");
|
|
|
|
if (!$query) {
|
|
|
|
exit('Error in query.');
|
|
|
|
} else {
|
|
|
|
echo 'Number of rows modified: ', sqlite_changes($dbhandle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OO Example */
|
|
|
|
$dbhandle =& new SQLiteDatabase('mysqlitedb');
|
|
|
|
$query = $dbhandle->exec("UPDATE users SET email='jDoe@example.com' WHERE username='jDoe'");
|
|
|
|
if (!$query) {
|
|
|
|
exit('Error in query.');
|
|
|
|
} else {
|
|
|
|
echo 'Number of rows modified: ', $dbhandle->changes();
|
|
|
|
}
|
|
|
|
|
|
|
|
?>]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2005-01-12 08:56:59 +00:00
|
|
|
&sqlite.param-compat;
|
2004-05-13 14:36:08 +00:00
|
|
|
<para>
|
2005-01-12 08:56:59 +00:00
|
|
|
See also <function>sqlite_query</function>,
|
|
|
|
<function>sqlite_unbuffered_query</function> and
|
2004-05-13 14:36:08 +00:00
|
|
|
<function>sqlite_array_query</function>.
|
|
|
|
</para>
|
2004-05-13 14:27:30 +00:00
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- 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
|
|
|
|
-->
|