2004-02-10 05:15:16 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2004-02-22 21:46:41 +00:00
|
|
|
<!-- $Revision: 1.3 $ -->
|
2004-02-10 05:15:16 +00:00
|
|
|
<refentry id="function.mysqli-report">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>mysqli_report</refname>
|
2004-02-20 14:45:50 +00:00
|
|
|
<refpurpose>enables or disables internal report functions</refpurpose>
|
2004-02-10 05:15:16 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>mysqli_report</methodname>
|
|
|
|
<methodparam><type>int</type><parameter>flags</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
2004-02-20 14:45:50 +00:00
|
|
|
<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");
|
2004-02-10 05:15:16 +00:00
|
|
|
|
2004-02-20 14:45:50 +00:00
|
|
|
/* this should report index warning */
|
|
|
|
$mysqli->query("UPDATE report SET a=a+1 WHERE b=3");
|
2004-02-10 05:15:16 +00:00
|
|
|
|
2004-02-20 14:45:50 +00:00
|
|
|
$mysqli->close();
|
|
|
|
?>
|
2004-02-22 21:46:41 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
<example>
|
|
|
|
<title>Object oriented style</title>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
$link = mysqli_connect("localhost", "my_user", "my_password", "test");
|
|
|
|
|
|
|
|
mysqli_report(MYSQLI_REPORT_ALL);
|
|
|
|
|
|
|
|
mysqli_query($link, "DROP TABLE IF EXISTS report");
|
|
|
|
mysqli_query($link, "CREATE TABLE report (a int, b int, index(a))");
|
|
|
|
|
|
|
|
mysqli_query($link, "INSERT INTO report VALUES (1,1), (2,2), (1,3), (2,4), (6,5)");
|
|
|
|
|
|
|
|
/* this should report syntax error */
|
|
|
|
mysqli_query($link, "UPDAE report SET a=a+1 WHERE b=3");
|
|
|
|
|
|
|
|
/* this should report index warning */
|
|
|
|
mysqli_query($link, "UPDATE report SET a=a+1 WHERE b=3");
|
|
|
|
|
|
|
|
mysqli_close($link);
|
|
|
|
?>
|
2004-02-20 14:45:50 +00:00
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2004-02-10 05:15:16 +00:00
|
|
|
</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
|
|
|
|
-->
|