mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-29 04:52:50 +08:00
158 lines
6.3 KiB
HTML
158 lines
6.3 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>返回 PostgreSQL 服务器最新一条公告信息</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.pg-last-notice" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">pg_last_notice</h1>
|
||
<p class="verinfo">(PHP 4 >= 4.0.6, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">pg_last_notice</span> — <span class="dc-title">
|
||
返回 PostgreSQL 服务器最新一条公告信息
|
||
</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.pg-last-notice-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>pg_last_notice</strong></span>
|
||
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$connection</code></span>
|
||
) : <span class="type">string</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
<span class="function"><strong>pg_last_notice()</strong></span>
|
||
返回由 <code class="parameter">connection</code>
|
||
指定的 PostgreSQL 服务器最新的一条公告信息。PostgreSQL
|
||
服务器在某些情况下会发送公告信息,例如在表里创建 <em>SERIAL</em> 列。
|
||
</p>
|
||
<p class="para">
|
||
有了
|
||
<span class="function"><strong>pg_last_notice()</strong></span>,只要检查公告是否和该事务有关,就可以避免提交无用的查询。
|
||
</p>
|
||
<p class="para">
|
||
可以通过在 <var class="filename">php.ini</var> 中把
|
||
<em>pgsql.ignore_notice</em> 置为 1 来使公告信息追踪成为可选项。
|
||
</p>
|
||
<p class="para">
|
||
可以通过在 <var class="filename">php.ini</var> 中把
|
||
<em>pgsql.log_notice</em> 置为 0 来使公告信息日志成为可选项。
|
||
除非 <em>pgsql.ignore_notice</em> 为 0,否则公告信息不能被日志记录。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.pg-last-notice-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">connection</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
PostgreSQL database connection resource.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.pg-last-notice-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
A <span class="type"><a href="language.types.string.html" class="type string">string</a></span> containing the last notice on the
|
||
given <code class="parameter">connection</code>, or <strong><code>FALSE</code></strong> on error.
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 changelog" id="refsect1-function.pg-last-notice-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>4.3.0</td>
|
||
<td>
|
||
本函数在 PHP 4.3.0 中完全实现。低于 PHP 4.3.0 的版本中都忽略了数据库连接参数。
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td>4.3.0</td>
|
||
<td>
|
||
The <em>pgsql.ignore_notice</em> and
|
||
<em>pgsql.log_notice</em> <var class="filename">php.ini</var> directives were added.
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td>4.0.6</td>
|
||
<td>
|
||
PHP 4.0.6
|
||
本身在公告信息处理上有问题。即使不使用
|
||
<span class="function"><strong>pg_last_notice()</strong></span> 函数,也不推荐在 PHP 4.0.6
|
||
中使用 PostgreSQL 模块。
|
||
</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.pg-last-notice-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="example-2501">
|
||
<p><strong>Example #1 <span class="function"><strong>pg_last_notice()</strong></span> example</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /> $pgsql_conn </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=mark host=localhost"</span><span style="color: #007700">);<br /> <br /> </span><span style="color: #0000BB">$res </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #DD0000">"CREATE TABLE test (id SERIAL)"</span><span style="color: #007700">);<br /> <br /> </span><span style="color: #0000BB">$notice </span><span style="color: #007700">= </span><span style="color: #0000BB">pg_last_notice</span><span style="color: #007700">(</span><span style="color: #0000BB">$pgsql_conn</span><span style="color: #007700">);<br /> <br /> echo </span><span style="color: #0000BB">$notice</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
<div class="example-contents"><p>以上例程会输出:</p></div>
|
||
<div class="example-contents screen">
|
||
<div class="cdata"><pre>
|
||
CREATE TABLE will create implicit sequence "test_id_seq" for "serial" column "test.id"
|
||
</pre></div>
|
||
</div>
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.pg-last-notice-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="pg_query.html" class="function" rel="rdfs-seeAlso">pg_query()</a> - 执行查询</span></li>
|
||
<li class="member"><span class="function"><a href="pg_last_error.html" class="function" rel="rdfs-seeAlso">pg_last_error()</a> - 得到某连接的最后一条错误信息</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
</div></div></div></body></html> |