mirror of
https://github.com/php/doc-zh.git
synced 2026-03-26 16:12:19 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/zh/trunk@97440 c90b9560-bf6c-de11-be94-00142212c4b1
59 lines
2.5 KiB
XML
Executable File
59 lines
2.5 KiB
XML
Executable File
<?xml version="1.0" encoding="gb2312"?>
|
||
<!-- $Revision: 1.2 $ -->
|
||
<!-- $Author: dallas $ -->
|
||
<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready -->
|
||
<refentry id="function.pg-query">
|
||
<refnamediv>
|
||
<refname>pg_query</refname>
|
||
<refpurpose>执行查询</refpurpose>
|
||
</refnamediv>
|
||
<refsect1>
|
||
<title>说明</title>
|
||
<methodsynopsis>
|
||
<type>resource</type><methodname>pg_query</methodname>
|
||
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
|
||
<methodparam><type>string</type><parameter>query</parameter></methodparam>
|
||
</methodsynopsis>
|
||
<para>
|
||
<function>pg_query</function> 在查询可以执行时返回查询结果资源号。如果查询失败或者提供的连接号无效则返回 &false;。如果连接号有效,则可以用 <function>pg_last_error</function> 函数来提取详细的错误信息。<function>pg_last_error</function> 发送一条 SQL 语句到 <parameter>connection</parameter> 资源指定的 PostgreSQL 数据库。<parameter>connection</parameter> 必须是由 <function>pg_connect</function> 或 <function>pg_pconnect</function> 返回的合法连接号。本函数返回值是一个其它 PostgreSQL 函数例如 <function>pg_fetch_array</function> 可以用来访问查询结果的查询结果资源号。
|
||
<note>
|
||
<simpara>
|
||
<parameter>connection</parameter> 是 <function>pg_query</function> 中的可选参数。如果没有指定 <parameter>connection</parameter>,则使用默认连接。默认连接是 <function>pg_connect</function> 或 <function>pg_pconnect</function> 所打开的最后一个连接。
|
||
</simpara>
|
||
<simpara>
|
||
尽管 <parameter>connection</parameter> 参数可以省略,但不推荐这样做。因为这样可能会导致很难发现脚本中的错误。
|
||
</simpara>
|
||
</note>
|
||
</para>
|
||
<note>
|
||
<para>
|
||
本函数以前的名字为 <literal>pg_exec()</literal>。<literal>pg_exec()</literal> 函数为了兼容性的原因仍然可以使用,但是鼓励用户使用新的名字。
|
||
</para>
|
||
</note>
|
||
<para>
|
||
参见 <function>pg_connect</function>,<function>pg_pconnect</function>,<function>pg_fetch_array</function>,<function>pg_fetch_object</function>,<function>pg_num_rows</function> 和 <function>pg_affected_rows</function>。
|
||
</para>
|
||
</refsect1>
|
||
</refentry>
|
||
|
||
<!-- Keep this comment at the end of the file
|
||
Local variables:
|
||
mode: sgml
|
||
sgml-omittag:t
|
||
sgml-shorttag:t
|
||
sgml-minimize-attributes:nil
|
||
sgml-always-quote-attributes:t
|
||
sgml-indent-step:1
|
||
sgml-indent-data:t
|
||
indent-tabs-mode:nil
|
||
sgml-parent-document:nil
|
||
sgml-default-dtd-file:"../../../../manual.ced"
|
||
sgml-exposed-tags:nil
|
||
sgml-local-catalogs:nil
|
||
sgml-local-ecat-files:nil
|
||
End:
|
||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
vim: et tw=78 syn=sgml
|
||
vi: ts=1 sw=1
|
||
-->
|