2003-06-20 17:31:55 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2007-06-20 22:25:43 +00:00
|
|
|
<!-- $Revision: 1.8 $ -->
|
|
|
|
<refentry xml:id="function.sqlite-escape-string" xmlns="http://docbook.org/ns/docbook">
|
2003-06-20 18:49:38 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>sqlite_escape_string</refname>
|
|
|
|
<refpurpose>Escapes a string for use as a query parameter</refpurpose>
|
|
|
|
</refnamediv>
|
2005-02-21 00:31:07 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2003-06-20 18:49:38 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>string</type><methodname>sqlite_escape_string</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>item</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
<function>sqlite_escape_string</function> will correctly quote the string
|
|
|
|
specified by <parameter>item</parameter>
|
|
|
|
for use in an SQLite SQL statement. This includes doubling up
|
|
|
|
single-quote characters (<literal>'</literal>) and checking for
|
|
|
|
binary-unsafe characters in the query string.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
If the <parameter>item</parameter> contains a <literal>NUL</literal>
|
|
|
|
character, or if it begins with a character whose ordinal value is
|
|
|
|
<literal>0x01</literal>, PHP will apply a binary encoding scheme so that
|
|
|
|
you can safely store and retrieve binary data.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
Although the encoding makes it safe to insert the data, it will render
|
2003-09-30 08:33:48 +00:00
|
|
|
simple text comparisons and <literal>LIKE</literal> clauses in your
|
2003-06-20 18:49:38 +00:00
|
|
|
queries unusable for the columns that contain the binary data. In
|
|
|
|
practice, this shouldn't be a problem, as your schema should be such that
|
|
|
|
you don't use such things on binary columns (in fact, it might be better to
|
|
|
|
store binary data using other means, such as in files).
|
|
|
|
</para>
|
|
|
|
<warning>
|
|
|
|
<simpara>
|
|
|
|
<function>addslashes</function> should <emphasis>NOT</emphasis> be used to
|
|
|
|
quote your strings for SQLite queries; it will lead to strange results
|
|
|
|
when retrieving your data.
|
|
|
|
</simpara>
|
|
|
|
</warning>
|
2003-06-21 13:24:58 +00:00
|
|
|
<note>
|
|
|
|
<simpara>
|
|
|
|
Do not use this function to encode the return values from UDF's created
|
|
|
|
using <function>sqlite_create_function</function> or
|
|
|
|
<function>sqlite_create_aggregate</function> - use
|
|
|
|
<function>sqlite_udf_encode_binary</function> instead.
|
|
|
|
</simpara>
|
|
|
|
</note>
|
2005-02-21 00:31:07 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2003-07-06 04:43:08 +00:00
|
|
|
<para>
|
2005-02-21 00:31:07 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>sqlite_udf_encode_binary</function></member>
|
|
|
|
</simplelist>
|
2003-07-06 04:43:08 +00:00
|
|
|
</para>
|
2003-06-20 18:49:38 +00:00
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
2003-06-20 17:31:55 +00:00
|
|
|
<!-- 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
|
|
|
|
-->
|