[DOC-CVS] [doc-en] master: sqlite3: document lastExtendedErrorCode/enableExtendedResultCodes, fix lastInsertRowID casing, describe OK/DENY/IGNORE (#5659)
[email protected] (Louis-Arnaud via GitHub)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Louis-Arnaud (lacatoire)
Committer: GitHub (web-flow)
Pusher: lacatoire
Date: 2026-08-28T13:47:43+02:00
Commit: https://github.com/php/doc-en/commit/32916e1adeb2b92179db162f422c63a69d9c9036
Raw diff: https://github.com/php/doc-en/commit/32916e1adeb2b92179db162f422c63a69d9c9036.diff
sqlite3: document lastExtendedErrorCode/enableExtendedResultCodes, fix lastInsertRowID casing, describe OK/DENY/IGNORE (#5659)
Both methods have existed since PHP 7.4.0 without a manual page. Also
aligns the lastInsertRowID casing in versions.xml with the stub and the
refname, describes the OK, DENY and IGNORE authorizer return constants,
and adds a see also section to lastErrorCode().
Changed paths:
A reference/sqlite3/sqlite3/enableextendedresultcodes.xml
A reference/sqlite3/sqlite3/lastextendederrorcode.xml
M reference/sqlite3/sqlite3.xml
M reference/sqlite3/sqlite3/lasterrorcode.xml
M reference/sqlite3/versions.xml
Diff:
diff --git a/reference/sqlite3/sqlite3.xml b/reference/sqlite3/sqlite3.xml
index b5c7eeebdb27..88c42d388b9f 100644
--- a/reference/sqlite3/sqlite3.xml
+++ b/reference/sqlite3/sqlite3.xml
@@ -263,21 +263,31 @@
<varlistentry xml:id="sqlite3.constants.ok">
<term><constant>SQLite3::OK</constant></term>
<listitem>
- <para/>
+ <simpara>
+ Returned from an authorizer callback to allow the action.
+ </simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="sqlite3.constants.deny">
<term><constant>SQLite3::DENY</constant></term>
<listitem>
- <para/>
+ <simpara>
+ Returned from an authorizer callback to reject the entire SQL statement
+ with an error.
+ </simpara>
</listitem>
</varlistentry>
<varlistentry xml:id="sqlite3.constants.ignore">
<term><constant>SQLite3::IGNORE</constant></term>
<listitem>
- <para/>
+ <simpara>
+ Returned from an authorizer callback to disallow the specific action
+ while still allowing the SQL statement to be compiled. See
+ <methodname>SQLite3::setAuthorizer</methodname> for the effect on each
+ action.
+ </simpara>
</listitem>
</varlistentry>
diff --git a/reference/sqlite3/sqlite3/enableextendedresultcodes.xml b/reference/sqlite3/sqlite3/enableextendedresultcodes.xml
new file mode 100644
index 000000000000..1cf6202d0a7b
--- /dev/null
+++ b/reference/sqlite3/sqlite3/enableextendedresultcodes.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<refentry xml:id="sqlite3.enableextendedresultcodes" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <refnamediv>
+ <refname>SQLite3::enableExtendedResultCodes</refname>
+ <refpurpose>
+ Enables or disables the use of extended result codes
+ </refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis role="SQLite3">
+ <modifier>public</modifier> <type>bool</type><methodname>SQLite3::enableExtendedResultCodes</methodname>
+ <methodparam choice="opt"><type>bool</type><parameter>enable</parameter><initializer>&true;</initializer></methodparam>
+ </methodsynopsis>
+ <simpara>
+ Enables or disables the use of extended result codes, which are then
+ reported by <methodname>SQLite3::lastErrorCode</methodname>.
+ <methodname>SQLite3::lastExtendedErrorCode</methodname> is not affected by
+ this setting, and always returns the extended result code.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ <variablelist>
+ <varlistentry>
+ <term><parameter>enable</parameter></term>
+ <listitem>
+ <simpara>
+ Whether to enable (&true;) or disable (&false;) the use of extended
+ result codes.
+ </simpara>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ &return.success;
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <example>
+ <title><methodname>SQLite3::enableExtendedResultCodes</methodname> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$db = new SQLite3(':memory:');
+$db->enableExceptions(true);
+$db->exec('CREATE TABLE t (a INTEGER UNIQUE)');
+$db->exec('INSERT INTO t VALUES (1)');
+
+try {
+ $db->exec('INSERT INTO t VALUES (1)');
+} catch (Exception $e) {
+}
+
+// The primary result code (SQLITE_CONSTRAINT), then the extended result
+// code (SQLITE_CONSTRAINT_UNIQUE).
+var_dump($db->lastErrorCode(), $db->lastExtendedErrorCode());
+
+// Once enabled, SQLite3::lastErrorCode() reports the extended result code
+// as well.
+$db->enableExtendedResultCodes();
+var_dump($db->lastErrorCode());
+?>
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+int(19)
+int(2067)
+int(2067)
+]]>
+ </screen>
+ </example>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><methodname>SQLite3::lastExtendedErrorCode</methodname></member>
+ <member><methodname>SQLite3::lastErrorCode</methodname></member>
+ </simplelist>
+ </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
+-->
diff --git a/reference/sqlite3/sqlite3/lasterrorcode.xml b/reference/sqlite3/sqlite3/lasterrorcode.xml
index b685d0fcf46e..f107a4902aee 100644
--- a/reference/sqlite3/sqlite3/lasterrorcode.xml
+++ b/reference/sqlite3/sqlite3/lasterrorcode.xml
@@ -32,6 +32,15 @@
</para>
</refsect1>
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><methodname>SQLite3::lastExtendedErrorCode</methodname></member>
+ <member><methodname>SQLite3::enableExtendedResultCodes</methodname></member>
+ <member><methodname>SQLite3::lastErrorMsg</methodname></member>
+ </simplelist>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
diff --git a/reference/sqlite3/sqlite3/lastextendederrorcode.xml b/reference/sqlite3/sqlite3/lastextendederrorcode.xml
new file mode 100644
index 000000000000..b26fa2214a43
--- /dev/null
+++ b/reference/sqlite3/sqlite3/lastextendederrorcode.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision$ -->
+<refentry xml:id="sqlite3.lastextendederrorcode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <refnamediv>
+ <refname>SQLite3::lastExtendedErrorCode</refname>
+ <refpurpose>
+ Returns the numeric extended result code of the most recent failed
+ SQLite request
+ </refpurpose>
+ </refnamediv>
+
+ <refsect1 role="description">
+ &reftitle.description;
+ <methodsynopsis role="SQLite3">
+ <modifier>public</modifier> <type>int</type><methodname>SQLite3::lastExtendedErrorCode</methodname>
+ <void/>
+ </methodsynopsis>
+ <simpara>
+ Returns the numeric extended result code of the most recent failed SQLite
+ request. Unlike <methodname>SQLite3::lastErrorCode</methodname>, this method
+ always returns the extended result code, whether or not extended result
+ codes have been enabled with
+ <methodname>SQLite3::enableExtendedResultCodes</methodname>.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="parameters">
+ &reftitle.parameters;
+ &no.function.parameters;
+ </refsect1>
+
+ <refsect1 role="returnvalues">
+ &reftitle.returnvalues;
+ <simpara>
+ Returns an integer value representing the numeric extended result code of
+ the most recent failed SQLite request.
+ </simpara>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <simplelist>
+ <member><methodname>SQLite3::enableExtendedResultCodes</methodname></member>
+ <member><methodname>SQLite3::lastErrorCode</methodname></member>
+ <member><methodname>SQLite3::lastErrorMsg</methodname></member>
+ </simplelist>
+ </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
+-->
diff --git a/reference/sqlite3/versions.xml b/reference/sqlite3/versions.xml
index 48829a4f4a6d..506787119e3b 100644
--- a/reference/sqlite3/versions.xml
+++ b/reference/sqlite3/versions.xml
@@ -13,11 +13,13 @@
<function name="SQLite3::createCollation" from="PHP 5 >= 5.3.11, PHP 7, PHP 8"/>
<function name="SQLite3::createFunction" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
<function name="SQLite3::enableExceptions" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
+ <function name="SQLite3::enableExtendedResultCodes" from="PHP 7 >= 7.4.0, PHP 8"/>
<function name="SQLite3::escapeString" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
<function name="SQLite3::exec" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
<function name="SQLite3::lastErrorCode" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
<function name="SQLite3::lastErrorMsg" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
- <function name="SQLite3::lastInsertRowId" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
+ <function name="SQLite3::lastExtendedErrorCode" from="PHP 7 >= 7.4.0, PHP 8"/>
+ <function name="SQLite3::lastInsertRowID" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
<function name="SQLite3::loadExtension" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
<function name="SQLite3::open" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>
<function name="SQLite3::openBlob" from="PHP 5 >= 5.3.0, PHP 7, PHP 8"/>