<!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>Handling of binary column data</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.odbc-autocommit.html">odbc_autocommit</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.odbc-close-all.html">odbc_close_all</a></div> <div class="up"><a href="ref.uodbc.html">ODBC Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.odbc-binmode" class="refentry"> <div class="refnamediv"> <h1 class="refname">odbc_binmode</h1> <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">odbc_binmode</span> — <span class="dc-title">Handling of binary column data</span></p> </div> <div class="refsect1 description" id="refsect1-function.odbc-binmode-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">bool</span> <span class="methodname"><strong>odbc_binmode</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result_id</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code></span> )</div> <p class="para rdfs-comment"> Enables handling of binary column data. ODBC SQL types affected are <em>BINARY</em>, <em>VARBINARY</em>, and <em>LONGVARBINARY</em>. </p> <p class="para"> When binary SQL data is converted to character C data, each byte (8 bits) of source data is represented as two ASCII characters. These characters are the ASCII character representation of the number in its hexadecimal form. For example, a binary <em>00000001</em> is converted to <em>"01"</em> and a binary <em>11111111</em> is converted to <em>"FF"</em>. <table class="doctable table"> <caption><strong>LONGVARBINARY handling</strong></caption> <thead> <tr> <th>binmode</th> <th>longreadlen</th> <th>result</th> </tr> </thead> <tbody class="tbody"> <tr> <td><strong><code>ODBC_BINMODE_PASSTHRU</code></strong></td> <td>0</td> <td>passthru</td> </tr> <tr> <td><strong><code>ODBC_BINMODE_RETURN</code></strong></td> <td>0</td> <td>passthru</td> </tr> <tr> <td><strong><code>ODBC_BINMODE_CONVERT</code></strong></td> <td>0</td> <td>passthru</td> </tr> <tr> <td><strong><code>ODBC_BINMODE_PASSTHRU</code></strong></td> <td>0</td> <td>passthru</td> </tr> <tr> <td><strong><code>ODBC_BINMODE_PASSTHRU</code></strong></td> <td>>0</td> <td>passthru</td> </tr> <tr> <td><strong><code>ODBC_BINMODE_RETURN</code></strong></td> <td>>0</td> <td>return as is</td> </tr> <tr> <td><strong><code>ODBC_BINMODE_CONVERT</code></strong></td> <td>>0</td> <td>return as char</td> </tr> </tbody> </table> </p> <p class="para"> If <span class="function"><a href="function.odbc-fetch-into.html" class="function">odbc_fetch_into()</a></span> is used, passthru means that an empty string is returned for these columns. </p> </div> <div class="refsect1 parameters" id="refsect1-function.odbc-binmode-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">result_id</code></em></span> <dd> <p class="para"> The result identifier. </p> <p class="para"> If <em><code class="parameter">result_id</code></em> is <em>0</em>, the settings apply as default for new results. <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara"> Default for <em>longreadlen</em> is <em>4096</em> and <em><code class="parameter">mode</code></em> defaults to <em>ODBC_BINMODE_RETURN</em>. Handling of binary long columns is also affected by <span class="function"><a href="function.odbc-longreadlen.html" class="function">odbc_longreadlen()</a></span>. </span> </p></blockquote> </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">mode</code></em></span> <dd> <p class="para"> Possible values for <em><code class="parameter">mode</code></em> are: <ul class="itemizedlist"> <li class="listitem"> <span class="simpara"> <strong><code>ODBC_BINMODE_PASSTHRU</code></strong>: Passthru BINARY data </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>ODBC_BINMODE_RETURN</code></strong>: Return as is </span> </li> <li class="listitem"> <span class="simpara"> <strong><code>ODBC_BINMODE_CONVERT</code></strong>: Convert to char and return </span> </li> </ul> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.odbc-binmode-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.odbc-autocommit.html">odbc_autocommit</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.odbc-close-all.html">odbc_close_all</a></div> <div class="up"><a href="ref.uodbc.html">ODBC Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>