georg Fri Feb 20 03:54:12 2004 EDT
Modified files: /phpdoc/en/reference/mysqli/functions mysqli-character-set-name.xml mysqli-client-encoding.xml mysqli-commit.xml mysqli-connect-errno.xml mysqli-connect-error.xml mysqli-rollback.xml Log: documented mysqli_connect_errno/error functions more samples added
http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-character-set-name.xml?r1=1.7&r2=1.8&ty=u Index: phpdoc/en/reference/mysqli/functions/mysqli-character-set-name.xml diff -u phpdoc/en/reference/mysqli/functions/mysqli-character-set-name.xml:1.7 phpdoc/en/reference/mysqli/functions/mysqli-character-set-name.xml:1.8 --- phpdoc/en/reference/mysqli/functions/mysqli-character-set-name.xml:1.7 Wed Jan 28 18:18:42 2004 +++ phpdoc/en/reference/mysqli/functions/mysqli-character-set-name.xml Fri Feb 20 03:54:11 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry id="function.mysqli-character-set-name"> <refnamediv> <refname>mysqli_character_set_name</refname> @@ -32,31 +32,50 @@ <para>The default character set for the current connection</para> </refsect1> <refsect1> + <title>See also</title> + <para> + <function>mysqli_client_encoding</function>. + <function>mysqli_real_escape_string</function>. + </para> + </refsect1> + <refsect1> <title>Example</title> <example> - <title>Using the mysqli_character_set_name function</title> + <title>Object oriented style</title> <programlisting role="php"> <![CDATA[ <?php - /* Open a connection */ - $link = mysqli_connect("localhost", "username", "password"); + $mysqli = new mysqli("localhost", "my_user", "my_password"); /* Print current character set */ - $charset = mysqli_character_set_name($link); - printf ("Current character set is %s\n",$charset); + $charset = $mysqli->character_set_name(); + printf ("Current character set is %s\n", $charset); + $mysqli->close(); ?> ]]> </programlisting> </example> - </refsect1> - <refsect1> - <title>See also</title> - <para> - <function>mysqli_real_escape_string</function>. - </para> - </refsect1> + <example> + <title>Procedural style</title> + <programlisting role="php"> +<![CDATA[ +<?php + /* Open a connection */ + $link = mysqli_connect("localhost", "my_user", "my_password"); + + /* Print current character set */ + $charset = mysqli_character_set_name($link); + printf ("Current character set is %s\n",$charset); + + /* close connection */ + mysqli_close($link); +?> +]]> + </programlisting> + </example> + </refsect1> </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-client-encoding.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc/en/reference/mysqli/functions/mysqli-client-encoding.xml diff -u phpdoc/en/reference/mysqli/functions/mysqli-client-encoding.xml:1.1 phpdoc/en/reference/mysqli/functions/mysqli-client-encoding.xml:1.2 --- phpdoc/en/reference/mysqli/functions/mysqli-client-encoding.xml:1.1 Sun Feb 8 08:14:42 2004 +++ phpdoc/en/reference/mysqli/functions/mysqli-client-encoding.xml Fri Feb 20 03:54:11 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.mysqli-client-encoding"> <refnamediv> <refname>mysqli_client_encoding</refname> @@ -9,6 +9,15 @@ <title>Description</title> <para> This function is an alias of <function>mysqli_character_set_name</function>. + For a detailled descripton see description of + <function>mysqli_character_set_name</function>. + </para> + </refsect1> + <refsect1> + <title>See also</title> + <para> + <function>mysqli_client_encoding</function>. + <function>mysqli_real_escape_string</function>. </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-commit.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc/en/reference/mysqli/functions/mysqli-commit.xml diff -u phpdoc/en/reference/mysqli/functions/mysqli-commit.xml:1.4 phpdoc/en/reference/mysqli/functions/mysqli-commit.xml:1.5 --- phpdoc/en/reference/mysqli/functions/mysqli-commit.xml:1.4 Wed Jan 28 18:18:42 2004 +++ phpdoc/en/reference/mysqli/functions/mysqli-commit.xml Fri Feb 20 03:54:11 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry id="function.mysqli-commit"> <refnamediv> <refname>mysqli_commit</refname> @@ -40,6 +40,65 @@ <function>mysqli_rollback</function>. </para> </refsect1> + <refsect1> + <title>Examples</title> + <para> + <example> + <title>Object oriented style</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$mysqli = new mysqli("localhost", "my_user", "my_password", "test"); + +$mysqli->query("DROP TABLE IF EXISTS ta_sample"); +$mysqli->query("CREATE TABLE ta_sample (a int) TYPE=InnoDB"); + +/* set autocommit to off */ +$mysqli->autocommit(FALSE); + +/* Insert some values */ +$mysqli->query("INSERT INTO ta_sample VALUES (1)"); +$mysqli->query("INSERT INTO ta_sample VALUES (1)"); + +/* commit transaction */ +$mysqli->commit(); + +/* close connection */ +$mysqli->close(); +?> +]]> + </programlisting> + </example> + <example> + <title>Procedural style</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$link = mysqli_connect("localhost", "my_user", "my_password", "test"); + +mysqli_query($link, "DROP TABLE IF EXISTS ta_sample"); +mysqli_query($link, "CREATE TABLE ta_sample (a int) TYPE=InnoDB"); + +/* set autocommit to off */ +mysqli_autocommit($link, FALSE); + +/* Insert some values */ +mysqli_query($link, "INSERT INTO ta_sample VALUES (1)"); +mysqli_query($link, "INSERT INTO ta_sample VALUES (1)"); + +/* commit transaction */ +mysqli_commit($link); + +/* close connection */ +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-connect-errno.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc/en/reference/mysqli/functions/mysqli-connect-errno.xml diff -u phpdoc/en/reference/mysqli/functions/mysqli-connect-errno.xml:1.1 phpdoc/en/reference/mysqli/functions/mysqli-connect-errno.xml:1.2 --- phpdoc/en/reference/mysqli/functions/mysqli-connect-errno.xml:1.1 Tue Feb 10 00:13:55 2004 +++ phpdoc/en/reference/mysqli/functions/mysqli-connect-errno.xml Fri Feb 20 03:54:11 2004 @@ -1,19 +1,66 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.mysqli-connect-errno"> <refnamediv> <refname>mysqli_connect_errno</refname> - <refpurpose>Returns the numerical value of the error message from last connect command.</refpurpose> + <refpurpose>Returns the error code from last connect call</refpurpose> </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>int</type><methodname>mysqli_connect_errno</methodname> - <void/> - </methodsynopsis> + <methodsynopsis> + <type>int</type><methodname>mysqli_connect_errno</methodname> + <methodparam><type>void</type><parameter></parameter></methodparam> + </methodsynopsis> + <para> + The <function>mysqli_connect_errno</function> function will return the last error code number + for last call to <function>mysqli_connect</function>. + If no errors have occured, this function will return zero. + </para> + <note> + <para> + Client error message numbers are listed in the MySQL <filename>errmsg.h</filename> header file, + server error message numbers are listed in <filename>mysqld_error.h</filename>. + In the MySQL source distribution you can find a complete list of error messages and error numbers + in the file <filename>Docs/mysqld_error.txt</filename>. + </para> + </note> + </refsect1> + <refsect1> + <title>Return values</title> + <para> + An error code value for the last call to <function>mysqli_connect</function>, if it failed. + zero means no error occurred. + </para> + </refsect1> + <refsect1> + <title>Example</title> + <para> + <example> + <title>mysqli_connect_errno sample</title> + <programlisting role="php"> +<![CDATA[ +<?php - &warn.undocumented.func; +$link = @mysqli_connect("localhost", "nonexisting_user", ""); +if (!$link) { + printf("Can't connect to localhost. Errorcode: %d\n", mysqli_connect_errno()); +} +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + <refsect1> + <title>See also</title> + <para> + <function>mysqli_connect</function>, + <function>mysqli_connect_error</function>, + <function>mysqli_errno</function>, + <function>mysqli_error</function>, + <function>mysqli_sqlstate</function> + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-connect-error.xml?r1=1.1&r2=1.2&ty=u Index: phpdoc/en/reference/mysqli/functions/mysqli-connect-error.xml diff -u phpdoc/en/reference/mysqli/functions/mysqli-connect-error.xml:1.1 phpdoc/en/reference/mysqli/functions/mysqli-connect-error.xml:1.2 --- phpdoc/en/reference/mysqli/functions/mysqli-connect-error.xml:1.1 Sun Feb 8 08:38:38 2004 +++ phpdoc/en/reference/mysqli/functions/mysqli-connect-error.xml Fri Feb 20 03:54:11 2004 @@ -1,19 +1,60 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <refentry id="function.mysqli-connect-error"> <refnamediv> <refname>mysqli_connect_error</refname> - <refpurpose>Returns the text of the error message from previous MySQL operation.</refpurpose> + <refpurpose>Returns a string description of the last connect error</refpurpose> </refnamediv> <refsect1> <title>Description</title> - <methodsynopsis> - <type>string</type><methodname>mysqli_connect_error</methodname> - <void/> - </methodsynopsis> + <methodsynopsis> + <type>string</type><methodname>mysqli_connect_error</methodname> + <methodparam><type>void</type><parameter></parameter></methodparam> + </methodsynopsis> + <para> + The <function>mysqli_connect_error</function> function is identical to the corresponding + <function>mysqli_connect_errno</function> function in every way, except instead of returning + an integer error code the <function>mysqli_connect_error</function> function will return + a string representation of the last error to occur for the last + <function>mysqli_connect</function> call. + If no error has occured, this function will return an empty string. + </para> + </refsect1> + <refsect1> + <title>Return values</title> + <para> + A string that describes the error. An empty string if no error occurred. + </para> + </refsect1> + <refsect1> + <title>Example</title> + <para> + <example> + <title>mysqli_connect_error sample</title> + <programlisting role="php"> +<![CDATA[ +<?php - &warn.undocumented.func; +$link = @mysqli_connect("localhost", "nonexisting_user", ""); +if (!$link) { + printf("Can't connect to localhost. Error: %s\n", mysqli_connect_error()); +} +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + <refsect1> + <title>See also</title> + <para> + <function>mysqli_connect</function>, + <function>mysqli_connect_errno</function>, + <function>mysqli_errno</function>, + <function>mysqli_error</function>, + <function>mysqli_sqlstate</function> + </para> </refsect1> </refentry> http://cvs.php.net/diff.php/phpdoc/en/reference/mysqli/functions/mysqli-rollback.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc/en/reference/mysqli/functions/mysqli-rollback.xml diff -u phpdoc/en/reference/mysqli/functions/mysqli-rollback.xml:1.3 phpdoc/en/reference/mysqli/functions/mysqli-rollback.xml:1.4 --- phpdoc/en/reference/mysqli/functions/mysqli-rollback.xml:1.3 Wed Jan 28 18:18:42 2004 +++ phpdoc/en/reference/mysqli/functions/mysqli-rollback.xml Fri Feb 20 03:54:11 2004 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry id="function.mysqli-rollback"> <refnamediv> <refname>mysqli_rollback</refname> @@ -38,6 +38,65 @@ <function>mysqli_autocommit</function> </para> </refsect1> + <refsect1> + <title>Examples</title> + <para> + <example> + <title>Object oriented style</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$mysqli = new mysqli("localhost", "my_user", "my_password", "test"); + +$mysqli->query("DROP TABLE IF EXISTS ta_sample"); +$mysqli->query("CREATE TABLE ta_sample (a int) TYPE=InnoDB"); + +/* set autocommit to off */ +$mysqli->autocommit(FALSE); + +/* Insert some values */ +$mysqli->query("INSERT INTO ta_sample VALUES (1)"); +$mysqli->query("INSERT INTO ta_sample VALUES (1)"); + +/* rollback transaction */ +$mysqli->rollback(); + +/* close connection */ +$mysqli->close(); +?> +]]> + </programlisting> + </example> + <example> + <title>Procedural style</title> + <programlisting role="php"> +<![CDATA[ +<?php + +$link = mysqli_connect("localhost", "my_user", "my_password", "test"); + +mysqli_query($link, "DROP TABLE IF EXISTS ta_sample"); +mysqli_query($link, "CREATE TABLE ta_sample (a int) TYPE=InnoDB"); + +/* set autocommit to off */ +mysqli_autocommit($link, FALSE); + +/* Insert some values */ +mysqli_query($link, "INSERT INTO ta_sample VALUES (1)"); +mysqli_query($link, "INSERT INTO ta_sample VALUES (1)"); + +/* rollback transaction */ +mysqli_rollback($link); + +/* close connection */ +mysqli_close($link); +?> +]]> + </programlisting> + </example> + </para> + </refsect1> </refentry> <!-- Keep this comment at the end of the file