Home > Backend Development > PHP Tutorial > PHP--PDO related classes and methods

PHP--PDO related classes and methods

伊谢尔伦
Release: 2016-11-22 09:28:23
Original
943 people have browsed it

PDO class

represents a connection between PHP and database services

PDO::beginTransaction — Start a transaction

PDO::commit — Commit a transaction

PDO::__construct — Create a PDO representing a database connection Example

PDO::errorCode — Get 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 a SQL statement, And return the number of affected rows

PDO::getAttribute — Retrieve the attributes of a database connection

PDO::getAvailableDrivers — Return an array of available drivers

PDO::inTransaction — Check whether it is within a transaction

PDO ::lastInsertId — Returns the ID or sequence value of the last inserted row

PDO::prepare — Prepares a statement for execution and returns a statement object

PDO::query — Executes an SQL statement, returning a result set as a PDOStatement object

PDO::quote — Quotes a string for use in a query.

PDO::rollBack — Roll back a transaction

PDO::setAttribute — Set attributes

PDOStatement class

represents a prepared statement and This statement represents a related result set when executed.

PDOStatement::bindColumn — Bind a column to a PHP variable

PDOStatement::bindParam — Bind a parameter to the specified variable name

PDOStatement::bindValue — Bind a value to a parameter

PDOStatement:: closeCursor — Closes the cursor so that the statement can be executed again.

PDOStatement::columnCount — Return the number of columns in the result set

PDOStatement::debugDumpParams — Print a SQL preprocessing command

PDOStatement::errorCode — Get the SQLSTATE related to the last statement handle operation

PDOStatement::errorInfo — Get extended error information related to the last statement handle operation

PDOStatement::execute — Execute a prepared statement

PDOStatement::fetch — Get the next row from the result set

PDOStatement::fetchAll — Return a list containing all the results in the result set Array of rows

PDOStatement::fetchColumn — Returns a single column from the next row in the result set.

PDOStatement::fetchObject — Gets the next line and returns it as an object.

PDOStatement::getAttribute — Retrieve a statement attribute

PDOStatement::getColumnMeta — Return metadata for a column in a result set

PDOStatement::nextRowset — Advance to the next rowset in a multi-rowset statement handle

PDOStatement: :rowCount — Returns the number of rows affected by the previous SQL statement

PDOStatement::setAttribute — Sets a statement attribute

PDOStatement::setFetchMode — Sets the default fetch mode for the statement.

PDOException exception class

represents an error generated by PDO. You should not throw a PDOException in your own code.

errorInfo

is equivalent to PDO::errorInfo() or PDOStatement::errorInfo()

message

text error message. Use Exception::getMessage() to access.

code

SQLSTATE error code. Use Exception::getCode() to access.


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template