downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.sqlite-udf-encode-binary.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$PARENTS = array();
include_once
dirname(__FILE__) ."/toc/ref.sqlite.inc";
$setup = array (
 
'home' =>
  array (
   
0 => 'index.php',
   
1 => 'PHP Manual',
  ),
 
'head' =>
  array (
   
0 => 'UTF-8',
   
1 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.sqlite-udf-encode-binary.php',
   
1 => 'sqlite_udf_encode_binary',
  ),
 
'up' =>
  array (
   
0 => 'ref.sqlite.php',
   
1 => 'SQLite Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.sqlite-udf-decode-binary.php',
   
1 => 'sqlite_udf_decode_binary',
  ),
 
'next' =>
  array (
   
0 => 'function.sqlite-unbuffered-query.php',
   
1 => 'sqlite_unbuffered_query',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<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, 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>

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

  <p class="para rdfs-comment">
   <b>sqlite_udf_encode_binary()</b> applies a binary encoding
   to the <i><tt class="parameter">data</tt></i>
 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
   <i>0x01</i> 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><p><b class="note">Note</b>:
  
    Do not use <a href="function.sqlite-escape-string.php" class="function">sqlite_escape_string()</a> to quote strings
    returned from UDF&#039;s as it will lead to double-quoting of the data.  Use
    <b>sqlite_udf_encode_binary()</b> instead!
   <br />
  </p></blockquote>
 </div>


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

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">data</tt></i>
</span>

     </dt><dd class="listitem">

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

   
   </dl>
<p>
  </p>
 </div>

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


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

</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites