diff --git a/reference/pdo/constants.xml b/reference/pdo/constants.xml new file mode 100644 index 0000000000..3eb500ec18 --- /dev/null +++ b/reference/pdo/constants.xml @@ -0,0 +1,426 @@ + + + +
+ &reftitle.constants; + &extension.constants; + + + + PDO_PARAM_NULL + (integer) + + + + + + + + + + PDO_PARAM_INT + (integer) + + + + + + + + + + PDO_PARAM_STR + (integer) + + + + + + + + + + PDO_PARAM_LOB + (integer) + + + + + + + + + + PDO_PARAM_STMT + (integer) + + + + + + + + + + PDO_FETCH_LAZY + (integer) + + + + + + + + + + PDO_FETCH_ASSOC + (integer) + + + + + + + + + + PDO_FETCH_NUM + (integer) + + + + + + + + + + PDO_FETCH_BOTH + (integer) + + + + + + + + + + PDO_FETCH_OBJ + (integer) + + + + + + + + + + PDO_ATTR_AUTOCOMMIT + (integer) + + + + + + + + + + PDO_ATTR_SCROLL + (integer) + + + + + + + + + + PDO_ATTR_PREFETCH + (integer) + + + + + + + + + + PDO_ATTR_TIMEOUT + (integer) + + + + + + + + + + PDO_ATTR_ERRMODE + (integer) + + + + + + + + + + PDO_ATTR_SERVER_VERSION + (integer) + + + + + + + + + + PDO_ATTR_CLIENT_VERSION + (integer) + + + + + + + + + + PDO_ATTR_SERVER_INFO + (integer) + + + + + + + + + + PDO_ATTR_CONNECTION_STATUS + (integer) + + + + + + + + + + PDO_ATTR_CASE + (integer) + + + + + + + + + + PDO_ERRMODE_SILENT + (integer) + + + + + + + + + + PDO_ERRMODE_WARNING + (integer) + + + + + + + + + + PDO_ERRMODE_EXCEPTION + (integer) + + + + + + + + + + PDO_CASE_NATURAL + (integer) + + + + + + + + + + PDO_CASE_LOWER + (integer) + + + + + + + + + + PDO_CASE_UPPER + (integer) + + + + + + + + + + PDO_ERR_NONE + (integer) + + + + + + + + + + PDO_ERR_CANT_MAP + (integer) + + + + + + + + + + PDO_ERR_SYNTAX + (integer) + + + + + + + + + + PDO_ERR_CONSTRAINT + (integer) + + + + + + + + + + PDO_ERR_NOT_FOUND + (integer) + + + + + + + + + + PDO_ERR_ALREADY_EXISTS + (integer) + + + + + + + + + + PDO_ERR_NOT_IMPLEMENTED + (integer) + + + + + + + + + + PDO_ERR_MISMATCH + (integer) + + + + + + + + + + PDO_ERR_TRUNCATED + (integer) + + + + + + + + + + PDO_ERR_DISCONNECTED + (integer) + + + + + + + + +
+ + diff --git a/reference/pdo/functions/PDO-beginTransaction.xml b/reference/pdo/functions/PDO-beginTransaction.xml new file mode 100644 index 0000000000..fbe73456c8 --- /dev/null +++ b/reference/pdo/functions/PDO-beginTransaction.xml @@ -0,0 +1,45 @@ + + + + + + PDO::beginTransaction + + Initiates a transaction + + + + Description + + boolPDO::beginTransaction + + + &warn.experimental.func; + + Turns off autocommit mode. Call PDO::commit or + PDO::rollback to end the transaction and return to + autocommit mode. + + + + + diff --git a/reference/pdo/functions/PDO-commit.xml b/reference/pdo/functions/PDO-commit.xml new file mode 100644 index 0000000000..b040f0e9a9 --- /dev/null +++ b/reference/pdo/functions/PDO-commit.xml @@ -0,0 +1,45 @@ + + + + + + PDO::commit + + Commits a transaction + + + + Description + + boolPDO::commit + + + &warn.experimental.func; + + Commits a transaction, returning the database connection to autocommit + mode until the next call to PDO::beginTransaction + starts a new transaction. + + + + + diff --git a/reference/pdo/functions/PDO-construct.xml b/reference/pdo/functions/PDO-construct.xml new file mode 100644 index 0000000000..69f3e17122 --- /dev/null +++ b/reference/pdo/functions/PDO-construct.xml @@ -0,0 +1,45 @@ + + + + + + PDO::__construct + + + + + + Description + + objectPDO::__construct + stringdsn + stringusername + stringpasswd + arraydriver_opts + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDO-errorCode.xml b/reference/pdo/functions/PDO-errorCode.xml new file mode 100644 index 0000000000..8b2f7a5246 --- /dev/null +++ b/reference/pdo/functions/PDO-errorCode.xml @@ -0,0 +1,42 @@ + + + + + + PDO::errorCode + + Fetch the error code associated with the last operation on the database handle + + + + Description + + intPDO::errorCode + + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDO-errorInfo.xml b/reference/pdo/functions/PDO-errorInfo.xml new file mode 100644 index 0000000000..ba478ea359 --- /dev/null +++ b/reference/pdo/functions/PDO-errorInfo.xml @@ -0,0 +1,42 @@ + + + + + + PDO::errorInfo + + Fetch extended error information associated with the last operation on the database handle + + + + Description + + intPDO::errorInfo + + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDO-exec.xml b/reference/pdo/functions/PDO-exec.xml new file mode 100644 index 0000000000..91345aff31 --- /dev/null +++ b/reference/pdo/functions/PDO-exec.xml @@ -0,0 +1,42 @@ + + + + + + PDO::exec + + Execute a query that does not return a row set, returning the number of affected rows + + + + Description + + longPDO::exec + stringquery + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDO-lastInsertId.xml b/reference/pdo/functions/PDO-lastInsertId.xml new file mode 100644 index 0000000000..16a23b82df --- /dev/null +++ b/reference/pdo/functions/PDO-lastInsertId.xml @@ -0,0 +1,42 @@ + + + + + + PDO::lastInsertId + + Returns the number id of rows that we affected by the last call to PDO::exec(). Not always meaningful. + + + + Description + + intPDO::lastInsertId + + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDO-prepare.xml b/reference/pdo/functions/PDO-prepare.xml new file mode 100644 index 0000000000..48addbd576 --- /dev/null +++ b/reference/pdo/functions/PDO-prepare.xml @@ -0,0 +1,60 @@ + + + + + + PDO::prepare + + Prepares a statement for execution and returns a statement object + + + + Description + + objectPDO::prepare + stringstatement + intoptions + + + &warn.experimental.func; + + Prepares an SQL statement to be executed by the statement-handle + PDO::execute method. The SQL statement can contain zero + or more named (:name) or question mark (?) parameter markers. + + Prepare and execute an SQL statement + +prepare('SELECT name, colour, calories + FROM fruit + WHERE calories < :calories AND colour = :colour'); +$sth->execute(array(':calories' => 150, ':colour' => 'red')); +?> +]]> + + + + + + diff --git a/reference/pdo/functions/PDO-rollBack.xml b/reference/pdo/functions/PDO-rollBack.xml new file mode 100644 index 0000000000..8901fc0a57 --- /dev/null +++ b/reference/pdo/functions/PDO-rollBack.xml @@ -0,0 +1,45 @@ + + + + + + PDO::rollBack + + Rolls back a transaction + + + + Description + + boolPDO::rollBack + + + + &warn.experimental.func; + + Rolls back a transaction, returning the connection state to autocommit mode. + + + + + + diff --git a/reference/pdo/functions/PDO-setAttribute.xml b/reference/pdo/functions/PDO-setAttribute.xml new file mode 100644 index 0000000000..3e1402a9a7 --- /dev/null +++ b/reference/pdo/functions/PDO-setAttribute.xml @@ -0,0 +1,64 @@ + + + + + + PDO::setAttribute + + Set an attribute + + + + Description + + boolPDO::setAttribute + intattribute + mixedvalue + + + &warn.experimental.func; + + Sets a database connection attribute. The generic PDO connection attributes + include: + + + PDO_ATTR_CASE: Force column names to a specific case. + + + PDO_CASE_LOWER: Force column names to lower case. + + + PDO_CASE_NATURAL: Leave column names as returned by + the database driver. + + + PDO_CASE_UPPER: Force column names to upper case. + + + + + PDO drivers may define further driver-specific attributes. + + + + + diff --git a/reference/pdo/functions/PDOStatement-bindColumn.xml b/reference/pdo/functions/PDOStatement-bindColumn.xml new file mode 100644 index 0000000000..74f244c99d --- /dev/null +++ b/reference/pdo/functions/PDOStatement-bindColumn.xml @@ -0,0 +1,46 @@ + + + + + + PDOStatement::bindColumn + + bind a column to a PHP variable. On each row fetch $param will contain the value of the corresponding column. $column is the 1-based offset of the column, or the column name. For portability, don't call this before execute(). + + + + Description + + boolPDOStatement::bindColumn + mixed$column + mixed$param + int$type + int$maxlen + mixed$driverdata + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDOStatement-bindParam.xml b/reference/pdo/functions/PDOStatement-bindParam.xml new file mode 100644 index 0000000000..b3389b5173 --- /dev/null +++ b/reference/pdo/functions/PDOStatement-bindParam.xml @@ -0,0 +1,94 @@ + + + + + + PDOStatement::bindParam + + Binds a parameter to a the specified variable name + + + + Description + + boolPDOStatement::bindParam + mixedparameter_name + mixedvariable + intdata_type + intlength + + &warn.experimental.func; + + Binds an SQL statement parameter to the specified variable name. The SQL statement + parameter can either be a named placeholder or a question mark placeholder. + + + Output parameters will set the value of the bound PHP variable to the value + returned by the database when the SQL statement is executed. This enables you + to call stored procedures with output or input/output parameters, for example, + for databases that support such features. + + + For input-only variables, you can pass an array of input values to + PDOStatement::execute instead. + + Execute a prepared statement with named placeholders + + prepare('SELECT name, colour, calories + FROM fruit + WHERE calories < :calories AND colour = :colour'); +$sth->bindParam(':calories', $calories, PDO_PARAM_INT); +$sth->bindParam(':colour', $colour, PDO_PARAM_STR, 12); +$sth->execute(); +]]> + + + + Execute a prepared statement with question mark placeholders + + prepare('SELECT name, colour, calories + FROM fruit + WHERE calories < ? AND colour = ?'); +$sth->bindParam(1, $calories, PDO_PARAM_INT); +$sth->bindParam(2, $colour, PDO_PARAM_STR, 12); +$sth->execute(); +?> +]]> + + + + + + + + + diff --git a/reference/pdo/functions/PDOStatement-errorCode.xml b/reference/pdo/functions/PDOStatement-errorCode.xml new file mode 100644 index 0000000000..bf31c101d7 --- /dev/null +++ b/reference/pdo/functions/PDOStatement-errorCode.xml @@ -0,0 +1,42 @@ + + + + + + PDOStatement::errorCode + + Fetch the error code associated with the last operation on the statement handle + + + + Description + + intPDOStatement::errorCode + + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDOStatement-errorInfo.xml b/reference/pdo/functions/PDOStatement-errorInfo.xml new file mode 100644 index 0000000000..c5d5ef87b9 --- /dev/null +++ b/reference/pdo/functions/PDOStatement-errorInfo.xml @@ -0,0 +1,42 @@ + + + + + + PDOStatement::errorInfo + + Fetch extended error information associated with the last operation on the statement handle + + + + Description + + intPDOStatement::errorInfo + + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDOStatement-execute.xml b/reference/pdo/functions/PDOStatement-execute.xml new file mode 100644 index 0000000000..e2d758f76c --- /dev/null +++ b/reference/pdo/functions/PDOStatement-execute.xml @@ -0,0 +1,103 @@ + + + + + + PDOStatement::execute + + Executes a prepared statement + + + + Description + + boolPDOStatement::execute + arrayinput_parameters + + &warn.experimental.func; + + Execute the prepared statement. If the prepared statement included + parameter markers, you must either: + + call PDOStatement::bindParam 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 + + + + Execute a prepared statement with bound variables + + prepare('SELECT name, colour, calories + FROM fruit + WHERE calories < :calories AND colour = :colour'); +$sth->bindParam(':calories', $calories, PDO_PARAM_INT); +$sth->bindParam(':colour', $colour, PDO_PARAM_STR, 12); +$sth->execute(); +]]> + + + + Execute a prepared statement with an array of insert values + + prepare('SELECT name, colour, calories + FROM fruit + WHERE calories < :calories AND colour = :colour'); +$sth->bindParam(':calories', $calories, PDO_PARAM_INT); +$sth->bindParam(':colour', $colour, PDO_PARAM_STR, 12); +$sth->execute(array(':calories' => $calories, ':colour' => $colour)); +?> +]]> + + + + Execute a prepared statement with question mark placeholders + + prepare('SELECT name, colour, calories + FROM fruit + WHERE calories < ? AND colour = ?'); +$sth->bindParam(1, $calories, PDO_PARAM_INT); +$sth->bindParam(2, $colour, PDO_PARAM_STR, 12); +$sth->execute(); +?> +]]> + + + + + + diff --git a/reference/pdo/functions/PDOStatement-fetch.xml b/reference/pdo/functions/PDOStatement-fetch.xml new file mode 100644 index 0000000000..6b1e1e3fd3 --- /dev/null +++ b/reference/pdo/functions/PDOStatement-fetch.xml @@ -0,0 +1,77 @@ + + + + + + PDOStatement::fetch + + Fetches the next row from a result set + + + + Description + + arrayPDOStatement::fetch + intfetch_style + + + &warn.experimental.func; + + Fetches a row from a result set associated with a PDOStatement object. + + + fetch_style can be one of the following values: + + + PDO_FETCH_NUM: returns an array indexed by column + number as returned in your result set, starting at column 0 + + + PDO_FETCH_ASSOC: returns an array indexed by column + name as returned in your result set + + + PDO_FETCH_BOTH (default): returns an array indexed by + both column name and column number as returned in your result set + + + PDO_FETCH_OBJ: returns an anonymous object with + property names that correspond to the column names returned in your + result set + + + PDO_FETCH_LAZY: combines + PDO_FETCH_BOTH and PDO_FETCH_OBJ, + creating the object variable names as they are accessed + + + 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 PDO::bindParam method + + + + + + + + diff --git a/reference/pdo/functions/PDOStatement-fetchAll.xml b/reference/pdo/functions/PDOStatement-fetchAll.xml new file mode 100644 index 0000000000..6a404da252 --- /dev/null +++ b/reference/pdo/functions/PDOStatement-fetchAll.xml @@ -0,0 +1,43 @@ + + + + + + PDOStatement::fetchAll + + Returns an array of all of the results. + + + + Description + + arrayPDOStatement::fetchAll + int$how + =PDO_FETCH_BOTH + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDOStatement-fetchSingle.xml b/reference/pdo/functions/PDOStatement-fetchSingle.xml new file mode 100644 index 0000000000..d8d83752cd --- /dev/null +++ b/reference/pdo/functions/PDOStatement-fetchSingle.xml @@ -0,0 +1,42 @@ + + + + + + PDOStatement::fetchSingle + + Returns a data of the 1st column in the result set. + + + + Description + + stringPDOStatement::fetchSingle + + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/functions/PDOStatement-rowCount.xml b/reference/pdo/functions/PDOStatement-rowCount.xml new file mode 100644 index 0000000000..c7c6d26a0a --- /dev/null +++ b/reference/pdo/functions/PDOStatement-rowCount.xml @@ -0,0 +1,42 @@ + + + + + + PDOStatement::rowCount + + Returns the number of rows in a result set, or the number of rows affected by the last execute(). It is not always meaningful. + + + + Description + + intPDOStatement::rowCount + + + + &warn.undocumented.func; + + + + + diff --git a/reference/pdo/reference.xml b/reference/pdo/reference.xml index d203845bcc..4f02efd6e2 100644 --- a/reference/pdo/reference.xml +++ b/reference/pdo/reference.xml @@ -1,101 +1,173 @@ - - - PHP Data Objects - PDO - -
- &reftitle.intro; - - &warn.experimental; - The PDO extension defines a lightweight, consistent interface - for accessing databases in PHP. Each database driver that - implements the PDO interface can expose database-specific - features as regular extension functions. - -
- -
- &reftitle.classes; -
- <classname>PDO</classname> - - Represents a connection between PHP and a database server. - -
- &reftitle.constructor; - - - PDO - constructs a new PDO - object - - -
-
- &reftitle.methods; - - - beginTransaction - - begins a transaction - - - commit - commits a - transaction - - - errorInfo - - retrieves an array of error information, if any, from the - database - - - getMessage - - retrieves an error message, if any, from the database - - - prepare - prepares - an SQL statement for execution - - - rollback - roll - back a transaction - - - setAttribute - - sets a database connection attribute - - -
-
-
- <classname>Statement</classname> - Represents a prepared statement and, after the statement is - executed, an associated result set. -
- &reftitle.methods; - - - bindParam - binds a - PHP variable to a parameter in the prepared statement - - - execute - executes a - prepared statement - - - fetch - fetches a - row from a result set - - -
-
-
-
- &reference.pdo.functions; -
+ + + + pdo Functions + pdo + +
+ &reftitle.intro; + + &warn.experimental; + The PDO extension defines a lightweight, consistent interface + for accessing databases in PHP. Each database driver that + implements the PDO interface can expose database-specific + features as regular extension functions. + +
+
+ &reftitle.install; + + PDO is currently available as a PECL extension from + &url.pecl.package;pdo. + Ensure you have installed the CGI version of PHP and that the + pear and phpize scripts are + available in your current path. + + + Run the following command to download, build, and install the + latest stable version of PDO: + + + + + + Windows users can download the extension DLL pdo.dll + from &url.pecl.get.win; + + + The pear command automatically installs the + PDO module into your PHP extensions directory. To enable the + PDO extension on UNIX or Linux operating systems, you must add + the following line to &php.ini;: + + + + To enable the PDO extension on Windows operating systems, you must + add the following line to &php.ini;: + + + + +
+
+ &reftitle.classes; +
+ <classname>PDO</classname> + + Represents a connection between PHP and a database server. + +
+ &reftitle.constructor; + + + PDO - constructs a new PDO + object + + +
+
+ &reftitle.methods; + + + beginTransaction + - begins a transaction + + + commit - commits a + transaction + + + exec - issues an SQL + statement + + + errorCode - + retrieves an error code, if any, from the database + + + errorInfo - + retrieves an array of error information, if any, from the + database + + + lastInsertID - + retrieves the value of the last row that was inserted into a + table + + + prepare - prepares + an SQL statement for execution + + + rollback - roll + back a transaction + + + setAttribute - + sets a database connection attribute + + +
+
+
+ <classname>PDOStatement</classname> + Represents a prepared statement and, after the statement is + executed, an associated result set. +
+ &reftitle.methods; + + + bindColumn - binds a + PHP variable to an output column in a result set + + + bindParam - binds a + PHP variable to a parameter in the prepared statement + + + errorCode - + retrieves an error code, if any, from the statement + + + errorInfo - + retrieves an array of error information, if any, from the statement + + + execute - executes a + prepared statement + + + fetch - fetches a + row from a result set + + + fetchAll - fetches an + array containing all of the rows from a result set + + + fetchSingle - returns + the data from the first column in a result set + + + rowCount - returns the + number of rows that were affected by the execution of an SQL statement + + +
+
+
+ &reference.pdo.constants; +
+ &reference.pdo.functions; +