mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
127 lines
7.2 KiB
HTML
127 lines
7.2 KiB
HTML
<!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 the client identifier</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.oci-set-client-identifier" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">oci_set_client_identifier</h1>
|
||
<p class="verinfo">(PHP 5 >= 5.3.2, PHP 7, PECL OCI8 >= 1.4.0)</p><p class="refpurpose"><span class="refname">oci_set_client_identifier</span> — <span class="dc-title">Sets the client identifier</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.oci-set-client-identifier-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>oci_set_client_identifier</strong></span>
|
||
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$connection</code></span>
|
||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$client_identifier</code></span>
|
||
) : <span class="type">bool</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
Sets the client identifier used by various database components to
|
||
identify lightweight application users who authenticate as the same
|
||
database user.
|
||
</p>
|
||
<p class="para">
|
||
The client identifier is registered with the database when the next
|
||
'round-trip' from PHP to the database occurs, typically when an SQL
|
||
statement is executed.
|
||
</p>
|
||
<p class="para">
|
||
The identifier can subsequently be queried, for example
|
||
with <em>SELECT SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER')
|
||
FROM DUAL</em>. Database administration views such
|
||
as <em>V$SESSION</em> will also contain the value. It
|
||
can be used with <em>DBMS_MONITOR.CLIENT_ID_TRACE_ENABLE</em>
|
||
for tracing and can also be used for auditing.
|
||
</p>
|
||
<p class="para">
|
||
The value may be retained across page requests that use the same persistent connection.
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.oci-set-client-identifier-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">client_identifier</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
User chosen string up to 64 bytes long.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.oci-set-client-identifier-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-client-identifier-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="example-2456">
|
||
<p><strong>Example #1 Setting the client identifier to the application user</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /><br /></span><span style="color: #FF8000">// Find the application user's login name<br /></span><span style="color: #0000BB">session_start</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$un </span><span style="color: #007700">= </span><span style="color: #0000BB">my_validate_session</span><span style="color: #007700">(</span><span style="color: #0000BB">$_SESSION</span><span style="color: #007700">[</span><span style="color: #DD0000">'username'</span><span style="color: #007700">]);<br /></span><span style="color: #0000BB">$c </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'myschema'</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 /><br /></span><span style="color: #FF8000">// Tell Oracle who that user is<br /></span><span style="color: #0000BB">oci_set_client_identifier</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">, </span><span style="color: #0000BB">$un</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// The next round-trip to the database will piggyback the identifier<br /></span><span style="color: #0000BB">$s </span><span style="color: #007700">= </span><span style="color: #0000BB">oci_parse</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">, </span><span style="color: #DD0000">'select mydata from mytable'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">oci_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// ...<br /><br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 notes" id="refsect1-function.oci-set-client-identifier-notes">
|
||
<h3 class="title">注释</h3>
|
||
<div class="caution"><strong class="caution">Caution</strong><h1 class="title">Roundtrip Gotcha</h1>
|
||
<p class="para">一些 OCI8 函数会导致 Roundtrips. 对数据库来说当启用结果缓存时,查询可能不产生Roundtrips。</p></div>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.oci-set-client-identifier-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="oci_set_module_name.html" class="function" rel="rdfs-seeAlso">oci_set_module_name()</a> - Sets the module name</span></li>
|
||
<li class="member"><span class="function"><a href="oci_set_action.html" class="function" rel="rdfs-seeAlso">oci_set_action()</a> - Sets the action name</span></li>
|
||
<li class="member"><span class="function"><a href="oci_set_client_info.html" class="function" rel="rdfs-seeAlso">oci_set_client_info()</a> - Sets the client information</span></li>
|
||
<li class="member"><span class="function"><a href="oci_set_db_operation.html" class="function" rel="rdfs-seeAlso">oci_set_db_operation()</a> - Sets the database operation</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |