From 1dd6357dd058d607f3480e58ef4857e6c956edb8 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Fri, 20 Feb 2004 08:54:11 +0000 Subject: [PATCH] documented mysqli_connect_errno/error functions more samples added git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@151906 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../functions/mysqli-character-set-name.xml | 45 ++++++++++---- .../functions/mysqli-client-encoding.xml | 11 +++- reference/mysqli/functions/mysqli-commit.xml | 61 ++++++++++++++++++- .../mysqli/functions/mysqli-connect-errno.xml | 61 ++++++++++++++++--- .../mysqli/functions/mysqli-connect-error.xml | 55 ++++++++++++++--- .../mysqli/functions/mysqli-rollback.xml | 61 ++++++++++++++++++- 6 files changed, 264 insertions(+), 30 deletions(-) diff --git a/reference/mysqli/functions/mysqli-character-set-name.xml b/reference/mysqli/functions/mysqli-character-set-name.xml index 3bff90555b..f91c90d24b 100644 --- a/reference/mysqli/functions/mysqli-character-set-name.xml +++ b/reference/mysqli/functions/mysqli-character-set-name.xml @@ -1,5 +1,5 @@ - + mysqli_character_set_name @@ -31,32 +31,51 @@ Return values The default character set for the current connection + + See also + + mysqli_client_encoding. + mysqli_real_escape_string. + + Example - Using the mysqli_character_set_name function + Object oriented style character_set_name(); + printf ("Current character set is %s\n", $charset); + + $mysqli->close(); +?> +]]> + + + + Procedural style + + ]]> - - - - - See also - - mysqli_real_escape_string. - - + + + + mysqli_client_encoding @@ -9,6 +9,15 @@ Description This function is an alias of mysqli_character_set_name. + For a detailled descripton see description of + mysqli_character_set_name. + + + + See also + + mysqli_client_encoding. + mysqli_real_escape_string. diff --git a/reference/mysqli/functions/mysqli-commit.xml b/reference/mysqli/functions/mysqli-commit.xml index 490b3fe54c..c86f88d1ec 100644 --- a/reference/mysqli/functions/mysqli-commit.xml +++ b/reference/mysqli/functions/mysqli-commit.xml @@ -1,5 +1,5 @@ - + mysqli_commit @@ -40,6 +40,65 @@ mysqli_rollback. + + Examples + + + Object oriented style + +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(); +?> +]]> + + + + Procedural style + + +]]> + + + + + mysqli_connect_errno - Returns the numerical value of the error message from last connect command. + Returns the error code from last connect call Description - - intmysqli_connect_errno - - + + intmysqli_connect_errno + void + + + The mysqli_connect_errno function will return the last error code number + for last call to mysqli_connect. + If no errors have occured, this function will return zero. + + + + Client error message numbers are listed in the MySQL errmsg.h header file, + server error message numbers are listed in mysqld_error.h. + In the MySQL source distribution you can find a complete list of error messages and error numbers + in the file Docs/mysqld_error.txt. + + + + + Return values + + An error code value for the last call to mysqli_connect, if it failed. + zero means no error occurred. + + + + Example + + + mysqli_connect_errno sample + + +]]> + + + + + + See also + + mysqli_connect, + mysqli_connect_error, + mysqli_errno, + mysqli_error, + mysqli_sqlstate + diff --git a/reference/mysqli/functions/mysqli-connect-error.xml b/reference/mysqli/functions/mysqli-connect-error.xml index 324778e811..2e18ba1dc7 100644 --- a/reference/mysqli/functions/mysqli-connect-error.xml +++ b/reference/mysqli/functions/mysqli-connect-error.xml @@ -1,19 +1,60 @@ - + mysqli_connect_error - Returns the text of the error message from previous MySQL operation. + Returns a string description of the last connect error Description - - stringmysqli_connect_error - - + + stringmysqli_connect_error + void + + + The mysqli_connect_error function is identical to the corresponding + mysqli_connect_errno function in every way, except instead of returning + an integer error code the mysqli_connect_error function will return + a string representation of the last error to occur for the last + mysqli_connect call. + If no error has occured, this function will return an empty string. + + + + Return values + + A string that describes the error. An empty string if no error occurred. + + + + Example + + + mysqli_connect_error sample + + +]]> + + + + + + See also + + mysqli_connect, + mysqli_connect_errno, + mysqli_errno, + mysqli_error, + mysqli_sqlstate + diff --git a/reference/mysqli/functions/mysqli-rollback.xml b/reference/mysqli/functions/mysqli-rollback.xml index 565ca78020..fb6b7f7355 100644 --- a/reference/mysqli/functions/mysqli-rollback.xml +++ b/reference/mysqli/functions/mysqli-rollback.xml @@ -1,5 +1,5 @@ - + mysqli_rollback @@ -38,6 +38,65 @@ mysqli_autocommit + + Examples + + + Object oriented style + +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(); +?> +]]> + + + + Procedural style + + +]]> + + + +