uTools-Manuals/docs/php/cubrid_db_name.html
2019-04-08 23:22:26 +08:00

106 lines
5.5 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>Get db name from results of cubrid_list_dbs</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.cubrid-db-name" class="refentry">
<div class="refnamediv">
<h1 class="refname">cubrid_db_name</h1>
<p class="verinfo">(PECL CUBRID &gt;= 8.3.1)</p><p class="refpurpose"><span class="refname">cubrid_db_name</span> &mdash; <span class="dc-title">Get db name from results of cubrid_list_dbs</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.cubrid-db-name-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>cubrid_db_name</strong></span>
( <span class="methodparam"><span class="type">array</span> <code class="parameter">$result</code></span>
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$index</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
Retrieve the database name from a call to <span class="function"><a href="cubrid_list_dbs.html" class="function">cubrid_list_dbs()</a></span>.
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.cubrid-db-name-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">result</code></dt>
<dd>
<p class="para">
The result pointer from a call to <span class="function"><a href="cubrid_list_dbs.html" class="function">cubrid_list_dbs()</a></span>.
</p>
</dd>
<dt>
<code class="parameter">index</code></dt>
<dd>
<p class="para">
The index into the result set.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.cubrid-db-name-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
Returns the database name on success, and <strong><code>FALSE</code></strong> on failure. If <strong><code>FALSE</code></strong>
is returned, use <span class="function"><a href="cubrid_error.html" class="function">cubrid_error()</a></span> to determine the nature
of the error.
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.cubrid-db-name-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-1157">
<p><strong>Example #1 <span class="function"><strong>cubrid_db_name()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />error_reporting</span><span style="color: #007700">(</span><span style="color: #0000BB">E_ALL</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">33000</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'demodb'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'dba'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">''</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$db_list&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_list_dbs</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$cnt&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">count</span><span style="color: #007700">(</span><span style="color: #0000BB">$db_list</span><span style="color: #007700">);<br />while&nbsp;(</span><span style="color: #0000BB">$i&nbsp;</span><span style="color: #007700">&lt;&nbsp;</span><span style="color: #0000BB">$cnt</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">cubrid_db_name</span><span style="color: #007700">(</span><span style="color: #0000BB">$db_list</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$i</span><span style="color: #007700">++;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程会输出:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
demodb
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.cubrid-db-name-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="cubrid_list_dbs.html" class="function" rel="rdfs-seeAlso">cubrid_list_dbs()</a> - Return an array with the list of all existing CUBRID databases</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>