From 667fa1cc3f7ae3d5d4137f61ad94e16d044ca6ff Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 25 Feb 2005 14:47:45 +0000 Subject: [PATCH] Add new constants. Explain how INOUT and OUT parameters work in bindParam. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@180769 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/pdo/constants.xml | 59 ++++++++++++- .../pdo/functions/PDOStatement-bindParam.xml | 87 ++++++++++++++++++- 2 files changed, 141 insertions(+), 5 deletions(-) diff --git a/reference/pdo/constants.xml b/reference/pdo/constants.xml index bd9edc9cc5..767fb2865b 100644 --- a/reference/pdo/constants.xml +++ b/reference/pdo/constants.xml @@ -1,5 +1,5 @@ - +
&reftitle.constants; @@ -60,6 +60,19 @@ + + + PDO_PARAM_INPUT_OUTPUT + (integer) + + + + Specifies that the parameter is an INOUT parameter for a stored + procedure. You must bitwise-OR this value with an explicit + PDO_PARAM_* data type. + + + PDO_FETCH_LAZY @@ -174,6 +187,50 @@ + + + PDO_FETCH_FUNC + (integer) + + + + + + + + + + PDO_FETCH_GROUP + (integer) + + + + + + + + + + PDO_FETCH_UNIQUE + (integer) + + + + + + + + + + PDO_FETCH_CLASSTYPE + (integer) + + + + + + + PDO_ATTR_AUTOCOMMIT diff --git a/reference/pdo/functions/PDOStatement-bindParam.xml b/reference/pdo/functions/PDOStatement-bindParam.xml index 196b2d52f6..867c8db3a8 100644 --- a/reference/pdo/functions/PDOStatement-bindParam.xml +++ b/reference/pdo/functions/PDOStatement-bindParam.xml @@ -1,5 +1,5 @@ - + @@ -8,11 +8,11 @@ Binds a parameter to a the specified variable name - - Description + + &reftitle.description; boolPDOStatement::bindParam - mixedparameter_name + mixedparameter mixedvariable intdata_type intlength @@ -32,6 +32,60 @@ For input-only variables, you can pass an array of input values to PDOStatement::execute instead. + + + + + &reftitle.parameters; + + + + parameter + + + Parameter identifier. For a prepared statement using named + placeholders, this will be a parameter name of the form + :name. For a prepared statement using + question mark placeholders, this will be the 1-indexed position of + the parameter. + + + + + variable + + + Name of the PHP variable to bind to the SQL statement parameter. + + + + + data_type + + + Explicit data type for the parameter using the PDO_PARAM_* + constants. To return an INOUT parameter from a stored procedure, + use the bitwise OR operator to set the PDO_PARAM_INPUT_OUTPUT bits + for the data_type parameter. + + + + + length + + + Length of the data type. To indicate that a parameter is an OUT + parameter from a stored procedure, you must explicitly set the + length. + + + + + + + + + &reftitle.examples; Execute a prepared statement with named placeholders execute(); + Call a stored procedure with an INOUT parameter + +prepare('CALL puree_fruit(?)'); +$sth->bindParam(1, $colour, PDO_PARAM_STR|PDO_PARAM_INPUT_OUTPUT, 12); +$sth->execute(); +print("After pureeing fruit, the colour is: $colour"); +?> +]]> + + + + + &reftitle.seealso; + + + PDO::prepare + PDOStatement::execute + + + +