<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="sqlite3.enableexceptions" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>SQLite3::enableExceptions</refname>
  <refpurpose>
   Enable throwing exceptions
  </refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="SQLite3">
   <modifier>public</modifier> <type>bool</type><methodname>SQLite3::enableExceptions</methodname>
   <methodparam choice="opt"><type>bool</type><parameter>enable</parameter><initializer>&false;</initializer></methodparam>
  </methodsynopsis>
  <para>
   Controls whether the <classname>SQLite3</classname> instance will
   throw exceptions or warnings on error.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>enable</parameter></term>
    <listitem>
     <para>
      When &true;, the <classname>SQLite3</classname> instance, and 
      <classname>SQLite3Stmt</classname> and <classname>SQLite3Result</classname>
      instances derived from it, will throw exceptions on error.
     </para>
     <para>
      When &false;, the <classname>SQLite3</classname> instance, and
      <classname>SQLite3Stmt</classname> and <classname>SQLite3Result</classname>
      instances derived from it, will raise warnings on error.
     </para>
     <para>
      For either mode, the error code and message, if any, will be available via
      <methodname>SQLite3::lastErrorCode</methodname> and
      <methodname>SQLite3::lastErrorMsg</methodname> respectively.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns the old value; &true; if exceptions were enabled, &false; otherwise.
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <example xml:id="sqlite3.enableexceptions.example.basic">
   <title><methodname>SQLite3::enableExceptions</methodname> example</title>
   <programlisting role="php">
<![CDATA[
<?php
$sqlite = new SQLite3(':memory:');
try {
    $sqlite->exec('create table foo');
    $sqlite->enableExceptions(true);
    $sqlite->exec('create table bar');
} catch (Exception $e) {
    echo 'Caught exception: ' . $e->getMessage();
}
?>
]]>
   </programlisting>
   &example.outputs.similar;
   <screen role="php">
<![CDATA[
Warning: SQLite3::exec(): near "foo": syntax error in example.php on line 4
Caught exception: near "bar": syntax error
]]>
   </screen>
  </example>
 </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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/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
-->
