Skip to content

Commit 0075c0f

Browse files
vranaclaude
andcommitted
pdo_sqlite: Document file: URI filenames in DSN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5990f1d commit 0075c0f

1 file changed

Lines changed: 43 additions & 1 deletion

File tree

‎reference/pdo_sqlite/reference.xml‎

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<!-- $Revision$ -->
33

4-
<reference xml:id="ref.pdo-sqlite" xmlns="http://docbook.org/ns/docbook">
4+
<reference xml:id="ref.pdo-sqlite" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
55
<?phpdoc extension-membership="bundledexternal" ?>
66
<title>SQLite PDO Driver (PDO_SQLITE)</title>
77
<titleabbrev>SQLite PDO Driver</titleabbrev>
@@ -54,6 +54,26 @@
5454
to the DSN prefix.
5555
</para>
5656
</listitem>
57+
<listitem>
58+
<simpara>
59+
A DSN starting with <literal>file:</literal> after the DSN prefix
60+
is passed to SQLite unchanged as a
61+
<link xlink:href="&url.sqlite;uri.html">URI filename</link>.
62+
Its query parameters set options, e.g. <literal>mode=ro</literal>
63+
opens the database read-only, and unknown parameters are ignored.
64+
URI filenames are not available if
65+
<link linkend="ini.open-basedir">open_basedir</link> is set.
66+
</simpara>
67+
<caution>
68+
<simpara>
69+
A URI filename can name any file regardless of the end of the DSN,
70+
e.g. <literal>sqlite:file:/var/www/data.php?x=.db</literal> opens
71+
<filename>/var/www/data.php</filename>.
72+
A DSN built from user input should therefore not be allowed to
73+
start with <literal>file:</literal>.
74+
</simpara>
75+
</caution>
76+
</listitem>
5777
<listitem>
5878
<para>
5979
If the DSN consists of the DSN prefix only, a temporary database is used,
@@ -67,6 +87,27 @@
6787
</variablelist>
6888
</para>
6989
</refsect1>
90+
<refsect1 role="changelog">
91+
&reftitle.changelog;
92+
<informaltable>
93+
<tgroup cols="2">
94+
<thead>
95+
<row>
96+
<entry>&Version;</entry>
97+
<entry>&Description;</entry>
98+
</row>
99+
</thead>
100+
<tbody>
101+
<row>
102+
<entry>8.1.0</entry>
103+
<entry>
104+
Added support for <literal>file:</literal> URI filenames.
105+
</entry>
106+
</row>
107+
</tbody>
108+
</tgroup>
109+
</informaltable>
110+
</refsect1>
70111
<refsect1 role="examples">
71112
&reftitle.examples;
72113
<para>
@@ -78,6 +119,7 @@
78119
<programlisting>
79120
<![CDATA[
80121
sqlite:/opt/databases/mydb.sq3
122+
sqlite:file:/opt/databases/mydb.sq3?mode=ro
81123
sqlite::memory:
82124
sqlite:
83125
]]>

0 commit comments

Comments
 (0)