mirror of
https://github.com/php/doc-pt_br.git
synced 2026-04-24 16:48:23 +02:00
60f9172f99
* inclusão dos arquivos originais com revisão atualizada * tradução em reference/pgsql/functions * removida tradução equivocada em tags * removida tradução indevida de tag * Delete reference/pgsql/functions/pg-connection-busy.old * Delete reference/pgsql/functions/pg-connection-reset.old * Delete reference/pgsql/functions/pg-convert.old * Delete reference/pgsql/functions/pg-fetch-assoc.old * Delete reference/pgsql/functions/pg-field-name.old * Delete reference/pgsql/functions/pg-meta-data.old * Delete reference/pgsql/functions/pg-send-query.old * Update pg-field-num.xml * Update pg-unescape-bytea.xml * Update pg-escape-bytea.xml * Update pg-convert.xml * Update pg-result-status.xml * Update pg-pconnect.xml * Update pg-parameter-status.xml * Update pg-set-client-encoding.xml * tradução de pg-affected-rows
133 lines
3.6 KiB
XML
133 lines
3.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: c2eca73ef79ebe78cebb34053e41b565af504c4f Maintainer: fernandowobeto Status: ready --><!-- CREDITS: fernandowobeto -->
|
|
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
|
|
<refentry xml:id="function.pg-last-error" xmlns="http://docbook.org/ns/docbook">
|
|
<refnamediv>
|
|
<refname>pg_last_error</refname>
|
|
<refpurpose>Obtém a última string da mensagem de erro de uma conexão</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>pg_last_error</methodname>
|
|
<methodparam choice="opt"><type class="union"><type>PgSql\Connection</type><type>null</type></type><parameter>connection</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>pg_last_error</function> retorna a última mensagem de erro
|
|
para uma determinada <parameter>connection</parameter>.
|
|
</para>
|
|
<para>
|
|
As mensagens de erro podem ser substituídas por chamadas de função internas do
|
|
PostgreSQL (libpq). Pode não retornar uma mensagem de erro apropriada se
|
|
ocorrerem vários erros dentro de uma função do módulo PostgreSQL.
|
|
</para>
|
|
<para>
|
|
Use <function>pg_result_error</function>, <function>pg_result_error_field</function>,
|
|
<function>pg_result_status</function> e
|
|
<function>pg_connection_status</function> para melhor tratamento de erros.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Esta função costumava ser chamada de <function>pg_errormessage</function>.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
&pgsql.parameter.connection-with-nullable-default;
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Uma <type>string</type> contendo a última mensagem de erro na
|
|
<parameter>connection</parameter> fornecida.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
&pgsql.changelog.connection-object;
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
<parameter>connection</parameter> agora é anulável.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Exemplo de <function>pg_last_error</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$dbconn = pg_connect("dbname=publisher") or die("Não foi possível conectar");
|
|
|
|
// Consulta que falha
|
|
$res = pg_query($dbconn, "select * from doesnotexist");
|
|
|
|
echo pg_last_error($dbconn);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>pg_result_error</function></member>
|
|
<member><function>pg_result_error_field</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
|
|
-->
|