PHP Data Objects
Introduction
The PHP Data Objects (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. Note that you cannot perform any database functions using the PDO extension by itself; you must use a database-specific PDO driver to access a database server.
PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.
PDO ships with PHP.
- Installing/Configuring
- Predefined Constants
- Connections and Connection management
- Transactions and auto-commit
- Prepared statements and stored procedures
- Errors and error handling
- Large Objects (LOBs)
- PDO — The PDO class
- PDO::beginTransaction — Initiates a transaction
- PDO::commit — Commits a transaction
- PDO::connect — Connect to a database and return a PDO subclass for drivers that support it
- PDO::__construct — Creates a PDO instance representing a connection to a database
- PDO::errorCode — Fetch the SQLSTATE associated with the last operation on the database handle
- PDO::errorInfo — Fetch extended error information associated with the last operation on the database handle
- PDO::exec — Execute an SQL statement and return the number of affected rows
- PDO::getAttribute — Retrieve a database connection attribute
- PDO::getAvailableDrivers — Return an array of available PDO drivers
- PDO::inTransaction — Checks if inside a transaction
- PDO::lastInsertId — Returns the ID of the last inserted row or sequence value
- PDO::prepare — Prepares a statement for execution and returns a statement object
- PDO::query — Prepares and executes an SQL statement without placeholders
- PDO::quote — Quotes a string for use in a query
- PDO::rollBack — Rolls back a transaction
- PDO::setAttribute — Set an attribute
- PDOStatement — The PDOStatement class
- PDOStatement::bindColumn — Bind a column to a PHP variable
- PDOStatement::bindParam — Binds a parameter to the specified variable name
- PDOStatement::bindValue — Binds a value to a parameter
- PDOStatement::closeCursor — Closes the cursor, enabling the statement to be executed again
- PDOStatement::columnCount — Returns the number of columns in the result set
- PDOStatement::debugDumpParams — Dump an SQL prepared command
- PDOStatement::errorCode — Fetch the SQLSTATE associated with the last operation on the statement handle
- PDOStatement::errorInfo — Fetch extended error information associated with the last operation on the statement handle
- PDOStatement::execute — Executes a prepared statement
- PDOStatement::fetch — Fetches the next row from a result set
- PDOStatement::fetchAll — Fetches the remaining rows from a result set
- PDOStatement::fetchColumn — Returns a single column from the next row of a result set
- PDOStatement::fetchObject — Fetches the next row and returns it as an object
- PDOStatement::getAttribute — Retrieve a statement attribute
- PDOStatement::getColumnMeta — Returns metadata for a column in a result set
- PDOStatement::getIterator — Gets result set iterator
- PDOStatement::nextRowset — Advances to the next rowset in a multi-rowset statement handle
- PDOStatement::rowCount — Returns the number of rows affected by the last SQL statement
- PDOStatement::setAttribute — Set a statement attribute
- PDOStatement::setFetchMode — Set the default fetch mode for this statement
- PDORow — The PDORow class
- PDOException — The PDOException class
- PDO Drivers
- CUBRID PDO Driver — CUBRID PDO Driver (PDO_CUBRID)
- MS SQL Server PDO Driver — Microsoft SQL Server and Sybase PDO Driver (PDO_DBLIB)
- Pdo\Dblib — The Pdo\Dblib class
- Firebird PDO Driver — Firebird PDO Driver (PDO_FIREBIRD)
- Pdo\Firebird — The Pdo\Firebird class
- IBM PDO Driver — IBM PDO Driver (PDO_IBM)
- Informix PDO Driver — Informix PDO Driver (PDO_INFORMIX)
- MySQL PDO Driver — MySQL PDO Driver (PDO_MYSQL)
- Pdo\Mysql — The Pdo\Mysql class
- MS SQL Server PDO Driver — Microsoft SQL Server PDO Driver (PDO_SQLSRV)
- Oracle PDO Driver — Oracle PDO Driver (PDO_OCI)
- ODBC and DB2 PDO Driver — ODBC and DB2 PDO Driver (PDO_ODBC)
- Pdo\Odbc — The Pdo\Odbc class
- PostgreSQL PDO Driver — PostgreSQL PDO Driver (PDO_PGSQL)
- Pdo\Pgsql — The Pdo\Pgsql class
- SQLite PDO Driver — SQLite PDO Driver (PDO_SQLITE)
- Pdo\Sqlite — The Pdo\Sqlite class