mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-19 10:28:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@190589 c90b9560-bf6c-de11-be94-00142212c4b1
128 lines
3.6 KiB
XML
128 lines
3.6 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.3 $ -->
|
|
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc. -->
|
|
<refentry id="function.db2-conn-error">
|
|
<refnamediv>
|
|
<refname>db2_conn_error</refname>
|
|
<refpurpose>
|
|
Returns a string containing the SQLSTATE returned by the last connection attempt
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>string</type><methodname>db2_conn_error</methodname>
|
|
<methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam>
|
|
</methodsynopsis>
|
|
|
|
|
|
<para>
|
|
<function>db2_conn_error</function> returns an SQLSTATE value representing
|
|
the reason the last attempt to connect to a database failed. As
|
|
<function>db2_connect</function> returns &false; in the event of a failed
|
|
connection attempt, you do not pass any parameters to
|
|
<function>db2_conn_error</function> to retrieve the SQLSTATE value.
|
|
</para>
|
|
<para>
|
|
If, however, the connection was successful but becomes invalid over time,
|
|
you can pass the <parameter>connection</parameter> parameter to retrieve
|
|
the SQLSTATE value for a specific connection.
|
|
</para>
|
|
<para>
|
|
To learn what the SQLSTATE value means, you can issue the following command
|
|
at a DB2 Command Line Processor prompt:
|
|
<userinput>db2 '? <parameter>sqlstate-value</parameter>'</userinput>. You
|
|
can also call <function>db2_conn_errormsg</function> to retrieve an
|
|
explicit error message and the associated SQLCODE value.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
A connection resource associated with a connection that initially
|
|
succeeded, but which over time became invalid.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns the SQLSTATE value resulting from a failed connection attempt.
|
|
Returns an empty string if there is no error associated with the last
|
|
connection attempt.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Retrieving an SQLSTATE value for a failed connection attempt</title>
|
|
<para>
|
|
The following example demonstrates how to return an SQLSTATE value
|
|
after deliberately passing invalid parameters to
|
|
<function>db2_connect</function>.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$conn = db2_connect('badname', 'baduser', 'badpassword');
|
|
if (!$conn) {
|
|
print "SQLSTATE value: " . db2_conn_error();
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
SQLSTATE value: 08001
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>db2_conn_errormsg</function></member>
|
|
<member><function>db2_connect</function></member>
|
|
<member><function>db2_stmt_error</function></member>
|
|
<member><function>db2_stmt_errormsg</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:"../../../../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
|
|
-->
|