|
|
@@ -24,14 +24,14 @@ interface DriverInterface
|
|
|
*
|
|
|
* @return bool True on success, false on failure.
|
|
|
*/
|
|
|
- public function connect();
|
|
|
+ public function connect(): bool;
|
|
|
|
|
|
/**
|
|
|
* Disconnects from database server.
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function disconnect();
|
|
|
+ public function disconnect(): void;
|
|
|
|
|
|
/**
|
|
|
* Returns correct connection resource or object that is internally used.
|
|
|
@@ -53,7 +53,7 @@ interface DriverInterface
|
|
|
*
|
|
|
* @return bool True if it is valid to use this driver.
|
|
|
*/
|
|
|
- public function enabled();
|
|
|
+ public function enabled(): bool;
|
|
|
|
|
|
/**
|
|
|
* Prepares a sql statement to be executed.
|
|
|
@@ -61,28 +61,28 @@ interface DriverInterface
|
|
|
* @param string|\Cake\Database\Query $query The query to turn into a prepared statement.
|
|
|
* @return \Cake\Database\StatementInterface
|
|
|
*/
|
|
|
- public function prepare($query);
|
|
|
+ public function prepare($query): StatementInterface;
|
|
|
|
|
|
/**
|
|
|
* Starts a transaction.
|
|
|
*
|
|
|
* @return bool True on success, false otherwise.
|
|
|
*/
|
|
|
- public function beginTransaction();
|
|
|
+ public function beginTransaction(): bool;
|
|
|
|
|
|
/**
|
|
|
* Commits a transaction.
|
|
|
*
|
|
|
* @return bool True on success, false otherwise.
|
|
|
*/
|
|
|
- public function commitTransaction();
|
|
|
+ public function commitTransaction(): bool;
|
|
|
|
|
|
/**
|
|
|
* Rollbacks a transaction.
|
|
|
*
|
|
|
* @return bool True on success, false otherwise.
|
|
|
*/
|
|
|
- public function rollbackTransaction();
|
|
|
+ public function rollbackTransaction(): bool;
|
|
|
|
|
|
/**
|
|
|
* Get the SQL for releasing a save point.
|
|
|
@@ -90,7 +90,7 @@ interface DriverInterface
|
|
|
* @param string $name The table name.
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function releaseSavePointSQL($name);
|
|
|
+ public function releaseSavePointSQL(string $name): string;
|
|
|
|
|
|
/**
|
|
|
* Get the SQL for creating a save point.
|
|
|
@@ -98,7 +98,7 @@ interface DriverInterface
|
|
|
* @param string $name The table name.
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function savePointSQL($name);
|
|
|
+ public function savePointSQL(string $name): string;
|
|
|
|
|
|
/**
|
|
|
* Get the SQL for rollingback a save point.
|
|
|
@@ -106,21 +106,21 @@ interface DriverInterface
|
|
|
* @param string $name The table name.
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function rollbackSavePointSQL($name);
|
|
|
+ public function rollbackSavePointSQL(string $name): string;
|
|
|
|
|
|
/**
|
|
|
* Get the SQL for disabling foreign keys.
|
|
|
*
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function disableForeignKeySQL();
|
|
|
+ public function disableForeignKeySQL(): string;
|
|
|
|
|
|
/**
|
|
|
* Get the SQL for enabling foreign keys.
|
|
|
*
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function enableForeignKeySQL();
|
|
|
+ public function enableForeignKeySQL(): string;
|
|
|
|
|
|
/**
|
|
|
* Returns whether the driver supports adding or dropping constraints
|
|
|
@@ -128,30 +128,30 @@ interface DriverInterface
|
|
|
*
|
|
|
* @return bool true if driver supports dynamic constraints.
|
|
|
*/
|
|
|
- public function supportsDynamicConstraints();
|
|
|
+ public function supportsDynamicConstraints(): bool;
|
|
|
|
|
|
/**
|
|
|
* Returns whether this driver supports save points for nested transactions.
|
|
|
*
|
|
|
* @return bool True if save points are supported, false otherwise.
|
|
|
*/
|
|
|
- public function supportsSavePoints();
|
|
|
+ public function supportsSavePoints(): bool;
|
|
|
|
|
|
/**
|
|
|
* Returns a value in a safe representation to be used in a query string
|
|
|
*
|
|
|
* @param mixed $value The value to quote.
|
|
|
- * @param string $type Type to be used for determining kind of quoting to perform.
|
|
|
+ * @param string|int $type Type to be used for determining kind of quoting to perform.
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function quote($value, $type);
|
|
|
+ public function quote($value, $type): string;
|
|
|
|
|
|
/**
|
|
|
* Checks if the driver supports quoting.
|
|
|
*
|
|
|
* @return bool
|
|
|
*/
|
|
|
- public function supportsQuoting();
|
|
|
+ public function supportsQuoting(): bool;
|
|
|
|
|
|
/**
|
|
|
* Returns a callable function that will be used to transform a passed Query object.
|
|
|
@@ -162,7 +162,7 @@ interface DriverInterface
|
|
|
* (select, insert, update, delete).
|
|
|
* @return callable
|
|
|
*/
|
|
|
- public function queryTranslator($type);
|
|
|
+ public function queryTranslator(string $type);
|
|
|
|
|
|
/**
|
|
|
* Get the schema dialect.
|
|
|
@@ -184,7 +184,7 @@ interface DriverInterface
|
|
|
* @param string $identifier The identifier expression to quote.
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function quoteIdentifier($identifier);
|
|
|
+ public function quoteIdentifier(string $identifier): string;
|
|
|
|
|
|
/**
|
|
|
* Escapes values for use in schema definitions.
|
|
|
@@ -192,14 +192,14 @@ interface DriverInterface
|
|
|
* @param mixed $value The value to escape.
|
|
|
* @return string String for use in schema definitions.
|
|
|
*/
|
|
|
- public function schemaValue($value);
|
|
|
+ public function schemaValue($value): string;
|
|
|
|
|
|
/**
|
|
|
* Returns the schema name that's being used.
|
|
|
*
|
|
|
* @return string
|
|
|
*/
|
|
|
- public function schema();
|
|
|
+ public function schema(): string;
|
|
|
|
|
|
/**
|
|
|
* Returns last id generated for a table or sequence in database.
|
|
|
@@ -208,14 +208,14 @@ interface DriverInterface
|
|
|
* @param string|null $column the name of the column representing the primary key.
|
|
|
* @return string|int
|
|
|
*/
|
|
|
- public function lastInsertId($table = null, $column = null);
|
|
|
+ public function lastInsertId(?string $table = null, ?string $column = null);
|
|
|
|
|
|
/**
|
|
|
* Checks whether or not the driver is connected.
|
|
|
*
|
|
|
* @return bool
|
|
|
*/
|
|
|
- public function isConnected();
|
|
|
+ public function isConnected(): bool;
|
|
|
|
|
|
/**
|
|
|
* Sets whether or not this driver should automatically quote identifiers
|
|
|
@@ -224,7 +224,7 @@ interface DriverInterface
|
|
|
* @param bool $enable Whether to enable auto quoting
|
|
|
* @return $this
|
|
|
*/
|
|
|
- public function enableAutoQuoting($enable = true);
|
|
|
+ public function enableAutoQuoting(bool $enable = true): self;
|
|
|
|
|
|
/**
|
|
|
* Returns whether or not this driver should automatically quote identifiers
|
|
|
@@ -232,7 +232,7 @@ interface DriverInterface
|
|
|
*
|
|
|
* @return bool
|
|
|
*/
|
|
|
- public function isAutoQuotingEnabled();
|
|
|
+ public function isAutoQuotingEnabled(): bool;
|
|
|
|
|
|
/**
|
|
|
* Transforms the passed query to this Driver's dialect and returns an instance
|
|
|
@@ -243,7 +243,7 @@ interface DriverInterface
|
|
|
* @return array containing 2 entries. The first entity is the transformed query
|
|
|
* and the second one the compiled SQL.
|
|
|
*/
|
|
|
- public function compileQuery(Query $query, ValueBinder $generator);
|
|
|
+ public function compileQuery(Query $query, ValueBinder $generator): array;
|
|
|
|
|
|
/**
|
|
|
* Returns an instance of a QueryCompiler.
|