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.odbc-setoption.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = 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 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.odbc-setoption.php',
   
1 => 'odbc_setoption',
  ),
 
'up' =>
  array (
   
0 => 'ref.uodbc.php',
   
1 => 'ODBC Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.odbc-rollback.php',
   
1 => 'odbc_rollback',
  ),
 
'next' =>
  array (
   
0 => 'function.odbc-specialcolumns.php',
   
1 => 'odbc_specialcolumns',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

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

 </div>
 
 <a name="function.odbc-setoption.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">bool</span> <span class="methodname"><b>odbc_setoption</b></span>
    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$id</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$function</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$option</tt></span>
   , <span class="methodparam"><span class="type">int</span> <tt class="parameter">$param</tt></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>


 <a name="function.odbc-setoption.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">id</tt></i>
</span>

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

      <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 class="varlistentry">

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

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

      <p class="para">
       Is the ODBC function to use. The value should be
       1 for SQLSetConnectOption() and
       2 for SQLSetStmtOption().
      </p>
     </dd>

   
    <dt class="varlistentry">

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

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

      <p class="para">
       The option to set.
      </p>
     </dd>

   
    <dt class="varlistentry">

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

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

      <p class="para">
       The value for the given <i><tt class="parameter">option</tt></i>
.
      </p>
     </dd>

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


 <a name="function.odbc-setoption.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns <b><tt class="constant">TRUE</tt></b> on success or <b><tt class="constant">FALSE</tt></b> on failure.
  </p>
 </div>


 <a name="function.odbc-setoption.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 <b>odbc_setoption()</b> examples</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;1.&nbsp;Option&nbsp;102&nbsp;of&nbsp;SQLSetConnectOption()&nbsp;is&nbsp;SQL_AUTOCOMMIT.<br />//&nbsp;&nbsp;&nbsp;&nbsp;Value&nbsp;1&nbsp;of&nbsp;SQL_AUTOCOMMIT&nbsp;is&nbsp;SQL_AUTOCOMMIT_ON.<br />//&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;example&nbsp;has&nbsp;the&nbsp;same&nbsp;effect&nbsp;as<br />//&nbsp;&nbsp;&nbsp;&nbsp;odbc_autocommit($conn,&nbsp;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">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">102</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;2.&nbsp;Option&nbsp;0&nbsp;of&nbsp;SQLSetStmtOption()&nbsp;is&nbsp;SQL_QUERY_TIMEOUT.<br />//&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;example&nbsp;sets&nbsp;the&nbsp;query&nbsp;to&nbsp;timeout&nbsp;after&nbsp;30&nbsp;seconds.<br /><br /></span><span style="color: #0000BB">$result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">odbc_prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</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">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</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>
  </p>
 </div>


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