php-doc-en/reference/mysqlnd_uh/mysqlnduhconnection/stmtinit.xml

124 lines
3.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mysqlnduhconnection.stmtinit" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MysqlndUhConnection::stmtInit</refname>
<refpurpose>Initializes a statement and returns a resource for use with mysqli_statement::prepare</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>resource</type><methodname>MysqlndUhConnection::stmtInit</methodname>
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
</methodsynopsis>
<para>
Initializes a statement and returns a resource for use with mysqli_statement::prepare.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
Mysqlnd connection handle. Do not modify!
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Resource of type <literal>Mysqlnd Prepared Statement (internal only - you must not modify it!)</literal>.
The documentation may also refer to such resources using the alias name
<literal>mysqlnd_prepared_statement</literal>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>MysqlndUhConnection::stmtInit</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
class proxy extends MysqlndUhConnection {
public function stmtInit($res) {
printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
var_dump($res);
$ret = parent::stmtInit($res);
printf("%s returns %s\n", __METHOD__, var_export($ret, true));
var_dump($ret);
return $ret;
}
}
mysqlnd_uh_set_connection_proxy(new proxy());
$mysqli = new mysqli("localhost", "root", "", "test");
$stmt = $mysqli->prepare("SELECT 1 AS _one FROM DUAL");
$stmt->execute();
$one = NULL;
$stmt->bind_result($one);
$stmt->fetch();
var_dump($one);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
proxy::stmtInit(array (
0 => NULL,
))
resource(19) of type (Mysqlnd Connection)
proxy::stmtInit returns NULL
resource(246) of type (Mysqlnd Prepared Statement (internal only - you must not modify it!))
int(1)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member>
<function>mysqlnd_uh_set_connection_proxy</function>
</member>
<member>
<function>mysqli_stmt_init</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
-->