<?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 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.odbc-setoption.php',
    1 => 'odbc_setoption',
    2 => 'Adjust ODBC settings',
  ),
  'up' => 
  array (
    0 => 'ref.uodbc.php',
    1 => 'ODBC Функції',
  ),
  'prev' => 
  array (
    0 => 'function.odbc-rollback.php',
    1 => 'odbc_rollback',
  ),
  'next' => 
  array (
    0 => 'function.odbc-specialcolumns.php',
    1 => 'odbc_specialcolumns',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/uodbc/functions/odbc-setoption.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.odbc-setoption" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">odbc_setoption</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">odbc_setoption</span> &mdash; <span class="dc-title">Adjust ODBC settings</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.odbc-setoption-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>odbc_setoption</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type">Odbc\Connection</span>|<span class="type">Odbc\Result</span></span> <code class="parameter">$odbc</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$which</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$option</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$value</code></span><br>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   This function allows fiddling with the ODBC options for a
   particular connection or query result.  It was written to help
   find work around to problems in quirky ODBC drivers.  You should
   probably only use this function if you are an ODBC programmer and
   understand the effects the various options will have.  You will
   certainly need a good ODBC reference to explain all the different
   options and values that can be used.  Different driver versions
   support different options.
  </p>
  <p class="para">
   Because the effects may vary depending on the ODBC driver, use of
   this function in scripts to be made publicly available is
   strongly discouraged.  Also, some ODBC options are not available
   to this function because they must be set before the connection
   is established or the query is prepared.  However, if on a
   particular job it can make PHP work so your boss doesn&#039;t tell you
   to use a commercial product, that&#039;s all that really
   matters.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.odbc-setoption-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">odbc</code></dt>
     <dd>
      <p class="para">
       Is a connection id or result id on which to change the settings.
       For SQLSetConnectOption(), this is a connection id.
       For SQLSetStmtOption(), this is a result id.
      </p>
     </dd>
    
    
     <dt><code class="parameter">which</code></dt>
     <dd>
      <p class="para">
       Is the ODBC function to use. The value should be
       1 for SQLSetConnectOption() and
       2 for SQLSetStmtOption().
      </p>
     </dd>
    
    
     <dt><code class="parameter">option</code></dt>
     <dd>
      <p class="para">
       The option to set.
      </p>
     </dd>
    
    
     <dt><code class="parameter">value</code></dt>
     <dd>
      <p class="para">
       The value for the given <code class="parameter">option</code>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.odbc-setoption-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Повертає <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong> у разі успіху або <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> в разі помилки.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.odbc-setoption-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">odbc</code> expects an <span class="classname"><strong class="classname">Odbc\Connection</strong></span>
       or an <span class="classname"><strong class="classname">Odbc\Result</strong></span> instance now; previously, a
       <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> was expected.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.odbc-setoption-examples">
  <h3 class="title">Приклади</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Приклад #1 <span class="function"><strong>odbc_setoption()</strong></span> examples</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// 1. Option 102 of SQLSetConnectOption() is SQL_AUTOCOMMIT.<br />//    Value 1 of SQL_AUTOCOMMIT is SQL_AUTOCOMMIT_ON.<br />//    This example has the same effect as<br />//    odbc_autocommit($conn, true);<br /><br /></span><span style="color: #0000BB">odbc_setoption</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">102</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// 2. Option 0 of SQLSetStmtOption() is SQL_QUERY_TIMEOUT.<br />//    This example sets the query to timeout after 30 seconds.<br /><br /></span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #0000BB">odbc_prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #0000BB">$sql</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">odbc_setoption</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">30</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">odbc_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


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