Engine
abstract class Engine
Engine provides generic support for databases.
The class will have to be extended by completing the particularities of each of them.
Properties
static DebugTool | $debugTool | The debug tool used. | |
static array | $dbStructure | Contains the database structure data. | |
static protected string | $dsn | Data Source Name | |
static protected array | $dbConfig | Array that contains the access data to the database. | |
static protected PDO | $dbHandler | The handler of the database. | |
static protected PDOStatement|bool | $statement | Represents a prepared statement and, after the statement is executed, an associated result set. | |
static protected bool | $savePointsSupport | True if the database engine supports SAVEPOINT in transactions | |
static protected int | $transactionDepth | Number of transactions in execution | |
static protected PDOCollector | $pdoCollector | PDO Data collector. | |
static protected PDO | $pdo | Connection between PHP and a database server. |
Methods
Engine constructor
Return a list of available database engines.
Returns a list of unsupported engines.
Obtain an array with the table structure with a standardized format.
Execute SQL statements on the database (INSERT, UPDATE or DELETE).
Prepare and execute the query.
Executes a SELECT SQL statement on the core cache.
Executes a SELECT SQL statement on the database, returning the result in an array.
Clear item from cache.
Engine destructor
Undo all active transactions
Rollback current transaction,
Returns the id of the last inserted record. Failing that, it returns ''.
Returns if a database connection exists or not.
Establish a connection to the database.
Prepares a statement for execution and returns a statement object
Returns an array containing all of the result set rows
Executes a prepared statement
Start transaction
Commit current transaction
Returns database structure.
Returns database table structure.
Returns if table is set to database structure.
Returns if key is set to database structure.
Sets database structure for a tablename.
Details
at line 105
__construct(array $dbConfig)
Engine constructor
at line 122
static array
getEngines()
Return a list of available database engines.
at line 147
static array
unsupportedEngines()
Returns a list of unsupported engines.
The unsupported engines here are the not fully supported yet.
at line 161
static array
getStructure(string $tableName, bool $usePrefix = true)
Obtain an array with the table structure with a standardized format.
at line 176
final static bool
batchExec(array $queries)
Execute SQL statements on the database (INSERT, UPDATE or DELETE).
at line 197
final static bool
exec(string $query, array $vars = [])
Prepare and execute the query.
at line 221
final static array
selectCoreCache(string $cachedName, string $query, array $vars = [])
Executes a SELECT SQL statement on the core cache.
at line 256
static array
select(string $query, array $vars = [])
Executes a SELECT SQL statement on the database, returning the result in an array.
In case of failure, return NULL. If there is no data, return an empty array.
at line 274
final static bool
clearCoreCache(string $cachedName)
Clear item from cache.
at line 290
__destruct()
Engine destructor
at line 298
private
rollBackTransactions()
Undo all active transactions
at line 310
final bool
rollBack()
Rollback current transaction,
at line 337
final string
getLastInserted()
Returns the id of the last inserted record. Failing that, it returns ''.
at line 351
bool
checkConnection()
Returns if a database connection exists or not.
at line 365
bool
connect(array $config = [])
Establish a connection to the database.
If a connection already exists, it returns it. It does not establish a new one. Returns true in case of success, assigning the handler to self::$dbHandler.
at line 401
final bool
prepare(string $sql, array $options = [])
Prepares a statement for execution and returns a statement object
at line 417
final array
resultSet()
Returns an array containing all of the result set rows
at line 432
final bool
execute(array $inputParameters = [])
Executes a prepared statement
at line 449
final bool
beginTransaction()
Start transaction
at line 471
final bool
commit()
Commit current transaction
at line 494
final array
getDbStructure()
Returns database structure.
at line 506
final mixed
getDbTableStructure(string $tablename)
Returns database table structure.
at line 518
final bool
issetDbTableStructure(string $tablename)
Returns if table is set to database structure.
at line 531
final bool
issetDbTableStructureKey(string $tablename, string $key)
Returns if key is set to database structure.
at line 542
final
setDbTableStructure(string $tablename, array $data)
Sets database structure for a tablename.