<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.oci8.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.oci-set-call-timout.php',
    1 => 'oci_set_call_timeout',
    2 => 'Sets a millisecond timeout for database calls',
  ),
  'up' => 
  array (
    0 => 'ref.oci8.php',
    1 => 'OCI8 函数',
  ),
  'prev' => 
  array (
    0 => 'function.oci-set-action.php',
    1 => 'oci_set_action',
  ),
  'next' => 
  array (
    0 => 'function.oci-set-client-identifier.php',
    1 => 'oci_set_client_identifier',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/oci8/functions/oci-set-call-timeout.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.oci-set-call-timout" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">oci_set_call_timeout</h1>
  <p class="verinfo">(PHP 7.2 &gt;= 7.2.14, PHP 8, PHP 7 &gt;= 7.3.1, PHP 8, PECL OCI8 &gt;= 2.2.0)</p><p class="refpurpose"><span class="refname">oci_set_call_timeout</span> &mdash; <span class="dc-title">Sets a millisecond timeout for database calls</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.oci-set-call-timout-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>oci_set_call_timeout</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> <code class="parameter">$connection</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$timeout</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Sets a timeout limiting the maximum time a database round-trip using this connection may take.
  </p>
  <p class="para">
   Each OCI8 operation may make zero or more calls to Oracle&#039;s client
   library.  These internal calls may then may make zero or more
   round-trips to Oracle Database.  If any one of those round-trips
   takes more than <code class="literal">time_out</code> milliseconds, then the
   operation is cancelled and an error is returned to the application.
  </p>
  <p class="para">
    The <code class="literal">time_out</code> value applies to each round-trip
    individually, not to the sum of all round-trips.  Time spent
    processing in PHP OCI8 before or after the completion of each
    round-trip is not counted.
  </p>
  <p class="para">
    When a call is interrupted, Oracle will attempt to clean up the
    connection for reuse.  This operation is allowed to run for
    another <code class="literal">time_out</code> period.  Depending on the
    outcome of the cleanup, the connection may or may not be reusable.
  </p>
  <p class="para">
    When persistent connections are used, the timeout value will be
    retained across PHP requests.
  </p>
  <p class="para">
   The <span class="function"><strong>oci_set_call_timeout()</strong></span> function is available
   when OCI8 uses Oracle 18 (or later) Client libraries.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.oci-set-call-timout-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">connection</code></dt>
     <dd>
       <p class="para">Oracle 连接标识，由
<span class="function"><a href="function.oci-connect.php" class="function">oci_connect()</a></span>，<span class="function"><a href="function.oci-pconnect.php" class="function">oci_pconnect()</a></span>，或
<span class="function"><a href="function.oci-new-connect.php" class="function">oci_new_connect()</a></span> 返回。</p>
     </dd>
    
    
     <dt><code class="parameter">timeout</code></dt>
     <dd>
      <p class="para">
       The maximum time in milliseconds that any single round-trip between PHP and Oracle Database may take.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.oci-set-call-timout-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 examples" id="refsect1-function.oci-set-call-timout-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 Setting the timeout</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$conn </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'hr'</span><span style="color: #007700">, </span><span style="color: #DD0000">'welcome'</span><span style="color: #007700">, </span><span style="color: #DD0000">'localhost/XE'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_set_call_timeout</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #0000BB">5000</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


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