Свойство | Тип | Описание | |
---|---|---|---|
$_config | array | Contains the configuration params for this connection. | |
$_driver | Cake\Database\Driver | Driver object, responsible for creating the real connection and provide specific SQL dialect. | |
$_logQueries | boolean | Whether to log queries generated during this connection. | |
$_logger | Cake\Database\Log\QueryLogger | Logger object instance. | |
$_schemaCollection | Cake\Database\Schema\Collection | The schema collection object | |
$_transactionLevel | integer | Contains how many nested transactions have been started. | |
$_transactionStarted | boolean | Whether a transaction is active in this connection. | |
$_useSavePoints | boolean | Whether this connection can and should use savepoints for nested transactions. |
Метод | Описание | |
---|---|---|
__construct ( array $config ) | Constructor. | |
__debugInfo ( ) : array | Returns an array that can be used to describe the internal state of this object. | |
__destruct ( ) | Destructor | |
begin ( ) : void | Starts a new transaction. | |
cacheMetadata ( boolean | string $cache ) : void | Enables or disables metadata caching for this connection | |
commit ( ) : boolean | Commits current transaction. | |
compileQuery ( |
Compiles a Query object into a SQL string according to the dialect for this connection's driver | |
config ( ) | {@inheritDoc} | |
configName ( ) | {@inheritDoc} | |
connect ( ) : boolean | Connects to the configured database. | |
createSavePoint ( string $name ) : void | Creates a new save point for nested transactions. | |
delete ( string $table, array $conditions = [], array $types = [] ) : Cake\Database\StatementInterface | Executes a DELETE statement on the specified table. | |
disableConstraints ( callable $callback ) | {@inheritDoc} | |
disableForeignKeys ( ) : void | Run driver specific SQL to disable foreign key checks. | |
disconnect ( ) : void | Disconnects from database server. | |
driver ( Cake\Database\Driver | string | null $driver = null, array $config = [] ) : Cake\Database\Driver | Sets the driver instance. If a string is passed it will be treated as a class name and will be instantiated. | |
enableForeignKeys ( ) : void | Run driver specific SQL to enable foreign key checks. | |
execute ( string $query, array $params = [], array $types = [] ) : Cake\Database\StatementInterface | Executes a query using $params for interpolating values and $types as a hint for each those params. | |
inTransaction ( ) : boolean | Checks if a transaction is running. | |
insert ( string $table, array $data, array $types = [] ) : Cake\Database\StatementInterface | Executes an INSERT query on the specified table. | |
isConnected ( ) : boolean | Returns whether connection to database server was already established. | |
log ( string $sql ) : void | Logs a Query string using the configured logger object. | |
logQueries ( $enable = null ) | {@inheritDoc} | |
logger ( $instance = null ) | {@inheritDoc} | |
newQuery ( ) : |
Create a new Query instance for this connection. | |
prepare ( string | |
Prepares a SQL statement to be executed. | |
query ( string $sql ) : Cake\Database\StatementInterface | Executes a SQL statement and returns the Statement object as result. | |
quote ( mixed $value, string | null $type = null ) : string | Quotes value to be used safely in database query. | |
quoteIdentifier ( string $identifier ) : string | Quotes a database identifier (a column name, table name, etc. | |
releaseSavePoint ( string $name ) : void | Releases a save point by its name. | |
rollback ( ) : boolean | Rollback current transaction. | |
rollbackSavepoint ( string $name ) : void | Rollback a save point by its name. | |
run ( |
Executes the provided query after compiling it for the specific driver dialect and returns the executed Statement object. | |
schemaCollection ( Cake\Database\Schema\Collection $collection = null ) : Cake\Database\Schema\Collection | Gets or sets a Schema\Collection object for this connection. | |
supportsDynamicConstraints ( ) : boolean | Returns whether the driver supports adding or dropping constraints to already created tables. | |
supportsQuoting ( ) : boolean | Checks if the driver supports quoting. | |
transactional ( callable $callback ) | {@inheritDoc} | |
update ( string $table, array $data, array $conditions = [], array $types = [] ) : Cake\Database\StatementInterface | Executes an UPDATE statement on the specified table. | |
useSavePoints ( boolean | null $enable = null ) : boolean | Returns whether this connection is using savepoints for nested transactions If a boolean is passed as argument it will enable/disable the usage of savepoints only if driver the allows it. |
Метод | Описание | |
---|---|---|
_newLogger ( Cake\Database\StatementInterface $statement ) : Cake\Database\Log\LoggingStatement | Returns a new statement object that will log the activity for the passed original statement instance. |
public __construct ( array $config ) | ||
$config | array | configuration for connecting to database |
public __debugInfo ( ) : array | ||
Результат | array |
public __destruct ( ) |
protected _newLogger ( Cake\Database\StatementInterface $statement ) : Cake\Database\Log\LoggingStatement | ||
$statement | Cake\Database\StatementInterface | the instance to be decorated |
Результат | Cake\Database\Log\LoggingStatement |
public compileQuery ( |
||
$query | The query to be compiled | |
$generator | The placeholder generator to use | |
Результат | string |
public createSavePoint ( string $name ) : void | ||
$name | string | The save point name. |
Результат | void |
public delete ( string $table, array $conditions = [], array $types = [] ) : Cake\Database\StatementInterface | ||
$table | string | the table to delete rows from |
$conditions | array | conditions to be set for delete statement |
$types | array | list of associative array containing the types to be used for casting |
Результат | Cake\Database\StatementInterface |
public disableConstraints ( callable $callback ) | ||
$callback | callable |
public disableForeignKeys ( ) : void | ||
Результат | void |
public disconnect ( ) : void | ||
Результат | void |
public enableForeignKeys ( ) : void | ||
Результат | void |
public execute ( string $query, array $params = [], array $types = [] ) : Cake\Database\StatementInterface | ||
$query | string | SQL to be executed and interpolated with $params |
$params | array | list or associative array of params to be interpolated in $query as values |
$types | array | list or associative array of types to be used for casting values in query |
Результат | Cake\Database\StatementInterface | executed statement |
public inTransaction ( ) : boolean | ||
Результат | boolean | True if a transaction is running else false. |
public insert ( string $table, array $data, array $types = [] ) : Cake\Database\StatementInterface | ||
$table | string | the table to insert values in |
$data | array | values to be inserted |
$types | array | list of associative array containing the types to be used for casting |
Результат | Cake\Database\StatementInterface |
public isConnected ( ) : boolean | ||
Результат | boolean |
public newQuery ( ) : |
||
Результат |
public quoteIdentifier ( string $identifier ) : string | ||
$identifier | string | The identifier to quote. |
Результат | string |
public releaseSavePoint ( string $name ) : void | ||
$name | string | The save point name. |
Результат | void |
public rollbackSavepoint ( string $name ) : void | ||
$name | string | The save point name. |
Результат | void |
public run ( |
||
$query | The query to be executed | |
Результат | Cake\Database\StatementInterface | executed statement |
public schemaCollection ( Cake\Database\Schema\Collection $collection = null ) : Cake\Database\Schema\Collection | ||
$collection | Cake\Database\Schema\Collection | The schema collection object |
Результат | Cake\Database\Schema\Collection |
public supportsDynamicConstraints ( ) : boolean | ||
Результат | boolean | true if driver supports dynamic constraints |
public supportsQuoting ( ) : boolean | ||
Результат | boolean |
public transactional ( callable $callback ) | ||
$callback | callable |
public update ( string $table, array $data, array $conditions = [], array $types = [] ) : Cake\Database\StatementInterface | ||
$table | string | the table to update rows from |
$data | array | values to be updated |
$conditions | array | conditions to be set for update statement |
$types | array | list of associative array containing the types to be used for casting |
Результат | Cake\Database\StatementInterface |
protected array $_config | ||
Результат | array |
protected Driver,Cake\Database $_driver | ||
Результат | Cake\Database\Driver |
protected bool $_logQueries | ||
Результат | boolean |
protected QueryLogger,Cake\Database\Log $_logger | ||
Результат | Cake\Database\Log\QueryLogger |
protected Collection,Cake\Database\Schema $_schemaCollection | ||
Результат | Cake\Database\Schema\Collection |
protected int $_transactionLevel | ||
Результат | integer |
protected bool $_transactionStarted | ||
Результат | boolean |
protected bool $_useSavePoints | ||
Результат | boolean |