Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5885

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Encode binary data before returning it from an UDF</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-udf-decode-binary.html">sqlite_udf_decode_binary</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-unbuffered-query.html">sqlite_unbuffered_query</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.sqlite-udf-encode-binary" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sqlite_udf_encode_binary</h1>
  <p class="verinfo">(PHP 5 &lt; 5.4.0, PECL sqlite &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">sqlite_udf_encode_binary</span> &mdash; <span class="dc-title">Encode binary data before returning it from an UDF</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sqlite-udf-encode-binary-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">string</span> <span class="methodname"><strong>sqlite_udf_encode_binary</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
   )</div>

  <p class="para rdfs-comment">
    <span class="function"><strong>sqlite_udf_encode_binary()</strong></span> applies a binary encoding
   to the <em><code class="parameter">data</code></em> so that it can be safely returned from
   queries (since the underlying <var class="filename">libsqlite</var> API is not binary safe).
  </p>
  <p class="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
   <em>0x01</em> byte as the first character) then you must
   call this function to encode the return value from your UDF.
  </p>
  <p class="para">
   PHP does not perform this encode/decode operation automatically as it would
   severely impact performance if it did.
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    Do not use  <span class="function"><a href="function.sqlite-escape-string.html" class="function">sqlite_escape_string()</a></span> to quote strings
    returned from UDF&#039;s as it will lead to double-quoting of the data.  Use
     <span class="function"><strong>sqlite_udf_encode_binary()</strong></span> instead!
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.sqlite-udf-encode-binary-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">data</code></em></span>
     <dd>

      <p class="para">
       The <span class="type"><a href="language.types.string.html" class="type string">string</a></span> being encoded.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.sqlite-udf-encode-binary-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   The encoded <span class="type"><a href="language.types.string.html" class="type string">string</a></span>.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sqlite-udf-encode-binary-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.sqlite-udf-decode-binary.html" class="function" rel="rdfs-seeAlso">sqlite_udf_decode_binary()</a> - Decode binary data passed as parameters to an UDF</span></li>
    <li class="member"> <span class="function"><a href="function.sqlite-escape-string.html" class="function" rel="rdfs-seeAlso">sqlite_escape_string()</a> - Escapes a string for use as a query parameter</span></li>
    <li class="member"> <span class="function"><a href="function.sqlite-create-function.html" class="function" rel="rdfs-seeAlso">sqlite_create_function()</a> - Registers a &quot;regular&quot; User Defined Function for use in SQL statements</span></li>
    <li class="member"> <span class="function"><a href="function.sqlite-create-aggregate.html" class="function" rel="rdfs-seeAlso">sqlite_create_aggregate()</a> - Register an aggregating UDF for use in SQL statements</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-udf-decode-binary.html">sqlite_udf_decode_binary</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-unbuffered-query.html">sqlite_unbuffered_query</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>