Trait PDODriverTrait
PDO driver trait
Direct Users
- Cake\Database\Driver\Mysql
 - Cake\Database\Driver\Postgres
 - Cake\Database\Driver\Sqlite
 - Cake\Database\Driver\Sqlserver
 
Properties summary
-  
$_connectionprotectedInstance of PDO.PDO 
Method Summary
-  _connect() protectedEstablishes a connection to the database server
 -  beginTransaction() publicStarts a transaction
 -  commitTransaction() publicCommits a transaction
 -  connection() public
Returns correct connection resource or object that is internally used If first argument is passed, it will set internal connection object or result to the value passed
 -  disconnect() publicDisconnects from database server
 -  isConnected() publicCheck whether or not the driver is connected.
 -  lastInsertId() publicReturns last id generated for a table or sequence in database
 -  prepare() publicPrepares a sql statement to be executed
 -  quote() publicReturns a value in a safe representation to be used in a query string
 -  rollbackTransaction() publicRollback a transaction
 -  supportsQuoting() publicChecks if the driver supports quoting, as PDO_ODBC does not support it.
 
Method Detail
_connect()source protected
_connect( string $dsn , array $config )
Establishes a connection to the database server
Parameters
-  string 
$dsn - A Driver-specific PDO-DSN
 -  array 
$config - configuration to be used for creating connection
 
Returns
booleantrue on success
beginTransaction()source public
beginTransaction( )
Starts a transaction
Returns
booleantrue on success, false otherwise
commitTransaction()source public
commitTransaction( )
Commits a transaction
Returns
booleantrue on success, false otherwise
connection()source public
connection( null|PDO $connection null )
Returns correct connection resource or object that is internally used If first argument is passed, it will set internal connection object or result to the value passed
Parameters
-  null|PDO 
$connectionoptional null - The PDO connection instance.
 
Returns
PDOconnection object used internally
isConnected()source public
isConnected( )
Check whether or not the driver is connected.
Returns
booleanlastInsertId()source public
lastInsertId( string|null $table null , string|null $column null )
Returns last id generated for a table or sequence in database
Parameters
-  string|null 
$tableoptional null - table name or sequence to get last insert value from
 -  string|null 
$columnoptional null - the name of the column representing the primary key
 
Returns
string|integerprepare()source public
prepare( string|Cake\Database\Query $query )
Prepares a sql statement to be executed
Parameters
-  string|
Cake\Database\Query$query - The query to turn into a prepared statement.
 
Returns
Cake\Database\StatementInterfacequote()source public
quote( mixed $value , string $type )
Returns a value in a safe representation to be used in a query string
Parameters
-  mixed 
$value - The value to quote.
 -  string 
$type - Type to be used for determining kind of quoting to perform
 
Returns
stringrollbackTransaction()source public
rollbackTransaction( )
Rollback a transaction
Returns
booleantrue on success, false otherwise
supportsQuoting()source public
supportsQuoting( )
Checks if the driver supports quoting, as PDO_ODBC does not support it.
Returns
booleanProperties detail
    © 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
    https://api.cakephp.org/3.3/class-Cake.Database.Driver.PDODriverTrait.html