diff --git a/reference/pdo/functions/pdo-beginTransaction.xml b/reference/pdo/functions/pdo-beginTransaction.xml new file mode 100644 index 0000000000..ed01bcb1b2 --- /dev/null +++ b/reference/pdo/functions/pdo-beginTransaction.xml @@ -0,0 +1,21 @@ + + + + + beginTransaction + Begins a transaction. + + + Description + + ??? beginTransaction + + + &warn.experimental.func; + + Turns off autocommit mode. Call commit or + rollback to end the transaction and return to + autocommit mode. + + + diff --git a/reference/pdo/functions/pdo-bindParam.xml b/reference/pdo/functions/pdo-bindParam.xml new file mode 100644 index 0000000000..49fc6fa42f --- /dev/null +++ b/reference/pdo/functions/pdo-bindParam.xml @@ -0,0 +1,42 @@ + + + + + bindParam + Binds a parameter to the specified variable name. + + + Description + + ??? bindParam + String + parameter-name + var + variable-name + integer + data-type + integer + length + + &warn.experimental.func; + + Binds a parameter to the specified variable name. + + Execute a prepared statement with bound variables + 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/pdo-commit.xml b/reference/pdo/functions/pdo-commit.xml new file mode 100644 index 0000000000..aaa4c46a29 --- /dev/null +++ b/reference/pdo/functions/pdo-commit.xml @@ -0,0 +1,22 @@ + + + + + commit + Commits a transaction. + + + Description + + ??? commit + + + &warn.experimental.func; + + Commits a transaction, returning the database connection to autocommit + mode until the next call to beginTransaction + starts a new transaction. + + + + diff --git a/reference/pdo/functions/pdo-execute.xml b/reference/pdo/functions/pdo-execute.xml new file mode 100644 index 0000000000..bbc0f623a0 --- /dev/null +++ b/reference/pdo/functions/pdo-execute.xml @@ -0,0 +1,53 @@ + + + + + execute + Executes a prepared statement. + + + Description + + ??? execute + array + parameters + + &warn.experimental.func; + + Execute the prepared statement. If the prepared statement included + parameter markers, you must either: + + call 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 parameter values + + Execute a prepared statement with bound variables + 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(); + ]]> + + + Execute a prepared statement by passing an array of + values + prepare('SELECT name, colour, calories + FROM fruit + WHERE calories < ?' AND colour = ?); +$sth->execute(array(150, 'red')); + ]]> + + + + + + diff --git a/reference/pdo/functions/pdo-fetch.xml b/reference/pdo/functions/pdo-fetch.xml new file mode 100644 index 0000000000..fd8d679562 --- /dev/null +++ b/reference/pdo/functions/pdo-fetch.xml @@ -0,0 +1,48 @@ + + + + + fetch + Fetches a row from a result set. + + + Description + + array fetch + integer + PDO_FETCH_STYLE + + &warn.experimental.func; + + Fetches a row from a result set associated with a Statement object. + + + PDO_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 + bindParam method + + + + + + diff --git a/reference/pdo/functions/pdo-prepare.xml b/reference/pdo/functions/pdo-prepare.xml new file mode 100644 index 0000000000..f5e991c5f8 --- /dev/null +++ b/reference/pdo/functions/pdo-prepare.xml @@ -0,0 +1,33 @@ + + + + + prepare + Prepares an SQL statement. + + + Description + + Statement prepare + String SQL-statement + + &warn.experimental.func; + + Prepares an SQL statement to be executed by the statement-handle + execute method. The SQL statement can contain zero + or more parameter markers. + + Execute a prepared statement by passing an array of + values + prepare('SELECT name, colour, calories + FROM fruit + WHERE calories < ?' AND colour = ?); +$sth->execute(array(150, 'red')); +]]> + + + + + diff --git a/reference/pdo/functions/pdo-rollback.xml b/reference/pdo/functions/pdo-rollback.xml new file mode 100644 index 0000000000..8aa40bb04e --- /dev/null +++ b/reference/pdo/functions/pdo-rollback.xml @@ -0,0 +1,20 @@ + + + + + rollback + Rolls back a transaction. + + + Description + + ??? 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..3e82eee05d --- /dev/null +++ b/reference/pdo/functions/pdo-setAttribute.xml @@ -0,0 +1,35 @@ + + + + + setAttribute + Sets a database connection attribute. + + + Description + + ??? setAttribute + int attribute + int value + + &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/pdo.xml b/reference/pdo/functions/pdo.xml new file mode 100644 index 0000000000..a50711e1f2 --- /dev/null +++ b/reference/pdo/functions/pdo.xml @@ -0,0 +1,57 @@ + + + + + PDO + Creates a PDO instance to represent a connection to a + database. + + + Description + + object PDO + String DSN + String username + String password + + &warn.experimental.func; + + The format of the Data Source Name (DSN) parameter is: + + PDO driver, followed by a colon + followed by optional driver-specific + information + + + + To close a database connection: + + assign a &null; value to the PDO object + let the PDO object go out of scope + + + + Connections are automatically in autocommit mode. Invoke the + beginTransaction method to turn off autocommit, and + call commit or rollback to end + the transaction. PDO automatically rolls back transactions that are ended + by a closed connection handle. + + Create a connection + getMessage(); +} +]]> + + + + + diff --git a/reference/pdo/reference.xml b/reference/pdo/reference.xml new file mode 100644 index 0000000000..3c974618ba --- /dev/null +++ b/reference/pdo/reference.xml @@ -0,0 +1,118 @@ + + + + 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 - construct a new PDO + object + + +
+
+ &reftitle.methods; + + + beginTransaction + - begin a transaction + + + commit - commit 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; +
+ +