<?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-module-name.php',
    1 => 'oci_set_module_name',
    2 => 'Sets the module name',
  ),
  'up' => 
  array (
    0 => 'ref.oci8.php',
    1 => 'OCI8 函数',
  ),
  'prev' => 
  array (
    0 => 'function.oci-set-edition.php',
    1 => 'oci_set_edition',
  ),
  'next' => 
  array (
    0 => 'function.oci-set-prefetch.php',
    1 => 'oci_set_prefetch',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/oci8/functions/oci-set-module-name.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.oci-set-module-name" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">oci_set_module_name</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.2, PHP 7, PHP 8, PECL OCI8 &gt;= 1.4.0)</p><p class="refpurpose"><span class="refname">oci_set_module_name</span> &mdash; <span class="dc-title">Sets the module name</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.oci-set-module-name-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>oci_set_module_name</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.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   Sets the module name for Oracle tracing.
  </p>
  <p class="para">
   The module name is registered with the database when the next
   &#039;round-trip&#039; from PHP to the database occurs, typically when an SQL
   statement is executed.
  </p>
  <p class="para">
   The name can subsequently be queried from database administration
   views such as <code class="literal">V$SESSION</code>.  It can be used for
   tracing and monitoring such as with <code class="literal">V$SQLAREA</code>
   and <code class="literal">DBMS_MONITOR.SERV_MOD_ACT_STAT_ENABLE</code>.
  </p>
  <p class="para">
   The value may be retained across persistent connections.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.oci-set-module-name-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">name</code></dt>
     <dd>
      <p class="para">
       User chosen <span class="type"><a href="language.types.string.php" class="type string">string</a></span> up to 48 bytes long.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.oci-set-module-name-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-module-name-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 Setting the module name</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$c </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 /><br /></span><span style="color: #FF8000">// Record the module<br /></span><span style="color: #0000BB">oci_set_module_name</span><span style="color: #007700">(</span><span style="color: #0000BB">$c</span><span style="color: #007700">, </span><span style="color: #DD0000">'Home Page'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Code that causes a round-trip, for example a query:<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 * from dual'</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 /></span><span style="color: #0000BB">oci_fetch_all</span><span style="color: #007700">(</span><span style="color: #0000BB">$s</span><span style="color: #007700">, </span><span style="color: #0000BB">$res</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">sleep</span><span style="color: #007700">(</span><span style="color: #0000BB">30</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">// While the script is running, the administrator can see the
// modules in use:

sqlplus system/welcome
SQL&gt; select module from v$session;</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.oci-set-module-name-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: <strong>Oracle 版本需求</strong><br />
<p class="para">当 PHP 是与 Oracle 数据库 10<em>g</em> 及更新版本的 扩展库链接时，此函数可用。</p></p></blockquote>
  <div class="tip"><strong class="tip">小技巧</strong><h1 class="title">性能</h1>
 <p class="para">使用旧版的 OCI8 或 ORACLE 数据库，可使用
 Oracle <code class="literal">DBMS_APPLICATION_INFO</code> 包来设置客户端信息。这比使用
 <span class="function"><a href="function.oci-set-client-info.php" class="function">oci_set_client_info()</a></span> 较低效。</p></div>
  <div class="caution"><strong class="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-module-name-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.oci-set-action.php" class="function" rel="rdfs-seeAlso">oci_set_action()</a> - Sets the action name</span></li>
    <li><span class="function"><a href="function.oci-set-client-info.php" class="function" rel="rdfs-seeAlso">oci_set_client_info()</a> - Sets the client information</span></li>
    <li><span class="function"><a href="function.oci-set-client-identifier.php" class="function" rel="rdfs-seeAlso">oci_set_client_identifier()</a> - Sets the client identifier</span></li>
    <li><span class="function"><a href="function.oci-set-db-operation.php" class="function" rel="rdfs-seeAlso">oci_set_db_operation()</a> - Sets the database operation</span></li>
   </ul>
  </p>
 </div>


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