Jet\Db_Backend_Interface
The interface defining the backend of the direct database connection system.
Method Overview
Method | Meaning of |
---|---|
public __construct( Db_Backend_Config $config ) |
The constructor performs the initialization and connection to the database server based on the passed instance of the connection configuration. |
public __destruct( ) |
The destructor should ideally perform a disconnect from the database server, or other necessary termination operations. |
public disconnect( ): void |
Performs a disconnect from the database server. |
public getConfig( ): Db_Backend_Config |
Returns the configuration of the connection to the database server. |
public execute( string $query, array $query_data = [] ): int |
Executes SQL query of type INSERT, UPDATE, DELETE (and similar) and returns the number of affected rows. Parameters:
|
public query( string $query, array $query_params = [], ?callable $result_handler=null ): iterable |
Executes a SELECT query and returns the result, which is processed (optionally) by the given handler before returning. Parameters:
|
public fetchAll( string $query, array $query_data=[] ): array |
Executes a SELECT query with the result converted to a regular array.
Parameters:
|
public fetchRow( string $query, array $query_data = [] ): array|bool |
Performs a SELECT query and returns the first row of the result. It is therefore used where a single line result is expected.
Parameters:
|
public fetchAssoc( string $query, array $query_data=[], ?string $key_column = null ): array |
Executes a SELECT query with the result converted to a regular array, where the key of this array is the value of the column specified by the $key_column parameter, or the first column of the result if the $key_column parameter is not defined.
Parameters:
|
public fetchCol( string $query, array $query_data=[], ?string $column=null ): array |
Executes a SELECT query, but does not return the entire result, but an array containing the values of the column specified by the $column parameter, or the first column of the result if this parameter is not defined.
Parameters:
|
public fetchPairs( string $query, array $query_data=[], ?string $key_column = null, ?string $value_column = null ): array |
Provede dotaz typu SELECT a vrátí asociované pole, kde klíčem je sloupec určený parametrem $key_column a hodnotou pole určené parametrem $value_column. Pokud parametry $key_column a $value_column nejsou definovány, pak jsou použity hodnoty prvního a druhého sloupce výsledku. Parametry:
|
public fetchOne( string $query, array $query_data = [], ?string $column = null ): mixed |
Performs a SELECT query and returns the value of the column specified by the $column parameter (or the first column if the parameter is not defined) of the first row of the result. It is therefore used where you want a single value from the result.
Parameters:
|
public beginTransaction( ) : bool |
Start transaction. |
public commit( ) : bool |
Commit transaction. |
public rollBack( ) : bool |
Roll back transaction. |
public inTransaction( ) : bool |
Indicates whether the transaction is in progress. |
public lastInsertId( string $name = null ) : string |
Returns the last inserted ID (e.g. autoincrement). |