mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-26 13:58:55 +00:00
130 lines
3.5 KiB
XML
130 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.82 -->
|
|
<refentry xml:id="function.pg-result-error" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_result_error</refname>
|
|
<refpurpose>
|
|
Get error message associated with result
|
|
</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type class="union"><type>string</type><type>false</type></type><methodname>pg_result_error</methodname>
|
|
<methodparam><type>PgSql\Result</type><parameter>result</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_result_error</function> returns any error message
|
|
associated with the <parameter>result</parameter> instance. Therefore,
|
|
the user has a better chance of getting the correct error message than
|
|
with <function>pg_last_error</function>.
|
|
</para>
|
|
<para>
|
|
The function <function>pg_result_error_field</function> can give much greater
|
|
detail on result errors than <function>pg_result_error</function>.
|
|
</para>
|
|
<para>
|
|
Because <function>pg_query</function> returns &false; if the query fails,
|
|
you must use <function>pg_send_query</function> and
|
|
<function>pg_get_result</function> to get the result handle.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>result</parameter></term>
|
|
<listitem>
|
|
&pgsql.parameter.result;
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns a <type>string</type>. Returns empty string if there is no error. If there is an error associated with the
|
|
<parameter>result</parameter> parameter, returns &false;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&pgsql.changelog.result-object;
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>pg_result_error</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
|
|
|
|
if (!pg_connection_busy($dbconn)) {
|
|
pg_send_query($dbconn, "select * from doesnotexist;");
|
|
}
|
|
|
|
$res1 = pg_get_result($dbconn);
|
|
echo pg_result_error($res1);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_result_error_field</function></member>
|
|
<member><function>pg_query</function></member>
|
|
<member><function>pg_send_query</function></member>
|
|
<member><function>pg_get_result</function></member>
|
|
<member><function>pg_last_error</function></member>
|
|
<member><function>pg_last_notice</function></member>
|
|
</simplelist>
|
|
</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:"~/.phpdoc/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
|
|
-->
|