<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.uodbc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ru',
  ),
  'this' => 
  array (
    0 => 'function.odbc-binmode.php',
    1 => 'odbc_binmode',
    2 => 'Обрабатывает данные двоичного столбца',
  ),
  'up' => 
  array (
    0 => 'ref.uodbc.php',
    1 => 'Функции ODBC',
  ),
  'prev' => 
  array (
    0 => 'function.odbc-autocommit.php',
    1 => 'odbc_autocommit',
  ),
  'next' => 
  array (
    0 => 'function.odbc-close.php',
    1 => 'odbc_close',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ru',
    'path' => 'reference/uodbc/functions/odbc-binmode.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.odbc-binmode" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">odbc_binmode</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">odbc_binmode</span> &mdash; <span class="dc-title">Обрабатывает данные двоичного столбца</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.odbc-binmode-description">
  <h3 class="title">Описание</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>odbc_binmode</strong></span>(<span class="methodparam"><span class="type">Odbc\Result</span> <code class="parameter">$statement</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code></span>): <span class="type"><a href="language.types.singleton.php" class="type true">true</a></span></div>

  <p class="para rdfs-comment">
   Функция управляет обработкой данных двоичного столбца. На ODBC-серверах функция затрагивает
   следующие типы SQL-данных:
   <code class="literal">BINARY</code>, <code class="literal">VARBINARY</code> и <code class="literal">LONGVARBINARY</code>.
   Режим по умолчанию устанавливают через директиву
   <a href="odbc.configuration.php#ini.uodbc.defaultbinmode" class="link">uodbc.defaultbinmode</a>, которая содержится в файле <var class="filename">php.ini</var>.
  </p>
  <p class="para">
   Когда двоичные SQL-данные преобразовываются в символьные C-данные
   (<strong><code><a href="uodbc.constants.php#constant.odbc-binmode-convert">ODBC_BINMODE_CONVERT</a></code></strong>), каждый байт (8 битов) исходных
   данных представляется парой символов в кодировке ASCII. Эти символы формируют
   символьное представление числа в формате ASCII в шестнадцатеричной
   форме. Например, двоичное число <code class="literal">00000001</code> преобразовывается
   в символьное представление <code class="literal">&quot;01&quot;</code>, а число <code class="literal">11111111</code> — в <code class="literal">&quot;FF&quot;</code>.
  </p>
  <p class="para">
   Хотя обработка столбцов с типами <code class="literal">BINARY</code>
   и <code class="literal">VARBINARY</code> зависит только от директивы binmode, обработка столбцов
   с типом <code class="literal">LONGVARBINARY</code> также зависит от атрибута longreadlen:
   <table class="doctable table">
    <caption><strong>Обработка данных с типом LONGVARBINARY</strong></caption>
    
     <thead>
      <tr>
       <th>Режим директивы binmode</th>
       <th>Значение атрибута longreadlen</th>
       <th>Результат</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><strong><code><a href="uodbc.constants.php#constant.odbc-binmode-passthru">ODBC_BINMODE_PASSTHRU</a></code></strong></td>
       <td>0</td>
       <td>Сквозной сеанс</td>
      </tr>

      <tr>
       <td><strong><code><a href="uodbc.constants.php#constant.odbc-binmode-return">ODBC_BINMODE_RETURN</a></code></strong></td>
       <td>0</td>
       <td>Сквозной сеанс</td>
      </tr>

      <tr>
       <td><strong><code><a href="uodbc.constants.php#constant.odbc-binmode-convert">ODBC_BINMODE_CONVERT</a></code></strong></td>
       <td>0</td>
       <td>Сквозной сеанс</td>
      </tr>

      <tr>
       <td><strong><code><a href="uodbc.constants.php#constant.odbc-binmode-passthru">ODBC_BINMODE_PASSTHRU</a></code></strong></td>
       <td>&gt;0</td>
       <td>Сквозной сеанс</td>
      </tr>

      <tr>
       <td><strong><code><a href="uodbc.constants.php#constant.odbc-binmode-return">ODBC_BINMODE_RETURN</a></code></strong></td>
       <td>&gt;0</td>
       <td>Данные возвращаются как есть</td>
      </tr>

      <tr>
       <td><strong><code><a href="uodbc.constants.php#constant.odbc-binmode-convert">ODBC_BINMODE_CONVERT</a></code></strong></td>
       <td>&gt;0</td>
       <td>Данные возвращаются как char</td>
      </tr>

     </tbody>
    
   </table>

  </p>
  <p class="para">
   В сквозном режиме функция <span class="function"><a href="function.odbc-fetch-into.php" class="function">odbc_fetch_into()</a></span> возвращает
   из столбцов с двоичными данными пустую строку.
   При установке сквозного режима и вызове функции <span class="function"><a href="function.odbc-result.php" class="function">odbc_result()</a></span>
   данные отправляются непосредственно клиенту, выводятся.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.odbc-binmode-parameters">
  <h3 class="title">Список параметров</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">statement</code></dt>
     <dd>
      <p class="para">
       Объект ODBC с результатом.
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       Возможные значения параметра <code class="parameter">mode</code>:
       <ul class="itemizedlist">
        <li class="listitem">
         <span class="simpara">
          <strong><code><a href="uodbc.constants.php#constant.odbc-binmode-passthru">ODBC_BINMODE_PASSTHRU</a></code></strong>: Устанавливает сквозной режим для данных с типом BINARY
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code><a href="uodbc.constants.php#constant.odbc-binmode-return">ODBC_BINMODE_RETURN</a></code></strong>: Данные возвращаются как есть
         </span>
        </li>
        <li class="listitem">
         <span class="simpara">
          <strong><code><a href="uodbc.constants.php#constant.odbc-binmode-convert">ODBC_BINMODE_CONVERT</a></code></strong>: Перед возвратом данные преобразовываются в тип char
         </span>
        </li>
       </ul>
       <blockquote class="note"><p><strong class="note">Замечание</strong>: 
        <span class="simpara">
         На обработку столбцов с типом двоичных данных LONG также влияет функция
         <span class="function"><a href="function.odbc-longreadlen.php" class="function">odbc_longreadlen()</a></span>.
        </span>
       </p></blockquote>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.odbc-binmode-returnvalues">
  <h3 class="title">Возвращаемые значения</h3>
  <p class="para">
   Функция возвращает логическое значение <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.odbc-binmode-changelog">
  <h3 class="title">Список изменений</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>Версия</th>
      <th>Описание</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.4.0</td>
 <td>
  Параметр <code class="parameter">statement</code> теперь принимает экземпляр с результом OBDC-запроса <span class="classname"><strong class="classname">Odbc\Result</strong></span>;
  раньше принимался тип <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>

</div><?php manual_footer($setup); ?>