From 3782dbb92cdf881f798bcf40e4082bce3fc5dfb3 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Sun, 7 Jan 2007 20:57:48 +0000 Subject: [PATCH] Document PDO with classsynopsis and fix all links # Also rollback a change that shouldn't have make it in the last commit git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@226684 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../pdo/functions/PDO-beginTransaction.xml | 23 ++--- reference/pdo/functions/PDO-commit.xml | 21 +++-- reference/pdo/functions/PDO-construct.xml | 23 ++--- reference/pdo/functions/PDO-errorCode.xml | 31 ++++--- reference/pdo/functions/PDO-errorInfo.xml | 33 +++---- reference/pdo/functions/PDO-exec.xml | 37 ++++---- reference/pdo/functions/PDO-getAttribute.xml | 23 ++--- .../pdo/functions/PDO-getAvailableDrivers.xml | 21 +++-- reference/pdo/functions/PDO-lastInsertId.xml | 21 +++-- reference/pdo/functions/PDO-prepare.xml | 35 ++++---- reference/pdo/functions/PDO-query.xml | 86 +++++++++++-------- reference/pdo/functions/PDO-quote.xml | 27 +++--- reference/pdo/functions/PDO-rollBack.xml | 21 +++-- reference/pdo/functions/PDO-setAttribute.xml | 17 ++-- .../pdo/functions/PDOStatement-bindColumn.xml | 35 ++++---- .../pdo/functions/PDOStatement-bindParam.xml | 33 +++---- .../pdo/functions/PDOStatement-bindValue.xml | 25 +++--- .../functions/PDOStatement-closeCursor.xml | 25 +++--- .../functions/PDOStatement-columnCount.xml | 33 +++---- .../pdo/functions/PDOStatement-errorCode.xml | 25 +++--- .../pdo/functions/PDOStatement-errorInfo.xml | 23 ++--- .../pdo/functions/PDOStatement-execute.xml | 27 +++--- .../pdo/functions/PDOStatement-fetch.xml | 40 ++++----- .../pdo/functions/PDOStatement-fetchAll.xml | 31 ++++--- .../functions/PDOStatement-fetchColumn.xml | 31 ++++--- .../functions/PDOStatement-fetchObject.xml | 21 +++-- .../functions/PDOStatement-getAttribute.xml | 21 +++-- .../functions/PDOStatement-getColumnMeta.xml | 23 ++--- .../pdo/functions/PDOStatement-nextRowset.xml | 27 +++--- .../pdo/functions/PDOStatement-rowCount.xml | 31 ++++--- .../functions/PDOStatement-setAttribute.xml | 23 ++--- .../functions/PDOStatement-setFetchMode.xml | 58 ++++++++----- reference/pdo/reference.xml | 30 +++---- 33 files changed, 545 insertions(+), 436 deletions(-) diff --git a/reference/pdo/functions/PDO-beginTransaction.xml b/reference/pdo/functions/PDO-beginTransaction.xml index 97c4932568..765024c658 100644 --- a/reference/pdo/functions/PDO-beginTransaction.xml +++ b/reference/pdo/functions/PDO-beginTransaction.xml @@ -1,8 +1,8 @@ - + - PDO::beginTransaction + PDO->beginTransaction() Initiates a transaction @@ -10,15 +10,18 @@ &reftitle.description; - - boolPDO::beginTransaction - - + + PDO + + boolbeginTransaction + + + Turns off autocommit mode. While autocommit mode is turned off, changes made to the database via the PDO object instance are not committed until - you end the transaction by calling PDO::commit. - Calling PDO::rollback will roll back all changes to + you end the transaction by calling . + Calling will roll back all changes to the database and return the connection to autocommit mode. @@ -68,8 +71,8 @@ $dbh->rollBack(); &reftitle.seealso; - PDO::commit - PDO::rollBack + + diff --git a/reference/pdo/functions/PDO-commit.xml b/reference/pdo/functions/PDO-commit.xml index cacfa0c874..7c67d14906 100644 --- a/reference/pdo/functions/PDO-commit.xml +++ b/reference/pdo/functions/PDO-commit.xml @@ -1,8 +1,8 @@ - + - PDO::commit + PDO->commit() Commits a transaction @@ -10,13 +10,16 @@ &reftitle.description; - - boolPDO::commit - - + + PDO + + boolcommit + + + Commits a transaction, returning the database connection to autocommit - mode until the next call to PDO::beginTransaction + mode until the next call to starts a new transaction. @@ -49,8 +52,8 @@ $dbh->commit(); &reftitle.seealso; - PDO::beginTransaction - PDO::rollBack + + diff --git a/reference/pdo/functions/PDO-construct.xml b/reference/pdo/functions/PDO-construct.xml index fb5a47fa4d..a3f1e90b7b 100644 --- a/reference/pdo/functions/PDO-construct.xml +++ b/reference/pdo/functions/PDO-construct.xml @@ -1,21 +1,24 @@ - + - PDO::__construct + PDO->__construct() Creates a PDO instance representing a connection to a database &reftitle.description; - - PDOPDO::__construct - stringdsn - stringusername - stringpassword - arraydriver_options - + + PDO + + PDO__construct + stringdsn + stringusername + stringpassword + arraydriver_options + + Creates a PDO instance to represent a connection to the requested database. @@ -117,7 +120,7 @@ &reftitle.errors; - PDO::construct throws a PDOException if the attempt + throws a PDOException if the attempt to connect to the requested database fails. diff --git a/reference/pdo/functions/PDO-errorCode.xml b/reference/pdo/functions/PDO-errorCode.xml index dad624ca02..0c57ec4f9c 100644 --- a/reference/pdo/functions/PDO-errorCode.xml +++ b/reference/pdo/functions/PDO-errorCode.xml @@ -1,18 +1,21 @@ - + - PDO::errorCode + PDO->errorCode() Fetch the SQLSTATE associated with the last operation on the database handle &reftitle.description; - - stringPDO::errorCode - - + + PDO + + stringerrorCode + + + @@ -30,12 +33,12 @@ class indicates that there is no subclass for that SQLSTATE. - PDO::errorCode only retrieves error codes for operations + only retrieves error codes for operations performed directly on the database handle. If you create a PDOStatement - object through PDO::prepare or - PDO::query and invoke an error on the statement - handle, PDO::errorCode will not reflect that error. - You must call PDOStatement::errorCode to return the error + object through or + and invoke an error on the statement + handle, will not reflect that error. + You must call to return the error code for an operation performed on a particular statement handle. @@ -69,9 +72,9 @@ PDO::errorCode(): 42S02 &reftitle.seealso; - PDO::errorInfo - PDOStatement::errorCode - PDOStatement::errorInfo + + + diff --git a/reference/pdo/functions/PDO-errorInfo.xml b/reference/pdo/functions/PDO-errorInfo.xml index 8fa3ade17c..7324c61973 100644 --- a/reference/pdo/functions/PDO-errorInfo.xml +++ b/reference/pdo/functions/PDO-errorInfo.xml @@ -1,25 +1,28 @@ - + - PDO::errorInfo + PDO->errorInfo() Fetch extended error information associated with the last operation on the database handle &reftitle.description; - - arrayPDO::errorInfo - - + + PDO + + arrayerrorInfo + + + &reftitle.returnvalues; - PDO::errorInfo returns an array of error information + returns an array of error information about the last operation performed by this database handle. The array consists of the following fields: @@ -50,13 +53,13 @@ - PDO::errorInfo only retrieves error information for + only retrieves error information for operations performed directly on the database handle. If you create a - PDOStatement object through PDO::prepare or - PDO::query and invoke an error on the statement - handle, PDO::errorInfo will not reflect the error + PDOStatement object through or + and invoke an error on the statement + handle, will not reflect the error from the statement handle. You must call - PDOStatement::errorInfo to return the error + to return the error information for an operation performed on a particular statement handle. @@ -96,9 +99,9 @@ Array &reftitle.seealso; - PDO::errorCode - PDOStatement::errorCode - PDOStatement::errorInfo + + + diff --git a/reference/pdo/functions/PDO-exec.xml b/reference/pdo/functions/PDO-exec.xml index 000a831ae4..d65cb5d2cd 100644 --- a/reference/pdo/functions/PDO-exec.xml +++ b/reference/pdo/functions/PDO-exec.xml @@ -1,31 +1,34 @@ - + - PDO::exec + PDO->exec() Execute an SQL statement and return the number of affected rows &reftitle.description; - - intPDO::exec - stringstatement - + + PDO + + intexec + stringstatement + + - PDO::exec executes an SQL statement in + executes an SQL statement in a single function call, returning the number of rows affected by the statement. - PDO::exec does not return results from a SELECT + does not return results from a SELECT statement. For a SELECT statement that you only need to issue once - during your program, consider issuing PDO::query. + during your program, consider issuing . For a statement that you need to issue multiple times, prepare - a PDOStatement object with PDO::prepare and issue - the statement with PDOStatement::execute. + a PDOStatement object with and issue + the statement with . @@ -47,15 +50,15 @@ &reftitle.returnvalues; - PDO::exec returns the number of rows that were modified + returns the number of rows that were modified or deleted by the SQL statement you issued. If no rows were affected, - PDO::exec returns 0. + returns 0. &return.falseproblem; The following example incorrectly relies on the return value of - PDO::exec, wherein a statement that affected 0 rows + , wherein a statement that affected 0 rows results in a call to die: - PDO::prepare - PDO::query - PDOStatement::execute + + + diff --git a/reference/pdo/functions/PDO-getAttribute.xml b/reference/pdo/functions/PDO-getAttribute.xml index e08896f043..b7599fffa7 100644 --- a/reference/pdo/functions/PDO-getAttribute.xml +++ b/reference/pdo/functions/PDO-getAttribute.xml @@ -1,23 +1,26 @@ - + - PDO::getAttribute + PDO->getAttribute() Retrieve a database connection attribute &reftitle.description; - - mixedPDO::getAttribute - intattribute - + + PDO + + mixedgetAttribute + intattribute + + This function returns the value of a database connection attribute. To retrieve PDOStatement attributes, refer to - PDOStatement::getAttribute. + . @@ -104,9 +107,9 @@ Use the PEAR Coding Standards &reftitle.seealso; - PDO::setAttribute - PDOStatement::getAttribute - PDOStatement::setAttribute + + + diff --git a/reference/pdo/functions/PDO-getAvailableDrivers.xml b/reference/pdo/functions/PDO-getAvailableDrivers.xml index 004265431a..8a107a8233 100644 --- a/reference/pdo/functions/PDO-getAvailableDrivers.xml +++ b/reference/pdo/functions/PDO-getAvailableDrivers.xml @@ -1,29 +1,32 @@ - + - PDO::getAvailableDrivers + PDO->getAvailableDrivers() Return an array of available PDO drivers &reftitle.description; - - arrayPDO::getAvailableDrivers - - + + PDO + + arraygetAvailableDrivers + + + This function returns all currently available PDO drivers which can be used in DSN parameter of - PDO::__construct. This is a static method. + . This is a static method. &reftitle.returnvalues; - PDO::getAvailableDrivers returns an array of PDO driver names. If + returns an array of PDO driver names. If no drivers are available, it returns an empty array. @@ -32,7 +35,7 @@ &reftitle.examples; - A <function>PDO::getAvailableDrivers</function> example + A <xref linkend="function.PDO-getAvailableDrivers" /> example - + - PDO::lastInsertId + PDO->lastInsertId() Returns the ID of the last inserted row or sequence value &reftitle.description; - - stringPDO::lastInsertId - stringname - + + PDO + + stringlastInsertId + stringname + + Returns the ID of the last inserted row, or the last value from a @@ -49,19 +52,19 @@ &reftitle.returnvalues; If a sequence name was not specified for the name - parameter, PDOStatement::lastInsertId returns a + parameter, returns a string representing the row ID of the last row that was inserted into the database. If a sequence name was specified for the name - parameter, PDOStatement::lastInsertId returns a + parameter, returns a string representing the last value retrieved from the specified sequence object. If the PDO driver does not support this capability, - PDO::lastInsertID triggers an + triggers an IM001 SQLSTATE. diff --git a/reference/pdo/functions/PDO-prepare.xml b/reference/pdo/functions/PDO-prepare.xml index e7ace3e2b6..413ff5c885 100644 --- a/reference/pdo/functions/PDO-prepare.xml +++ b/reference/pdo/functions/PDO-prepare.xml @@ -1,23 +1,26 @@ - + - PDO::prepare + PDO->prepare() Prepares a statement for execution and returns a statement object &reftitle.description; - - PDOStatementPDO::prepare - stringstatement - arraydriver_options - + + PDO + + PDOStatementprepare + stringstatement + arraydriver_options + + Prepares an SQL statement to be executed by the - PDOStatement::execute method. The SQL statement can + method. The SQL statement can contain zero or more named (:name) or question mark (?) parameter markers for which real values will be substituted when the statement is executed. You cannot use both named and question mark parameter markers within the same @@ -25,14 +28,14 @@ You must include a unique parameter marker for each value you wish to pass - in to the statement when you call PDOStatement::execute. + in to the statement when you call . You cannot use a named parameter marker of the same name twice in a prepared statement. You cannot bind multiple values to a single named parameter in, for example, the IN() clause of an SQL statement. - Calling PDO::prepare and - PDOStatement::execute for statements that will be + Calling and + for statements that will be issued multiple times with different parameter values optimizes the performance of your application by allowing the driver to negotiate client and/or server side caching of the query plan and meta information, @@ -80,9 +83,9 @@ &reftitle.returnvalues; If the database server successfully prepares the statement, - PDO::prepare returns a PDOStatement object. + returns a PDOStatement object. If the database server cannot successfully prepare the statement, - PDO::prepare returns &false;. + returns &false;. @@ -130,9 +133,9 @@ $yellow = $sth->fetchAll(); &reftitle.seealso; - PDO::exec - PDO::query - PDOStatement::execute + + + diff --git a/reference/pdo/functions/PDO-query.xml b/reference/pdo/functions/PDO-query.xml index b2f2f78336..2f7ebf994d 100644 --- a/reference/pdo/functions/PDO-query.xml +++ b/reference/pdo/functions/PDO-query.xml @@ -1,58 +1,70 @@ - + - PDO::query + PDO->query() Executes an SQL statement, returning a result set as a PDOStatement object &reftitle.description; - - PDOStatementPDO::query - stringstatement - + + PDO + + PDOStatementquery + stringstatement + + - - boolPDO::query - stringstatement - intPDO::FETCH_COLUMN - intcolno - + + PDO + + boolquery + stringstatement + intPDO::FETCH_COLUMN + intcolno + + - - boolPDO::query - stringstatement - intPDO::FETCH_CLASS - stringclassname - arrayctorargs - + + PDO + + boolquery + stringstatement + intPDO::FETCH_CLASS + stringclassname + arrayctorargs + + - - boolPDO::query - stringstatement - intPDO::FETCH_INTO - objectobject - + + PDO + + boolquery + stringstatement + intPDO::FETCH_INTO + objectobject + + - PDO::query executes an SQL statement in + executes an SQL statement in a single function call, returning the result set (if any) returned by the statement as a PDOStatement object. For a query that you need to issue multiple times, you will realize better performance if you prepare a PDOStatement object using - PDO::prepare and issue the statement with multiple - calls to PDOStatement::execute. + and issue the statement with multiple + calls to . If you do not fetch all of the data in a result set before issuing your - next call to PDO::query, your call may fail. Call - PDOStatement::closeCursor to release the database + next call to , your call may fail. Call + to release the database resources associated with the PDOStatement object before issuing your - next call to PDO::query. + next call to . @@ -60,7 +72,7 @@ Although this function is only documented as having a single parameter, you may pass additional arguments to this function. They will be treated as though you called - PDOStatement::setFetchMode on the resultant statement + on the resultant statement object. @@ -84,7 +96,7 @@ &reftitle.returnvalues; - PDO::query returns a PDOStatement object. + returns a PDOStatement object. @@ -94,7 +106,7 @@ Demonstrate PDO::query - A nice feature of PDO::query is that it + A nice feature of is that it enables you to iterate over the rowset returned by a successfully executed SELECT statement. @@ -133,9 +145,9 @@ watermelon pink 90 &reftitle.seealso; - PDO::exec - PDO::prepare - PDOStatement::execute + + + diff --git a/reference/pdo/functions/PDO-quote.xml b/reference/pdo/functions/PDO-quote.xml index 34afa01b25..055d0251a1 100644 --- a/reference/pdo/functions/PDO-quote.xml +++ b/reference/pdo/functions/PDO-quote.xml @@ -1,30 +1,33 @@ - + - PDO::quote + PDO->quote() Quotes a string for use in a query. &reftitle.description; - - stringPDO::quote - stringstring - intparameter_type - + + PDO + + stringquote + stringstring + intparameter_type + + - PDO::quote places quotes around the input string (if + places quotes around the input string (if required) and escapes special characters within the input string, using a quoting style appropriate to the underlying driver. If you are using this function to build SQL statements, you are strongly recommended to use - PDO::prepare to prepare SQL statements with bound - parameters instead of using PDO::quote to interpolate + to prepare SQL statements with bound + parameters instead of using to interpolate user input into a SQL statement. Prepared statements with bound parameters are not only more portable, more convenient, immune to SQL injection, but are often much faster to execute than interpolated queries, as both the @@ -153,8 +156,8 @@ Quoted string: 'Co''mpl''''ex "st''"ring' &reftitle.seealso; - PDO::prepare - PDOStatement::execute + + diff --git a/reference/pdo/functions/PDO-rollBack.xml b/reference/pdo/functions/PDO-rollBack.xml index 2ed2d2c314..7a972f446c 100644 --- a/reference/pdo/functions/PDO-rollBack.xml +++ b/reference/pdo/functions/PDO-rollBack.xml @@ -1,8 +1,8 @@ - + - PDO::rollBack + PDO->rollBack() Rolls back a transaction @@ -10,14 +10,17 @@ &reftitle.description; - - boolPDO::rollBack - - + + PDO + + boolrollBack + + + Rolls back the current transaction, as initiated by - PDO::beginTransaction. It is an error to call this + . It is an error to call this method if no transaction is active. @@ -70,8 +73,8 @@ $dbh->rollBack(); &reftitle.seealso; - PDO::beginTransaction - PDO::commit + + diff --git a/reference/pdo/functions/PDO-setAttribute.xml b/reference/pdo/functions/PDO-setAttribute.xml index 970a5cbb65..d436bcb9d5 100644 --- a/reference/pdo/functions/PDO-setAttribute.xml +++ b/reference/pdo/functions/PDO-setAttribute.xml @@ -1,19 +1,22 @@ - + - PDO::setAttribute + PDO->setAttribute() Set an attribute &reftitle.description; - - boolPDO::setAttribute - intattribute - mixedvalue - + + PDO + + boolsetAttribute + intattribute + mixedvalue + + Sets an attribute on the database handle. Some of the available generic diff --git a/reference/pdo/functions/PDOStatement-bindColumn.xml b/reference/pdo/functions/PDOStatement-bindColumn.xml index 9f5f5ff8de..d100e7d03b 100644 --- a/reference/pdo/functions/PDOStatement-bindColumn.xml +++ b/reference/pdo/functions/PDOStatement-bindColumn.xml @@ -1,33 +1,36 @@ - + - PDOStatement::bindColumn + PDOStatement->bindColumn() Bind a column to a PHP variable &reftitle.description; - - boolPDOStatement::bindColumn - mixedcolumn - mixedparam - inttype - + + PDOStatement + + boolbindColumn + mixedcolumn + mixedparam + inttype + + - PDOStatement::bindColumn arranges to have a + arranges to have a particular variable bound to a given column in the result-set from a - query. Each call to PDOStatement::fetch or - PDOStatement::fetchAll will update all the variables + query. Each call to or + will update all the variables that are bound to columns. Since information about the columns is not always available to PDO until the statement is executed, portable applications should call this - function after PDO::execute. + function after . @@ -126,10 +129,10 @@ strawberry red 25 &reftitle.seealso; - PDOStatement::execute - PDOStatement::fetch - PDOStatement::fetchAll - PDOStatement::fetchColumn + + + + diff --git a/reference/pdo/functions/PDOStatement-bindParam.xml b/reference/pdo/functions/PDOStatement-bindParam.xml index 7bb5d8a916..3260b0b1e6 100644 --- a/reference/pdo/functions/PDOStatement-bindParam.xml +++ b/reference/pdo/functions/PDOStatement-bindParam.xml @@ -1,28 +1,31 @@ - + - PDOStatement::bindParam + PDOStatement->bindParam() Binds a parameter to the specified variable name &reftitle.description; - - boolPDOStatement::bindParam - mixedparameter - mixedvariable - intdata_type - intlength - mixeddriver_options - + + PDOStatement + + boolbindParam + mixedparameter + mixedvariable + intdata_type + intlength + mixeddriver_options + + Binds a PHP variable to a corresponding named or question mark placeholder in the SQL statement that was use to prepare the statement. Unlike - PDOStatement::bindValue, the variable is bound as a + , the variable is bound as a reference and will only be evaluated at the time that - PDOStatement::execute is called. + is called. Most parameters are input parameters, that is, parameters that are used @@ -172,9 +175,9 @@ print("After pureeing fruit, the colour is: $colour"); &reftitle.seealso; - PDO::prepare - PDOStatement::execute - PDOStatement::bindValue + + + diff --git a/reference/pdo/functions/PDOStatement-bindValue.xml b/reference/pdo/functions/PDOStatement-bindValue.xml index ffdcc179dc..fb79f68136 100644 --- a/reference/pdo/functions/PDOStatement-bindValue.xml +++ b/reference/pdo/functions/PDOStatement-bindValue.xml @@ -1,20 +1,23 @@ - + - PDOStatement::bindValue + PDOStatement->bindValue() Binds a value to a parameter &reftitle.description; - - boolPDOStatement::bindValue - mixedparameter - mixedvalue - intdata_type - + + PDOStatement + + boolbindValue + mixedparameter + mixedvalue + intdata_type + + Binds a value to a corresponding named or question mark placeholder in the SQL statement that was use to prepare the statement. @@ -103,9 +106,9 @@ $sth->execute(); &reftitle.seealso; - PDO::prepare - PDOStatement::execute - PDOStatement::bindParam + + + diff --git a/reference/pdo/functions/PDOStatement-closeCursor.xml b/reference/pdo/functions/PDOStatement-closeCursor.xml index 8deef8afdc..02534e6f0c 100644 --- a/reference/pdo/functions/PDOStatement-closeCursor.xml +++ b/reference/pdo/functions/PDOStatement-closeCursor.xml @@ -1,21 +1,24 @@ - + - PDOStatement::closeCursor + PDOStatement->closeCursor() Closes the cursor, enabling the statement to be executed again. &reftitle.description; - - boolPDOStatement::closeCursor - - + + PDOStatement + + boolcloseCursor + + + - PDOStatement::closeCursor frees up the connection + frees up the connection to the server so that other SQL statements may be issued, but leaves the statement in a state that enables it to be executed again. @@ -26,7 +29,7 @@ the problem may manifest itself in an out-of-sequence error. - PDOStatement::closeCursor is implemented either as an + is implemented either as an optional driver specific method (allowing for maximum efficiency), or as the generic PDO fallback if no driver specific function is installed. The PDO generic fallback is semantically the same as writing the following @@ -85,13 +88,13 @@ do { &reftitle.examples; - A <function>PDOStatement::closeCursor</function> example + A <xref linkend="function.PDOStatement-closeCursor" /> example In the following example, the $stmt PDOStatement object returns multiple rows but the application fetches only the first row, leaving the PDOStatement object in a state of having unfetched rows. To ensure that the application will work with all database drivers, the - author inserts a call to PDOStatement::closeCursor + author inserts a call to on $stmt before executing the $otherStmt PDOStatement object. @@ -126,7 +129,7 @@ $otherStmt->execute(); &reftitle.seealso; - PDOStatement::execute + diff --git a/reference/pdo/functions/PDOStatement-columnCount.xml b/reference/pdo/functions/PDOStatement-columnCount.xml index 5d5a531189..193a87e80a 100644 --- a/reference/pdo/functions/PDOStatement-columnCount.xml +++ b/reference/pdo/functions/PDOStatement-columnCount.xml @@ -1,31 +1,34 @@ - + - PDOStatement::columnCount + PDOStatement->columnCount() Returns the number of columns in the result set &reftitle.description; - - intPDOStatement::columnCount - - + + PDOStatement + + intcolumnCount + + + - Use PDOStatement::columnCount to return the number + Use to return the number of columns in the result set represented by the PDOStatement object. - If the PDOStatement object was returned from PDO::query, + If the PDOStatement object was returned from , the column count is immediately available. If the PDOStatement object was returned from - PDO::prepare, an accurate column count will not be - available until you invoke PDOStatement::execute. + , an accurate column count will not be + available until you invoke . @@ -34,7 +37,7 @@ Returns the number of columns in the result set represented by the PDOStatement object. If there is no result set, - PDOStatement::columnCount returns 0. + returns 0. @@ -44,7 +47,7 @@ Counting columns - This example demonstrates how PDOStatement::columnCount + This example demonstrates how operates with and without a result set. @@ -83,9 +86,9 @@ After execute(), result set has 2 columns (should be 2) &reftitle.seealso; - PDO::prepare - PDOStatement::execute - PDOStatement::rowCount + + + diff --git a/reference/pdo/functions/PDOStatement-errorCode.xml b/reference/pdo/functions/PDOStatement-errorCode.xml index 55c58e559e..260a12e8c0 100644 --- a/reference/pdo/functions/PDOStatement-errorCode.xml +++ b/reference/pdo/functions/PDOStatement-errorCode.xml @@ -1,25 +1,28 @@ - + - PDOStatement::errorCode + PDOStatement->errorCode() Fetch the SQLSTATE associated with the last operation on the statement handle &reftitle.description; - - stringPDOStatement::errorCode - - + + PDOStatement + + stringerrorCode + + + &reftitle.returnvalues; - Identical to PDO::errorCode, except that - PDOStatement::errorCode only retrieves error codes + Identical to , except that + only retrieves error codes for operations performed with PDOStatement objects. @@ -54,9 +57,9 @@ PDOStatement::errorCode(): 42S02 &reftitle.seealso; - PDO::errorCode - PDO::errorInfo - PDOStatement::errorInfo + + + diff --git a/reference/pdo/functions/PDOStatement-errorInfo.xml b/reference/pdo/functions/PDOStatement-errorInfo.xml index 5373d1c05b..bcf6976d81 100644 --- a/reference/pdo/functions/PDOStatement-errorInfo.xml +++ b/reference/pdo/functions/PDOStatement-errorInfo.xml @@ -1,25 +1,28 @@ - + - PDOStatement::errorInfo + PDOStatement->errorInfo() Fetch extended error information associated with the last operation on the statement handle &reftitle.description; - - arrayPDOStatement::errorInfo - - + + PDOStatement + + arrayerrorInfo + + + &reftitle.returnvalues; - PDOStatement::errorInfo returns an array of + returns an array of error information about the last operation performed by this statement handle. The array consists of the following fields: @@ -88,9 +91,9 @@ Array &reftitle.seealso; - PDO::errorCode - PDO::errorInfo - PDOStatement::errorCode + + + diff --git a/reference/pdo/functions/PDOStatement-execute.xml b/reference/pdo/functions/PDOStatement-execute.xml index 6d3a942178..7e3d412240 100644 --- a/reference/pdo/functions/PDOStatement-execute.xml +++ b/reference/pdo/functions/PDOStatement-execute.xml @@ -1,23 +1,26 @@ - + - PDOStatement::execute + PDOStatement->execute() Executes a prepared statement &reftitle.description; - - boolPDOStatement::execute - arrayinput_parameters - + + PDOStatement + + boolexecute + arrayinput_parameters + + Execute the prepared statement. If the prepared statement included parameter markers, you must either: - call PDOStatement::bindParam to bind PHP variables + call to bind PHP variables to the parameter markers: bound variables pass their value as input and receive the output value, if any, of their associated parameter markers or pass an array of input-only parameter values @@ -130,11 +133,11 @@ $sth->execute(); &reftitle.seealso; - PDO::prepare - PDOStatement::bindParam - PDOStatement::fetch - PDOStatement::fetchAll - PDOStatement::fetchColumn + + + + + diff --git a/reference/pdo/functions/PDOStatement-fetch.xml b/reference/pdo/functions/PDOStatement-fetch.xml index 955df20132..5e1379953f 100644 --- a/reference/pdo/functions/PDOStatement-fetch.xml +++ b/reference/pdo/functions/PDOStatement-fetch.xml @@ -1,20 +1,23 @@ - + - PDOStatement::fetch + PDOStatement->fetch() Fetches the next row from a result set &reftitle.description; - - mixedPDOStatement::fetch - intfetch_style - intcursor_orientation - intcursor_offset - + + PDOStatement + + mixedfetch + intfetch_style + intcursor_orientation + intcursor_offset + + Fetches a row from a result set associated with a PDOStatement object. The @@ -47,7 +50,7 @@ PDO::FETCH_BOUND: returns &true; and assigns the values of the columns in your result set to the PHP variables to which - they were bound with the PDOStatement::bindParam + they were bound with the method @@ -77,11 +80,6 @@ property names that correspond to the column names returned in your result set - - PDO::FETCH_SERIALIZE: returns an anonymous object with - property names that correspond to the column names returned in your - result set - @@ -97,7 +95,7 @@ scrollable cursor for your PDOStatement object, you must set the PDO::ATTR_CURSOR attribute to PDO::CURSOR_SCROLL when you prepare the SQL - statement with PDO::prepare. + statement with . @@ -115,7 +113,7 @@ the cursor_orientation parameter is set to PDO::FETCH_ORI_REL, this value specifies the row to fetch relative to the cursor position before - PDOStatement::fetch was called. + was called. @@ -258,11 +256,11 @@ Reading backwards: &reftitle.seealso; - PDO::query - PDOStatement::fetchAll - PDOStatement::fetchColumn - PDOStatement::prepare - PDOStatement::setFetchMode + + + + + diff --git a/reference/pdo/functions/PDOStatement-fetchAll.xml b/reference/pdo/functions/PDOStatement-fetchAll.xml index 7b60b4924e..3ad7a61905 100644 --- a/reference/pdo/functions/PDOStatement-fetchAll.xml +++ b/reference/pdo/functions/PDOStatement-fetchAll.xml @@ -1,19 +1,22 @@ - + - PDOStatement::fetchAll + PDOStatement->fetchAll() Returns an array containing all of the result set rows &reftitle.description; - - arrayPDOStatement::fetchAll - intfetch_style - intcolumn_index - + + PDOStatement + + arrayfetchAll + intfetch_style + intcolumn_index + + @@ -26,7 +29,7 @@ Controls the contents of the returned array as documented in - PDOStatement::fetch. Defaults to + . Defaults to PDO::FETCH_BOTH. @@ -64,7 +67,7 @@ &reftitle.returnvalues; - PDOStatement::fetchAll returns an array containing + returns an array containing all of the remaining rows in the result set. The array represents each row as either an array of column values or an object with properties corresponding to each column name. @@ -215,11 +218,11 @@ array(3) { &reftitle.seealso; - PDO::query - PDOStatement::fetch - PDOStatement::fetchColumn - PDOStatement::prepare - PDOStatement::setFetchMode + + + + + diff --git a/reference/pdo/functions/PDOStatement-fetchColumn.xml b/reference/pdo/functions/PDOStatement-fetchColumn.xml index 12d6f5599a..8b132a8797 100644 --- a/reference/pdo/functions/PDOStatement-fetchColumn.xml +++ b/reference/pdo/functions/PDOStatement-fetchColumn.xml @@ -1,8 +1,8 @@ - + - PDOStatement::fetchColumn + PDOStatement->fetchColumn() Returns a single column from the next row of a result set @@ -10,10 +10,13 @@ &reftitle.description; - - stringPDOStatement::fetchColumn - intcolumn_number - + + PDOStatement + + stringfetchColumn + intcolumn_number + + Returns a single column from the next row of a result set or &false; if @@ -30,7 +33,7 @@ 0-indexed number of the column you wish to retrieve from the row. If - no value is supplied, PDOStatement::fetchColumn + no value is supplied, fetches the first column. @@ -42,13 +45,13 @@ &reftitle.returnvalues; - PDOStatement::fetchColumn returns a single column + returns a single column in the next row of a result set. There is no way to return another column from the same row if you - use PDOStatement::fetchColumn to retrieve data. + use to retrieve data. @@ -91,11 +94,11 @@ colour = red &reftitle.seealso; - PDO::query - PDOStatement::fetch - PDOStatement::fetchAll - PDOStatement::prepare - PDOStatement::setFetchMode + + + + + diff --git a/reference/pdo/functions/PDOStatement-fetchObject.xml b/reference/pdo/functions/PDOStatement-fetchObject.xml index 58503f55d4..c5dca7a494 100644 --- a/reference/pdo/functions/PDOStatement-fetchObject.xml +++ b/reference/pdo/functions/PDOStatement-fetchObject.xml @@ -1,21 +1,24 @@ - + - PDOStatement::fetchObject + PDOStatement->fetchObject() Fetches the next row and returns it as an object. &reftitle.description; - - mixedPDOStatement::fetchObject - stringclass_name - arrayctor_args - + + PDOStatement + + mixedfetchObject + stringclass_name + arrayctor_args + + Fetches the next row and returns it as an object. This function is an - alternative to PDOStatement::fetch with + alternative to with PDO::FETCH_CLASS or PDO::FETCH_OBJ style. @@ -56,7 +59,7 @@ &reftitle.seealso; - PDOStatement::fetch + diff --git a/reference/pdo/functions/PDOStatement-getAttribute.xml b/reference/pdo/functions/PDOStatement-getAttribute.xml index 63e5cb2571..a5ce587074 100644 --- a/reference/pdo/functions/PDOStatement-getAttribute.xml +++ b/reference/pdo/functions/PDOStatement-getAttribute.xml @@ -1,18 +1,21 @@ - + - PDOStatement::getAttribute + PDOStatement->getAttribute() Retrieve a statement attribute &reftitle.description; - - mixedPDOStatement::getAttribute - intattribute - + + PDOStatement + + mixedgetAttribute + intattribute + + Gets an attribute of the statement. Currently, no generic attributes exist but only driver specific: @@ -86,9 +89,9 @@ Use the PEAR Coding Standards &reftitle.seealso; - PDO::getAttribute - PDO::setAttribute - PDOStatement::setAttribute + + + diff --git a/reference/pdo/functions/PDOStatement-getColumnMeta.xml b/reference/pdo/functions/PDOStatement-getColumnMeta.xml index 1ffa220237..21ec26c738 100644 --- a/reference/pdo/functions/PDOStatement-getColumnMeta.xml +++ b/reference/pdo/functions/PDOStatement-getColumnMeta.xml @@ -1,18 +1,21 @@ - + - PDOStatement::getColumnMeta + PDOStatement->getColumnMeta() Returns metadata for a column in a result set &reftitle.description; - - mixedPDOStatement::getColumnMeta - intcolumn - + + PDOStatement + + mixedgetColumnMeta + intcolumn + + &warn.experimental.func; @@ -22,7 +25,7 @@ Not all PDO drivers support - PDOStatement::getColumnMeta. + . @@ -69,7 +72,7 @@ driver:decl_type The SQL type used to represent the column value in the database. If the column in the result set is the result of a function, this value - is not returned by PDOStatement::getColumnMeta. + is not returned by . @@ -185,8 +188,8 @@ array(6) { &reftitle.seealso; - PDOStatement::columnCount - PDOStatement::rowCount + + diff --git a/reference/pdo/functions/PDOStatement-nextRowset.xml b/reference/pdo/functions/PDOStatement-nextRowset.xml index c84d8a4b81..b7f0f3475f 100644 --- a/reference/pdo/functions/PDOStatement-nextRowset.xml +++ b/reference/pdo/functions/PDOStatement-nextRowset.xml @@ -1,23 +1,26 @@ - + - PDOStatement::nextRowset + PDOStatement->nextRowset() Advances to the next rowset in a multi-rowset statement handle &reftitle.description; - - boolPDOStatement::nextRowset - - + + PDOStatement + + boolnextRowset + + + Some database servers support stored procedures that return more than one rowset (also known as a result set). - PDOStatement::nextRowSet enables you to access the + enables you to access the second and subsequent rowsets associated with a PDOStatement object. Each rowset can have a different set of columns from the preceding rowset. @@ -38,7 +41,7 @@ The following example shows how to call a stored procedure, MULTIPLE_RESULTS, that returns three rowsets. We use a do / while loop to - loop over the PDOStatement::nextRowset method, which + loop over the method, which returns false and terminates the loop when no more rowsets can be returned. @@ -93,10 +96,10 @@ banana yellow &reftitle.seealso; - PDOStatement::columnCount - PDOStatement::execute - PDOStatement::getColumnMeta - PDOStatement::query + + + + diff --git a/reference/pdo/functions/PDOStatement-rowCount.xml b/reference/pdo/functions/PDOStatement-rowCount.xml index df0919780a..8291400c66 100644 --- a/reference/pdo/functions/PDOStatement-rowCount.xml +++ b/reference/pdo/functions/PDOStatement-rowCount.xml @@ -1,21 +1,24 @@ - + - PDOStatement::rowCount + PDOStatement->rowCount() Returns the number of rows affected by the last SQL statement &reftitle.description; - - intPDOStatement::rowCount - - + + PDOStatement + + introwCount + + + - PDOStatement::rowCount returns the number of + returns the number of rows affected by the last DELETE, INSERT, or UPDATE statement executed by the corresponding PDOStatement object. @@ -33,7 +36,7 @@ Return the number of deleted rows - PDOStatement::rowCount returns the number of + returns the number of rows affected by a DELETE, INSERT, or UPDATE statement. @@ -60,11 +63,11 @@ Deleted 9 rows. Counting rows returned by a SELECT statement - For most databases, PDOStatement::rowCount does not + For most databases, does not return the number of rows affected by a SELECT statement. Instead, use - PDO::query to issue a SELECT COUNT(*) statement + to issue a SELECT COUNT(*) statement with the same predicates as your intended SELECT statement, then use - PDOStatement::fetchColumn to retrieve the number + to retrieve the number of rows that will be returned. Your application can then perform the correct action. @@ -111,9 +114,9 @@ pear &reftitle.seealso; - PDOStatement::columnCount - PDOStatement::fetchColumn - PDOStatement::query + + + diff --git a/reference/pdo/functions/PDOStatement-setAttribute.xml b/reference/pdo/functions/PDOStatement-setAttribute.xml index 92c14dbd88..2e68a0a765 100644 --- a/reference/pdo/functions/PDOStatement-setAttribute.xml +++ b/reference/pdo/functions/PDOStatement-setAttribute.xml @@ -1,19 +1,22 @@ - + - PDOStatement::setAttribute + PDOStatement->setAttribute() Set a statement attribute &reftitle.description; - - boolPDOStatement::setAttribute - intattribute - mixedvalue - + + PDOStatement + + boolsetAttribute + intattribute + mixedvalue + + Sets an attribute on the statement. Currently, no generic attributes are set but only driver specific: @@ -130,9 +133,9 @@ Use the PEAR Coding Standards &reftitle.seealso; - PDO::getAttribute - PDO::setAttribute - PDOStatement::getAttribute + + + diff --git a/reference/pdo/functions/PDOStatement-setFetchMode.xml b/reference/pdo/functions/PDOStatement-setFetchMode.xml index b2122a69c2..bb61e970a4 100644 --- a/reference/pdo/functions/PDOStatement-setFetchMode.xml +++ b/reference/pdo/functions/PDOStatement-setFetchMode.xml @@ -1,37 +1,49 @@ - + - PDOStatement::setFetchMode + PDOStatement->setFetchMode() Set the default fetch mode for this statement &reftitle.description; - - boolPDOStatement::setFetchMode - intmode - + + PDOStatement + + boolsetFetchMode + intmode + + - - boolPDOStatement::setFetchMode - intPDO::FETCH_COLUMN - intcolno - + + PDOStatement + + boolsetFetchMode + intPDO::FETCH_COLUMN + intcolno + + - - boolPDOStatement::setFetchMode - intPDO::FETCH_CLASS - stringclassname - arrayctorargs - + + PDOStatement + + boolsetFetchMode + intPDO::FETCH_CLASS + stringclassname + arrayctorargs + + - - boolPDOStatement::setFetchMode - intPDO::FETCH_INTO - objectobject - + + PDOStatement + + boolsetFetchMode + intPDO::FETCH_INTO + objectobject + + @@ -64,7 +76,7 @@ Setting the fetch mode The following example demonstrates how - PDOStatement::setFetchMode changes the default fetch + changes the default fetch mode for a PDOStatement object. diff --git a/reference/pdo/reference.xml b/reference/pdo/reference.xml index 7907cf2287..93b56c79f8 100644 --- a/reference/pdo/reference.xml +++ b/reference/pdo/reference.xml @@ -1,5 +1,5 @@ - + @@ -239,12 +239,12 @@ $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array( connection. Auto-commit mode means that every query that you run has its own implicit transaction, if the database supports it, or no transaction if the database doesn't support transactions. If you need a transaction, - you must use the PDO::beginTransaction method to + you must use the method to initiate one. If the underlying driver does not support transactions, a PDOException will be thrown (regardless of your error handling settings: this is always a serious error condition). Once you are in a transaction, - you may use PDO::commit or - PDO::rollBack to finish it, depending on the success + you may use or + to finish it, depending on the success of the code you run during the transaction. @@ -259,7 +259,7 @@ $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array( The automatic rollback only happens if you initiate the transaction via - PDO::beginTransaction. If you manually issue a + . If you manually issue a query that begins a transaction PDO has no way of knowing about it and thus cannot roll it back if something bad happens. @@ -272,8 +272,8 @@ $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array( In addition to entering the basic data for that person, we also need to record their salary. It's pretty simple to make two separate updates, but by enclosing them within the - PDO::beginTransaction and - PDO::commit calls, we are guaranteeing that no one + and + calls, we are guaranteeing that no one else will be able to see those changes until they are complete. If something goes wrong, the catch block rolls back all changes made since the transaction was started, and then prints out an error @@ -509,12 +509,12 @@ $stmt->execute(array("%$_GET[name]%")); This is the default mode. PDO will simply set the error code for you - to inspect using the PDO::errorCode and - PDO::errorInfo methods on both the + to inspect using the and + methods on both the statement and database objects; if the error resulted from a call on a statement object, you would invoke the - PDOStatement::errorCode or - PDOStatement::errorInfo + or + method on that object. If the error resulted from a call on the database object, you would invoke those methods on the database object instead. @@ -560,10 +560,10 @@ $stmt->execute(array("%$_GET[name]%")); PDO standardizes on using SQL-92 SQLSTATE error code strings; individual PDO drivers are responsible for mapping their native codes to the - appropriate SQLSTATE codes. The PDO::errorCode + appropriate SQLSTATE codes. The method returns a single SQLSTATE code. If you need more specific information about an error, PDO also offers an - PDO::errorInfo method which returns an array + method which returns an array containing the SQLSTATE code, the driver specific error code and driver specific error string. @@ -578,8 +578,8 @@ $stmt->execute(array("%$_GET[name]%")); "large". Large objects can be either textual or binary in nature. PDO allows you to work with this large data type by using the PDO::PARAM_LOB - type code in your PDOStatement::bindParam or - PDOStatement::bindColumn calls. + type code in your or + calls. PDO::PARAM_LOB tells PDO to map the data as a stream, so that you can manipulate it using the PHP Streams API.