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

256 lines
13 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>Returns the CUBRID database parameters</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.cubrid-get-db-parameter" class="refentry">
<div class="refnamediv">
<h1 class="refname">cubrid_get_db_parameter</h1>
<p class="verinfo">(PECL CUBRID &gt;= 8.3.0)</p><p class="refpurpose"><span class="refname">cubrid_get_db_parameter</span> &mdash; <span class="dc-title">Returns the CUBRID database parameters</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.cubrid-get-db-parameter-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>cubrid_get_db_parameter</strong></span>
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$conn_identifier</code></span>
) : <span class="type">array</span></div>
<p class="para rdfs-comment">
This function returns the CUBRID database parameters or it returns FALSE on
failure. It returns an associative array with the values for the following
parameters:
</p>
<p class="para">
<ul class="simplelist">
<li class="member"><strong><code>PARAM_ISOLATION_LEVEL</code></strong></li>
<li class="member"><strong><code>PARAM_LOCK_TIMEOUT</code></strong></li>
<li class="member"><strong><code>PARAM_MAX_STRING_LENGTH</code></strong></li>
<li class="member"><strong><code>PARAM_AUTO_COMMIT</code></strong></li>
</ul>
</p>
<p class="para">
<table class="doctable table">
<caption><strong>Database parameters</strong></caption>
<thead>
<tr>
<th>Parameter</th>
<th>Description</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>PARAM_ISOLATION_LEVEL</td>
<td>The transaction isolation level.</td>
</tr>
<tr>
<td>LOCK_TIMEOUT</td>
<td>CUBRID provides the lock timeout feature, which sets the waiting
time (in seconds) for the lock until the transaction lock setting is
allowed. The default value of the lock_timeout_in_secs parameter is
-1, which means the application client will wait indefinitely until
the transaction lock is allowed.
</td>
</tr>
<tr>
<td>PARAM_AUTO_COMMIT</td>
<td>In CUBRID PHP, auto-commit mode is disabled by default for
transaction management. It can be set by using
<span class="function"><a href="cubrid_set_autocommit.html" class="function">cubrid_set_autocommit()</a></span>.
</td>
</tr>
</tbody>
</table>
</p>
<p class="para">
The following table shows the isolation levels from 1 to 6. It consists of
table schema (row) and isolation level:
<table class="doctable table">
<caption><strong>Levels of Isolation Supported by CUBRID</strong></caption>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>SERIALIZABLE (6)</td>
<td>In this isolation level, problems concerning concurrency (e.g.
dirty read, non-repeatable read, phantom read, etc.) do not
occur.</td>
</tr>
<tr>
<td>REPEATABLE READ CLASS with REPEATABLE READ INSTANCES (5)</td>
<td>Another transaction T2 cannot update the schema of table A while
transaction T1 is viewing table A.
Transaction T1 may experience phantom read for the record R that was
inserted by another transaction T2 when it is repeatedly retrieving a
specific record.</td>
</tr>
<tr>
<td>REPEATABLE READ CLASS with READ COMMITTED INSTANCES (or CURSOR STABILITY) (4)</td>
<td>Another transaction T2 cannot update the schema of table A while
transaction T1 is viewing table A.
Transaction T1 may experience R read (non-repeatable read) that was
updated and committed by another transaction T2 when it is repeatedly
retrieving the record R.</td>
</tr>
<tr>
<td>REPEATABLE READ CLASS with READ UNCOMMITTED INSTANCES (3)</td>
<td>Default isolation level. Another transaction T2 cannot update
the schema of table A while transaction T1 is viewing table A.
Transaction T1 may experience R&#039; read (dirty read) for the record that
was updated but not committed by another transaction T2.</td>
</tr>
<tr>
<td>READ COMMITTED CLASS with READ COMMITTED INSTANCES (2)</td>
<td>Transaction T1 may experience A&#039; read (non-repeatable read) for
the table that was updated and committed by another transaction T2
while it is viewing table A repeatedly. Transaction T1 may experience
R&#039; read (non-repeatable read) for the record that was updated and
committed by another transaction T2 while it is retrieving the record
R repeatedly.</td>
</tr>
<tr>
<td>READ COMMITTED CLASS with READ UNCOMMITTED INSTANCES (1)</td>
<td>Transaction T1 may experience A&#039; read (non-repeatable read) for
the table that was updated and committed by another transaction T2
while it is repeatedly viewing table A. Transaction T1 may experience
R&#039; read (dirty read) for the record that was updated but not committed
by another transaction T2.</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.cubrid-get-db-parameter-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">conn_identifier</code></dt>
<dd>
<p class="para">
The CUBRID connection. If the connection identifier is not specified,
the last link opened by <span class="function"><a href="cubrid_connect.html" class="function">cubrid_connect()</a></span> is assumed.
</p></dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.cubrid-get-db-parameter-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
An associative array with CUBRID database parameters; on success.
</p>
<p class="para">
<strong><code>FALSE</code></strong> on failure.
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.cubrid-get-db-parameter-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>8.4.0</td>
<td>
Change LOCK_TIMEOUT to PARAM_LOCK_TIMEOUT, and MAX_STRING_LENGTH to
PARAM_MAX_STRING_LENGTH in result.
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.cubrid-get-db-parameter-examples">
<h3 class="title">范例</h3>
<div class="example" id="example-1113">
<p><strong>Example #1 <span class="function"><strong>cubrid_get_db_parameter()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%-30s&nbsp;%s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"CUBRID&nbsp;PHP&nbsp;Version:"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">cubrid_version</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"\n"</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">33088</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"demodb"</span><span style="color: #007700">);<br /><br />if&nbsp;(!</span><span style="color: #0000BB">$conn</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;die(</span><span style="color: #DD0000">'Connect&nbsp;Error&nbsp;('</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">cubrid_error_code</span><span style="color: #007700">()&nbsp;.</span><span style="color: #DD0000">')'&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">cubrid_error_msg</span><span style="color: #007700">());<br />}<br /><br /></span><span style="color: #0000BB">$db_params&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_get_db_parameter</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /><br />while&nbsp;(list(</span><span style="color: #0000BB">$param_name</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$param_value</span><span style="color: #007700">)&nbsp;=&nbsp;</span><span style="color: #0000BB">each</span><span style="color: #007700">(</span><span style="color: #0000BB">$db_params</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%-30s&nbsp;%s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$param_name</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$param_value</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$server_info&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_get_server_info</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client_info&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_get_client_info</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%-30s&nbsp;%s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Server&nbsp;Info:"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$server_info</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%-30s&nbsp;%s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Client&nbsp;Info:"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$client_info</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$charset&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_get_charset</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"%-30s&nbsp;%s\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"CUBRID&nbsp;Charset:"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$charset</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_disconnect</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</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>
CUBRID PHP Version: 9.1.0.0001
PARAM_ISOLATION_LEVEL 3
LOCK_TIMEOUT -1
MAX_STRING_LENGTH 1073741823
PARAM_AUTO_COMMIT 1
Server Info: 9.1.0.0212
Client Info: 9.1.0
CUBRID Charset: iso8859-1
</pre></div>
</div>
</div>
</div>
<div class="refsect1 seealso" id="refsect1-function.cubrid-get-db-parameter-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="cubrid_set_db_parameter.html" class="function" rel="rdfs-seeAlso">cubrid_set_db_parameter()</a> - Sets the CUBRID database parameters</span></li>
<li class="member"><span class="function"><a href="cubrid_get_autocommit.html" class="function" rel="rdfs-seeAlso">cubrid_get_autocommit()</a> - Get auto-commit mode of the connection</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>