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

87 lines
5.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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-end-copy" class="refentry">
<div class="refnamediv">
<h1 class="refname">pg_end_copy</h1>
<p class="verinfo">(PHP 4 &gt;= 4.0.3, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">pg_end_copy</span> &mdash; <span class="dc-title">与 PostgreSQL 后端同步</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.pg-end-copy-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>pg_end_copy</strong></span>
([ <span class="methodparam"><span class="type">resource</span> <code class="parameter">$connection</code></span>
] ) : <span class="type">bool</span></div>
<p class="para rdfs-comment">
<span class="function"><strong>pg_end_copy()</strong></span> 在处理完 <span class="function"><a href="pg_put_line.html" class="function">pg_put_line()</a></span> 所执行的拷贝操作之后将 PostgreSQL 前端(通常为 web server 进程)与 PostgreSQL 服务器进行同步。<span class="function"><strong>pg_end_copy()</strong></span> 必须被调用,否则 PostgreSQL 服务器可能会和前端失去同步并报错。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.pg-end-copy-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">connection</code></dt>
<dd>
<p class="para">
PostgreSQL database connection resource. When
<code class="parameter">connection</code> is not present, the default connection
is used. The default connection is the last connection made by
<span class="function"><a href="pg_connect.html" class="function">pg_connect()</a></span> or <span class="function"><a href="pg_pconnect.html" class="function">pg_pconnect()</a></span>.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.pg-end-copy-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.pg-end-copy-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-2483">
<p><strong>Example #1 <span class="function"><strong>pg_end_copy()</strong></span> 例子</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;<br />&nbsp;&nbsp;$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">pg_pconnect</span><span style="color: #007700">(</span><span style="color: #DD0000">"dbname=foo"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"create&nbsp;table&nbsp;bar&nbsp;(a&nbsp;int4,&nbsp;b&nbsp;char(16),&nbsp;d&nbsp;float8)"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">pg_query</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"copy&nbsp;bar&nbsp;from&nbsp;stdin"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">pg_put_line</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"3\thello&nbsp;world\t4.5\n"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">pg_put_line</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"4\tgoodbye&nbsp;world\t7.11\n"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">pg_put_line</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\.\n"</span><span style="color: #007700">);<br />&nbsp;&nbsp;</span><span style="color: #0000BB">pg_end_copy</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.pg-end-copy-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="pg_put_line.html" class="function" rel="rdfs-seeAlso">pg_put_line()</a> - 向 PostgreSQL 后端发送以 NULL 结尾的字符串</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>