mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-24 04:48:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@321919 c90b9560-bf6c-de11-be94-00142212c4b1
156 lines
4.3 KiB
XML
156 lines
4.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="mysqlnduhconnection.close" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>MysqlndUhConnection::close</refname>
|
|
<refpurpose>Closes a previously opened database connection</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>bool</type><methodname>MysqlndUhConnection::close</methodname>
|
|
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
|
|
<methodparam><type>int</type><parameter>close_type</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
Closes a previously opened database connection.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
Failing to call the parent implementation may cause memory leaks or
|
|
crash PHP. This is not considered a bug. Please, keep in mind that
|
|
the <literal>mysqlnd</literal> library functions have never been designed
|
|
to be exposed to the user space.
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>connection</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The connection to be closed. Do not modify!
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>close_type</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Why the connection is to be closed. The value
|
|
of <parameter>close_type</parameter> is one of
|
|
<constant>MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT</constant>,
|
|
<constant>MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT</constant>,
|
|
<constant>MYSQLND_UH_MYSQLND_CLOSE_DISCONNECTED</constant> or
|
|
<constant>MYSQLND_UH_MYSQLND_CLOSE_LAST</constant>. The
|
|
latter should never be seen, unless the default
|
|
behaviour of the <literal>mysqlnd</literal> library
|
|
has been changed by a plugin.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns &true; on success.
|
|
Otherwise, returns &false;
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><function>MysqlndUhConnection::close</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
function close_type_to_string($close_type) {
|
|
$mapping = array(
|
|
MYSQLND_UH_MYSQLND_CLOSE_DISCONNECTED => "MYSQLND_UH_MYSQLND_CLOSE_DISCONNECTED",
|
|
MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT => "MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT",
|
|
MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT => "MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT",
|
|
MYSQLND_UH_MYSQLND_CLOSE_LAST => "MYSQLND_UH_MYSQLND_CLOSE_IMPLICIT"
|
|
);
|
|
return (isset($mapping[$close_type])) ? $mapping[$close_type] : 'unknown';
|
|
}
|
|
|
|
class proxy extends MysqlndUhConnection {
|
|
public function close($res, $close_type) {
|
|
printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
|
|
printf("close_type = %s\n", close_type_to_string($close_type));
|
|
/* WARNING: you must call the parent */
|
|
$ret = parent::close($res, $close_type);
|
|
printf("%s returns %s\n", __METHOD__, var_export($ret, true));
|
|
return $ret;
|
|
}
|
|
}
|
|
mysqlnd_uh_set_connection_proxy(new proxy());
|
|
|
|
$mysqli = new mysqli("localhost", "root", "", "test");
|
|
$mysqli->close();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen>
|
|
<![CDATA[
|
|
proxy::close(array (
|
|
0 => NULL,
|
|
1 => 0,
|
|
))
|
|
close_type = MYSQLND_UH_MYSQLND_CLOSE_EXPLICIT
|
|
proxy::close returns true
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member>
|
|
<function>mysqlnd_uh_set_connection_proxy</function>
|
|
</member>
|
|
<member>
|
|
<function>mysqli_close</function>
|
|
</member>
|
|
<member>
|
|
<function>mysql_close</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
|
|
-->
|