georg Fri Feb 20 09:45:50 2004 EDT
Modified files:
/phpdoc/en/reference/mysqli/functions mysqli-debug.xml
mysqli-errno.xml
mysqli-error.xml
mysqli-get-metadata.xml
mysqli-report.xml
Log:
added documentation for mysqli_get_metadata and mysqli_report
added samples
http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-debug.xml?r1=1.6&r2=1.7&ty=u
Index: phpdoc/en/reference/mysqli/functions/mysqli-debug.xml
diff -u phpdoc/en/reference/mysqli/functions/mysqli-debug.xml:1.6
phpdoc/en/reference/mysqli/functions/mysqli-debug.xml:1.7
--- phpdoc/en/reference/mysqli/functions/mysqli-debug.xml:1.6 Fri Feb 20 08:05:10
2004
+++ phpdoc/en/reference/mysqli/functions/mysqli-debug.xml Fri Feb 20 09:45:50
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
<refentry id="function.mysqli-debug">
<refnamediv>
<refname>mysqli_debug</refname>
@@ -28,6 +28,13 @@
<para><function>mysqli_debug</function> doesn't return any value.</para>
</refsect1>
<refsect1>
+ <title>See also</title>
+ <para>
+ <function>mysqli_dump_debug_info</function>,
+ <function>mysqli_report</function>
+ </para>
+ </refsect1>
+ <refsect1>
<title>Example</title>
<para>
<example>
@@ -45,12 +52,6 @@
</example>
</para>
</refsect1>
- <refsect1>
- <title>See also</title>
- <para>
- <function>mysqli_dump_debug_info</function>
- </para>
- </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-errno.xml?r1=1.6&r2=1.7&ty=u
Index: phpdoc/en/reference/mysqli/functions/mysqli-errno.xml
diff -u phpdoc/en/reference/mysqli/functions/mysqli-errno.xml:1.6
phpdoc/en/reference/mysqli/functions/mysqli-errno.xml:1.7
--- phpdoc/en/reference/mysqli/functions/mysqli-errno.xml:1.6 Wed Jan 28 18:18:42
2004
+++ phpdoc/en/reference/mysqli/functions/mysqli-errno.xml Fri Feb 20 09:45:50
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.6 $ -->
+<!-- $Revision: 1.7 $ -->
<refentry id="function.mysqli-errno">
<refnamediv>
<refname>mysqli_errno</refname>
@@ -42,9 +42,47 @@
<refsect1>
<title>See also</title>
<para>
- <function>mysqli_error</function>, <function>mysqli_sqlstate</function>
+ <function>mysqli_connect_errno</function>,
+ <function>mysqli_connect_error</function>,
+ <function>mysqli_error</function>,
+ <function>mysqli_sqlstate</function>
</para>
</refsect1>
+ <refsect1>
+ <title>Example</title>
+ <para>
+ <example>
+ <title>Object oriented style</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
+
+if (!$mysqli->query("SET a=1")) {
+ printf("Errorcode: %d\n", $mysqli->errno);
+}
+$mysqli->close();
+?>
+]]>
+ </programlisting>
+ </example>
+ <example>
+ <title>Procedural style</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$link = mysqli_connect("localhost", "my_user", "my_password", "test");
+
+if (!mysqli_query($link, "SET a=1")) {
+ printf("Errorcode: %d\n", mysqli_errno($link));
+}
+mysqli_close($link);
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-error.xml?r1=1.8&r2=1.9&ty=u
Index: phpdoc/en/reference/mysqli/functions/mysqli-error.xml
diff -u phpdoc/en/reference/mysqli/functions/mysqli-error.xml:1.8
phpdoc/en/reference/mysqli/functions/mysqli-error.xml:1.9
--- phpdoc/en/reference/mysqli/functions/mysqli-error.xml:1.8 Wed Jan 28 18:18:42
2004
+++ phpdoc/en/reference/mysqli/functions/mysqli-error.xml Fri Feb 20 09:45:50
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
<refentry id="function.mysqli-error">
<refnamediv>
<refname>mysqli_error</refname>
@@ -33,31 +33,49 @@
</para>
</refsect1>
<refsect1>
+ <title>See also</title>
+ <para>
+ <function>mysqli_connect_errno</function>,
+ <function>mysqli_connect_error</function>,
+ <function>mysqli_errno</function>,
+ <function>mysqli_sqlstate</function>
+ </para>
+ </refsect1>
+ <refsect1>
<title>Example</title>
<para>
<example>
- <title>Using the mysqli_error function</title>
+ <title>Object oriented style</title>
<programlisting role="php">
<![CDATA[
<?php
-
- /* Fail to open a connection */
- $host = "no_such_host";
- $link = mysqli_connect($host, "username", "password") or
- die("Couldn't connect : " . mysqli_error());
-
+$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
+
+if (!$mysqli->query("SET a=1")) {
+ printf("Errorcode: %d\n", $mysqli->error);
+}
+$mysqli->close();
+?>
+]]>
+ </programlisting>
+ </example>
+ <example>
+ <title>Procedural style</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+$link = mysqli_connect("localhost", "my_user", "my_password", "test");
+
+if (!mysqli_query($link, "SET a=1")) {
+ printf("Errorcode: %s\n", mysqli_error($link));
+}
+mysqli_close($link);
?>
]]>
</programlisting>
</example>
</para>
- </refsect1>
- <refsect1>
- <title>See also</title>
- <para>
- <function>mysqli_errno</function>, <function>mysqli_sqlstate</function>.
- </para>
- </refsect1>
+ </refsect1>
</refentry>
<!-- Keep this comment at the end of the file
http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-get-metadata.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/mysqli/functions/mysqli-get-metadata.xml
diff -u phpdoc/en/reference/mysqli/functions/mysqli-get-metadata.xml:1.1
phpdoc/en/reference/mysqli/functions/mysqli-get-metadata.xml:1.2
--- phpdoc/en/reference/mysqli/functions/mysqli-get-metadata.xml:1.1 Sun Feb 8
08:14:42 2004
+++ phpdoc/en/reference/mysqli/functions/mysqli-get-metadata.xml Fri Feb 20
09:45:50 2004
@@ -1,19 +1,72 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<refentry id="function.mysqli-get-metadata">
<refnamediv>
<refname>mysqli_get_metadata</refname>
- <refpurpose>Retrieves a resultset from a prepared statement for metadata
information.</refpurpose>
+ <refpurpose></refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
+ <para>Procedural style:</para>
+ <methodsynopsis>
+ <type>mixed</type><methodname>mysqli_get_metadata</methodname>
+ <methodparam><type>object</type><parameter>stmt</parameter></methodparam>
+ </methodsynopsis>
+ <para>Object oriented style (method):</para>
+ <classsynopsis>
+ <ooclass><classname>stmt</classname></ooclass>
<methodsynopsis>
- <type>string</type><methodname>mysqli_get_metadata</methodname>
- <methodparam><type>object</type><parameter>stmt</parameter></methodparam>
+ <type>mixed</type>
+ <methodname>get_metadata</methodname>
+ <methodparam><type>void</type><parameter></parameter></methodparam>
</methodsynopsis>
-
- &warn.undocumented.func;
-
+ </classsynopsis>
+ <para>
+ If a statement passed to <function>mysqli_prepare</function> is one that produces
+ a result set, <function>mysqli_get_metadata</function> returns the result object
+ that can be used to process the meta information such as total number of fields
+ and individual field information.
+ </para>
+ <note>
+ <para>This result set pointer can be passed as an argument to any of the
+ field-based functions that process result set metadata, such as:
+ <itemizedlist>
+ <listitem><para><function>mysqli_num_fields</function></para></listitem>
+ <listitem><para><function>mysqli_fetch_field</function></para></listitem>
+
<listitem><para><function>mysqli_fetch_field_direct</function></para></listitem>
+ <listitem><para><function>mysqli_fetch_fields</function></para></listitem>
+ <listitem><para><function>mysqli_field_count</function></para></listitem>
+ <listitem><para><function>mysqli_field_seek</function></para></listitem>
+ <listitem><para><function>mysqli_field_tell</function></para></listitem>
+ <listitem><para><function>mysqli_free_result</function></para></listitem>
+ </itemizedlist>
+ </para>
+ </note>
+ <para>
+ The result set structure should be freed when you are done with it,
+ which you can do by passing it to <function>mysqli_free_result</function>
+ </para>
+ <note>
+ <para>
+ The result set returned by <function>mysqli_get_metadata</function> contains
only
+ metadata. It does not contain any row results. The rows are obtained by using
the
+ statement handle with <function>mysqli_fetch</function>.
+ </para>
+ </note>
+ </refsect1>
+ <refsect1>
+ &reftitle.returnvalues;
+ <para>
+ <function>mysqli_get_metadata</function> returns a result object or &false; if
+ an error occured.
+ </para>
+ </refsect1>
+ <refsect1>
+ <title>See also:</title>
+ <para>
+ <function>mysqli_prepare</function>,
+ <function>mysqli_free_result</function>
+ </para>
</refsect1>
</refentry>
http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-report.xml?r1=1.1&r2=1.2&ty=u
Index: phpdoc/en/reference/mysqli/functions/mysqli-report.xml
diff -u phpdoc/en/reference/mysqli/functions/mysqli-report.xml:1.1
phpdoc/en/reference/mysqli/functions/mysqli-report.xml:1.2
--- phpdoc/en/reference/mysqli/functions/mysqli-report.xml:1.1 Tue Feb 10 00:15:16
2004
+++ phpdoc/en/reference/mysqli/functions/mysqli-report.xml Fri Feb 20 09:45:50
2004
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<refentry id="function.mysqli-report">
<refnamediv>
<refname>mysqli_report</refname>
- <refpurpose>Sets report level.</refpurpose>
+ <refpurpose>enables or disables internal report functions</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
@@ -11,9 +11,84 @@
<type>bool</type><methodname>mysqli_report</methodname>
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
</methodsynopsis>
+ <para>
+ <function>mysqli_report</function> is a powerful function to improve your queries
+ and code during development and testing phase. Depending on the flags it reports
+ errors from mysqli function calls or queries which don't use an index (or use a
bad
+ index).
+ </para>
+ <table>
+ <title>Supported flags</title>
+ <tgroup cols='2'>
+ <thead>
+ <row>
+ <entry>Name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry><literal>MYSQLI_REPORT_OFF</literal></entry>
+ <entry>Turns reporting off</entry>
+ </row>
+ <row>
+ <entry><literal>MYSQLI_REPORT_ERROR</literal></entry>
+ <entry>Report errors from mysqli function calls</entry>
+ </row>
+ <row>
+ <entry><literal>MYSQLI_REPORT_INDEX</literal></entry>
+ <entry>Report if no index or bad index was used in a query</entry>
+ </row>
+ <row>
+ <entry><literal>MYSQLI_REPORT_ALL</literal></entry>
+ <entry>Set all options (report all)</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </refsect1>
+ <refsect1>
+ <title>Return values</title>
+ <para>&return.success;</para>
+ </refsect1>
+ <refsect1>
+ <title>See also</title>
+ <para>
+ <function>mysqli_debug</function>,
+ <function>mysqli_dump_debug_info</function>
+ </para>
+ </refsect1>
+ <refsect1>
+ <title>Example</title>
+ <para>
+ <example>
+ <title>Object oriented style</title>
+ <programlisting role="php">
+<![CDATA[
+
+<?php
+
+$mysqli = new mysqli("localhost", "my_user", "my_password", "test");
+
+mysqli_report(MYSQLI_REPORT_ALL);
+
+$mysqli->query("DROP TABLE IF EXISTS report");
+$mysqli->query("CREATE TABLE report (a int, b int, index(a))");
+
+$mysqli->query("INSERT INTO report VALUES (1,1), (2,2), (1,3), (2,4), (6,5)");
+
+/* this should report syntax error */
+$mysqli->query("UPDAE report SET a=a+1 WHERE b=3");
- &warn.undocumented.func;
+/* this should report index warning */
+$mysqli->query("UPDATE report SET a=a+1 WHERE b=3");
+$mysqli->close();
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
</refsect1>
</refentry>
@@ -35,5 +110,4 @@
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
-vi: ts=1 sw=1
-->