From a78282afea28a09bd37b598b940e784df0228789 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Fri, 22 Aug 2003 12:13:16 +0000 Subject: [PATCH] fixed prototypes, added samples git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@138484 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../mysqli/functions/mysqli-autocommit.xml | 62 ++++++++++- .../mysqli/functions/mysqli-bind-param.xml | 100 ++++++++++++++++-- 2 files changed, 149 insertions(+), 13 deletions(-) diff --git a/reference/mysqli/functions/mysqli-autocommit.xml b/reference/mysqli/functions/mysqli-autocommit.xml index 2e6426739d..5a14751732 100644 --- a/reference/mysqli/functions/mysqli-autocommit.xml +++ b/reference/mysqli/functions/mysqli-autocommit.xml @@ -1,5 +1,5 @@ - + mysqli_autocommit @@ -9,7 +9,7 @@ Description boolmysqli_autocommit - resourcelink + objectlink boolmode @@ -20,25 +20,79 @@ &return.success; + + + mysqli_autocommit doesn't work with non transactional + table types (like MyISAM or ISAM). + + + To determine the current state of autocommit use the SQL command + 'SELECT @@autocommit'. + + Using the mysqli_autocommit function + Procedural style: ]]> + Object oriented style: + +autocommit(true); + + /* determine current autocommit status */ + if ($result = $mysql->query($link, "SELECT @@autocommit")) { + $row = $result->fetch_row($result); + printf ("Autocommit is %d\n", $row[0]); + $result->free(); + } + + /* close connection */ + $mysql->close(); +?> +]]> + + + The above examples would produce the following output: + + + + + + See also mysqli_commit, + mysqli_rollback. + diff --git a/reference/mysqli/functions/mysqli-bind-param.xml b/reference/mysqli/functions/mysqli-bind-param.xml index ce74e30566..6900fe5615 100644 --- a/reference/mysqli/functions/mysqli-bind-param.xml +++ b/reference/mysqli/functions/mysqli-bind-param.xml @@ -1,5 +1,5 @@ - + mysqli_bind_param @@ -9,18 +9,100 @@ Description boolmysqli_bind_param - resourcestmt - mixedvariable - inttype + objectstmt + arraytypes + mixedvar1 + mixedvar2, ... - - &warn.undocumented.func; - + + mysql_bind_param is used to bind variables for the + parameter markers in the SQL statement that was passed to + mysql_prepare. + The array types specifies the types for the + diffrent bind variables. Valid array values are MYSQLI_BIND_INT, MYSQLI_BIND_DOUBLE, + MYSQLI_BIND_STRING and MYSQLI_SEND_DATA. + - - You can pass additional variable/type pairs to this function. + + If data size of a variable exceeds max. allowed package size + (max_allowed_package), you have to specify MYSQLI_SEND_DATA and use + mysqli_send_long_data to send the data in packages. + + + The number of variables and array values must match the number of + parameters in the statement. + + Prepared statements + Procedural style: + + +]]> + + Object oriented style: + +query("CREATE TABLE mytable (a int, b int, c varchar(30))"); + + /* prepare statement and bind parameters */ + $stmt = mysql->prepare("INSERT INTO mytable VALUES (?, ?, ?)"); + $stmt->bind_param(array(MYSQLI_BIND_INT, MYSQLI_BIND_INT, + MYSQLI_BIND_STRING), $a, $b, $c); + + $a = 1; + $b = 2; + $c = "I prefer opensource software"; + + /* execute prepared statement */ + $stmt->execute(); + + /* close statement and connection */ + $stmt->close(); + $mysql->close(); +?> +]]> + + + + See also: mysqli_bind_result, + mysqli_execute, + mysqli_fetch + + mysqli_prepare + mysqli_send_long_data +