<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >sqlite_udf_encode_binary</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="SQLite" HREF="ref.sqlite.html"><LINK REL="PREVIOUS" TITLE="sqlite_udf_decode_binary" HREF="function.sqlite-udf-decode-binary.html"><LINK REL="NEXT" TITLE="sqlite_unbuffered_query" HREF="function.sqlite-unbuffered-query.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.sqlite-udf-decode-binary.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.sqlite-unbuffered-query.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.sqlite-udf-encode-binary" ></A >sqlite_udf_encode_binary</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN105955" ></A ><P > (PHP 5)</P >sqlite_udf_encode_binary -- Encode binary data before returning it from an UDF.</DIV ><DIV CLASS="refsect1" ><A NAME="AEN105958" ></A ><H2 >Description</H2 >string <B CLASS="methodname" >sqlite_udf_encode_binary</B > ( string data)<BR ></BR ><P > <B CLASS="function" >sqlite_udf_encode_binary()</B > applies a binary encoding to the <VAR CLASS="parameter" >data</VAR > so that it can be safely returned from queries (since the underlying libsqlite API is not binary safe). </P ><P > 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 <VAR CLASS="literal" >0x01</VAR > byte as the first character) then you must call this function to encode the return value from your UDF. </P ><P > PHP does not perform this encode/decode operation automatically as it would severely impact performance if it did. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > Do not use <A HREF="function.sqlite-escape-string.html" ><B CLASS="function" >sqlite_escape_string()</B ></A > to quote strings returned from UDF's as it will lead to double-quoting of the data. Use <B CLASS="function" >sqlite_udf_encode_binary()</B > instead! </P ></BLOCKQUOTE ></DIV ><P > See also <A HREF="function.sqlite-udf-decode-binary.html" ><B CLASS="function" >sqlite_udf_decode_binary()</B ></A >, <A HREF="function.sqlite-escape-string.html" ><B CLASS="function" >sqlite_escape_string()</B ></A >, <A HREF="function.sqlite-create-function.html" ><B CLASS="function" >sqlite_create_function()</B ></A > and <A HREF="function.sqlite-create-aggregate.html" ><B CLASS="function" >sqlite_create_aggregate()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.sqlite-udf-decode-binary.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.sqlite-unbuffered-query.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >sqlite_udf_decode_binary</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.sqlite.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >sqlite_unbuffered_query</TD ></TR ></TABLE ></DIV ></BODY ></HTML >