class PdoMySql extends Engine

Personalization of PDO to use MySQL.

Properties

static DebugTool $debugTool The debug tool used. from Engine
static array $dbStructure Contains the database structure data. from Engine
static protected string $dsn Data Source Name from Engine
static protected array $dbConfig Array that contains the access data to the database. from Engine
static protected PDO $dbHandler The handler of the database. from Engine
static protected PDOStatement|bool $statement Represents a prepared statement and, after the statement is executed, an associated result set. from Engine
static protected bool $savePointsSupport True if the database engine supports SAVEPOINT in transactions from Engine
static protected int $transactionDepth Number of transactions in execution from Engine
static protected PDOCollector $pdoCollector PDO Data collector. from Engine
static protected PDO $pdo Connection between PHP and a database server. from Engine

Methods

__construct(array $dbConfig)

PdoMySql constructor. Add aditional parameters to self::$dsn string.

static array
getEngines()

Return a list of available database engines.

from Engine
static array
unsupportedEngines()

Returns a list of unsupported engines.

from Engine
static array
getStructure(string $tableName, bool $usePrefix = true)

Obtain an array with the table structure with a standardized format.

from Engine
static bool
batchExec(array $queries)

Execute SQL statements on the database (INSERT, UPDATE or DELETE).

from Engine
static bool
exec(string $query, array $vars = [])

Prepare and execute the query.

from Engine
static array
selectCoreCache(string $cachedName, string $query, array $vars = [])

Executes a SELECT SQL statement on the core cache.

from Engine
static array
select(string $query, array $vars = [])

Executes a SELECT SQL statement on the database, returning the result in an array.

from Engine
static bool
clearCoreCache(string $cachedName)

Clear item from cache.

from Engine
__destruct()

Engine destructor

from Engine
rollBackTransactions()

Undo all active transactions

from Engine
bool
rollBack()

Rollback current transaction,

from Engine
string
getLastInserted()

Returns the id of the last inserted record. Failing that, it returns ''.

from Engine
bool
checkConnection()

Returns if a database connection exists or not.

from Engine
bool
connect(array $config = [])

Connect to the database.

bool
prepare(string $sql, array $options = [])

Prepares a statement for execution and returns a statement object

from Engine
array
resultSet()

Returns an array containing all of the result set rows

from Engine
bool
execute(array $inputParameters = [])

Executes a prepared statement

from Engine
bool
beginTransaction()

Start transaction

from Engine
bool
commit()

Commit current transaction

from Engine
array
getDbStructure()

Returns database structure.

from Engine
mixed
getDbTableStructure(string $tablename)

Returns database table structure.

from Engine
bool
issetDbTableStructure(string $tablename)

Returns if table is set to database structure.

from Engine
bool
issetDbTableStructureKey(string $tablename, string $key)

Returns if key is set to database structure.

from Engine
setDbTableStructure(string $tablename, array $data)

Sets database structure for a tablename.

from Engine

Details

at line 22
__construct(array $dbConfig)

PdoMySql constructor. Add aditional parameters to self::$dsn string.

Parameters

array $dbConfig

in Engine at line 122
static array getEngines()

Return a list of available database engines.

Return Value

array

in Engine at line 147
static array unsupportedEngines()

Returns a list of unsupported engines.

The unsupported engines here are the not fully supported yet.

Return Value

array

in Engine at line 161
static array getStructure(string $tableName, bool $usePrefix = true)

Obtain an array with the table structure with a standardized format.

Parameters

string $tableName
bool $usePrefix

Return Value

array

in Engine at line 176
final static bool batchExec(array $queries)

Execute SQL statements on the database (INSERT, UPDATE or DELETE).

Parameters

array $queries

Return Value

bool

in Engine at line 197
final static bool exec(string $query, array $vars = [])

Prepare and execute the query.

Parameters

string $query
array $vars

Return Value

bool

in Engine at line 221
final static array selectCoreCache(string $cachedName, string $query, array $vars = [])

Executes a SELECT SQL statement on the core cache.

Parameters

string $cachedName
string $query
array $vars

Return Value

array

in Engine 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.

Parameters

string $query
array $vars

Return Value

array

in Engine at line 274
final static bool clearCoreCache(string $cachedName)

Clear item from cache.

Parameters

string $cachedName

Return Value

bool

in Engine at line 290
__destruct()

Engine destructor

in Engine at line 298
private rollBackTransactions()

Undo all active transactions

in Engine at line 310
final bool rollBack()

Rollback current transaction,

Return Value

bool

in Engine at line 337
final string getLastInserted()

Returns the id of the last inserted record. Failing that, it returns ''.

Return Value

string

in Engine at line 351
bool checkConnection()

Returns if a database connection exists or not.

Return Value

bool

at line 35
bool connect(array $config = [])

Connect to the database.

Parameters

array $config

Return Value

bool

in Engine at line 401
final bool prepare(string $sql, array $options = [])

Prepares a statement for execution and returns a statement object

Parameters

string $sql
array $options

Return Value

bool

in Engine at line 417
final array resultSet()

Returns an array containing all of the result set rows

Return Value

array

in Engine at line 432
final bool execute(array $inputParameters = [])

Executes a prepared statement

Parameters

array $inputParameters

Return Value

bool

in Engine at line 449
final bool beginTransaction()

Start transaction

Return Value

bool

in Engine at line 471
final bool commit()

Commit current transaction

Return Value

bool

in Engine at line 494
final array getDbStructure()

Returns database structure.

Return Value

array

in Engine at line 506
final mixed getDbTableStructure(string $tablename)

Returns database table structure.

Parameters

string $tablename

Return Value

mixed

in Engine at line 518
final bool issetDbTableStructure(string $tablename)

Returns if table is set to database structure.

Parameters

string $tablename

Return Value

bool

in Engine at line 531
final bool issetDbTableStructureKey(string $tablename, string $key)

Returns if key is set to database structure.

Parameters

string $tablename
string $key

Return Value

bool

in Engine at line 542
final setDbTableStructure(string $tablename, array $data)

Sets database structure for a tablename.

Parameters

string $tablename
array $data