PDO is more efficient than ADODB and MDB2. For now, implementing a "database Abstraction Layer" is a long way off, and using a "Database access abstraction Layer" like PDO is a good choice.
Pdo->begintransaction ()-Indicates the rollback start point
Pdo->commit ()-Indicates the rollback end point and executes the SQL
Pdo->__construct ()-Create an instance of the PDO link database
Pdo->errorcode ()-Get error code
Pdo->errorinfo ()-Get the wrong information
Pdo->exec ()-Processes an SQL statement and returns the number of entries affected
Pdo->getattribute ()-Gets a property of a "Database connection object"
Pdo->getavailabledrivers ()-Get a valid PDO drive name
Pdo->lastinsertid ()-Gets the primary key value of the last piece of data written
Pdo->prepare ()-Generates a "Query object"
Pdo->query ()-Processes an SQL statement and returns a "Pdostatement"
Pdo->quote ()-adds quotation marks to a string in a SQL
Pdo->rollback ()-Perform rollback
Pdo->setattribute ()-Set properties for a database connection object
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->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 ()-returns An array containing all of the result set rows
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->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
As you can see from the list of functions, the operation is based on a different object, "PDO" represents a database Connection object (new PDO Generation), "Pdostatement" represents a Query object (Pdo->query ()) or a result set object (pdo- >prepare ().
An example of a "database connection object" that returns "PDO":
Copy the Code code as follows:
$DBH = new PDO (' Mysql:host=localhost;dbname=test ', ' root ', ');
?>
A "Query Object" example, return "Pdostatement":
Copy the Code code as follows:
$sql = "INSERT into ' test '. ' Table ' (' Name ', ' age ') VALUES (?,?);";
$stmt = $dbh->prepare ($sql);
?>
An example of a "result set object" that returns "Pdostatement":
Copy the Code code as follows:
$sql = "SELECT * from ' table ' WHERE ' name ' = ' Samon '";
$stmt = $dbh->query ($sql);
?>
Current 1/2 Page 12 next page
The above describes the Blendfunction php PDO function library (PDO Functions) 1th/2 pages, including the content of blendfunction, I hope to be interested in PHP tutorial friends helpful.