Trait PDODriverTrait
PDO driver trait
Properties summary
- $_connection protected
\PDO|nullInstance of PDO.
Method Summary
- 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
Method Detail
_connect() protected
_connect(mixed $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
booltrue on success
beginTransaction() public
beginTransaction()
Starts a transaction
Returns
booltrue on success, false otherwise
commitTransaction() public
commitTransaction()
Commits a transaction
Returns
booltrue on success, false otherwise
connection() public
connection(mixed $connection)
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
-
\PDO|null$connection optional The PDO connection instance.
Returns
\PDOconnection object used internally
disconnect() public
disconnect()
Disconnects from database server
isConnected() public
isConnected()
Checks whether or not the driver is connected.
Returns
boollastInsertId() public
lastInsertId(mixed $table, mixed $column)
Returns last id generated for a table or sequence in database
Parameters
-
string|null$table optional table name or sequence to get last insert value from
-
string|null$column optional the name of the column representing the primary key
Returns
string|intprepare() public
prepare(mixed $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() public
quote(mixed $value, mixed $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() public
rollbackTransaction()
Rollback a transaction
Returns
booltrue on success, false otherwise
supportsQuoting() public
supportsQuoting()
Checks if the driver supports quoting, as PDO_ODBC does not support it.
Returns
boolProperty Detail
$_connection protected
Instance of PDO.
Type
\PDO|null
© 2005–present 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.9/trait-Cake.Database.Driver.PDODriverTrait.html