New PDO ($dsn, $username, $passwd [, $options])
$options can set database connection properties, such as:
$options =array (pdo::attr_autocommit=>0,pdo::attr_autocommit=>pdo::errmode_exception);
EXEC () cannot perform a select operation; exec () returns FALSE if the SQL statement is wrong
ErrorInfo () return value is an array that contains:0->sqlstate,1-> error code,2-> error message
Query () returns FALSE if SQL statement is incorrect
Prepare () Prepares a statement, execute () executes this statement
QUOTE () returns a quoted string and filters the special characters in the string with a backslash escape
Some common parameters for SetAttribute () and GetAttribute (): (A successful call returns the requested PDO property value.) return null if unsuccessful)
-
The following constants are applied to the database connection:
- Pdo::attr_autocommit whether to submit automatically
- pdo::attr_case field names are case-sensitive
- Pdo::attr_client_version Client Version
- Pdo::attr_connection_status Connection Status
- Pdo::attr_driver_name
- Pdo::attr_errmode Default error handling mode
- Pdo::attr_oracle_nulls returns an empty string, converted to NULL for SQL
- Pdo::attr_persistent database is persistent connection
- Pdo::attr_prefetch
- Pdo::attr_server_info Server information
- Pdo::attr_server_version Server version
- Pdo::attr_timeout Time-out setting
Several modes of Setfetchmode (): Setfetchmode (PDO::FETCH_ASSOC) Setfetchmode (Pdo::fetch_both) Setfetchmode (PDO::FETCH_OBJ)
You can also set several modes of fetch ()/Fetch_all () Directly: Fetch (PDO::FETCH_ASSOC) FETCH (Pdo::fetch_both) fetch (pdo::fetch_obj)
RowCount () can also return the number of rows of the result set obtained by the SELECT statement
PDO Database Abstraction Layer