uTools-Manuals/docs/php/oci_set_call_timout.html
2019-04-28 19:00:34 +08:00

116 lines
4.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>Sets a millisecond timeout for database calls</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><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 &gt;= 7.2.14, PHP 7.3.1 &gt; 7.3 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">resource</span> <code class="parameter">$connection</code></span>
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$time_out</code></span>
) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
Sets a timeout limiting the maxium 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 <em>time_out</em> milliseconds, then the
operation is cancelled and an error is returned to the application.
</p>
<p class="para">
The <em>time_out</em> 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 <em>time_out</em> 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="oci_connect.html" class="function">oci_connect()</a></span><span class="function"><a href="oci_pconnect.html" class="function">oci_pconnect()</a></span>,或
<span class="function"><a href="oci_new_connect.html" class="function">oci_new_connect()</a></span> 返回。</p>
</dd>
<dt>
<code class="parameter">time_out</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>TRUE</code></strong> 或者在失败时返回 <strong><code>FALSE</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-2455">
<p><strong>Example #1 Setting the timeout</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'hr'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'welcome'</span><span style="color: #007700">,&nbsp;</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">,&nbsp;</span><span style="color: #0000BB">5000</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
</div></div></div></body></html>