2011-10-07 12:56:30 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
|
|
|
|
<refentry xml:id="mysqlnduhconnection.getfieldcount" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>MysqlndUhConnection::getFieldCount</refname>
|
|
|
|
<refpurpose>Returns the number of columns for the most recent query</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
2012-01-08 08:12:39 +00:00
|
|
|
<modifier>public</modifier> <type>int</type><methodname>MysqlndUhConnection::getFieldCount</methodname>
|
2011-10-07 12:56:30 +00:00
|
|
|
<methodparam><type>mysqlnd_connection</type><parameter>connection</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
|
|
|
Returns the number of columns for the most recent query.
|
|
|
|
</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>
|
|
|
|
Number of columns.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
|
|
|
<function>MysqlndUhConnection::getFieldCount</function> is not only executed
|
|
|
|
after the invocation of a user space API call which maps directly to it but also
|
|
|
|
called internally.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title><function>MysqlndUhConnection::getFieldCount</function> example</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
class proxy extends MysqlndUhConnection {
|
|
|
|
public function getFieldCount($res) {
|
|
|
|
printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
|
|
|
|
$ret = parent::getFieldCount($res);
|
|
|
|
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->query("WILL_I_EVER_LEARN_SQL?");
|
|
|
|
var_dump($mysqli->field_count);
|
|
|
|
$mysqli->query("SELECT 1, 2, 3 FROM DUAL");
|
|
|
|
var_dump($mysqli->field_count);
|
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
&example.outputs;
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
proxy::getFieldCount(array (
|
|
|
|
0 => NULL,
|
|
|
|
))
|
|
|
|
proxy::getFieldCount returns 0
|
|
|
|
int(0)
|
|
|
|
proxy::getFieldCount(array (
|
|
|
|
0 => NULL,
|
|
|
|
))
|
|
|
|
proxy::getFieldCount returns 3
|
|
|
|
proxy::getFieldCount(array (
|
|
|
|
0 => NULL,
|
|
|
|
))
|
|
|
|
proxy::getFieldCount returns 3
|
|
|
|
int(3)
|
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
</example>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
|
|
|
<member>
|
|
|
|
<function>mysqlnd_uh_set_connection_proxy</function>
|
|
|
|
</member>
|
|
|
|
<member>
|
|
|
|
<function>mysqli_field_count</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
|
|
|
|
-->
|