php-doc-en/reference/sqlite/functions/sqlite-udf-encode-binary.xml
2004-07-27 04:48:55 +00:00

62 lines
2.1 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<refentry id="function.sqlite-udf-encode-binary">
<refnamediv>
<refname>sqlite_udf_encode_binary</refname>
<refpurpose>Encode binary data before returning it from an UDF</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>sqlite_udf_encode_binary</methodname>
<methodparam><type>string</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>sqlite_udf_encode_binary</function> applies a binary encoding
to the <parameter>data</parameter> so that it can be safely returned from
queries (since the underlying libsqlite API is not binary safe).
</para>
<para>
If there is a chance that your data might be binary unsafe (e.g.: it
contains a NUL byte in the middle rather than at the end, or if it has and
<literal>0x01</literal> byte as the first character) then you must
call this function to encode the return value from your UDF.
</para>
<para>
PHP does not perform this encode/decode operation automatically as it would
severely impact performance if it did.
</para>
<note>
<para>
Do not use <function>sqlite_escape_string</function> to quote strings
returned from UDF's as it will lead to double-quoting of the data. Use
<function>sqlite_udf_encode_binary</function> instead!
</para>
</note>
<para>
See also <function>sqlite_udf_decode_binary</function>,
<function>sqlite_escape_string</function>,
<function>sqlite_create_function</function> and
<function>sqlite_create_aggregate</function>.
</para>
</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
-->