SQL
in package
SQL
SQL abstraction layer for using MySQL.
Table of Contents
Properties
- $collateSet : bool
- bool
- $endTimer : float|null
- mixed
- $group : mixed
- string
- $handle : mysqli|null
- object
- $joinUpdate : array<string|int, mixed>
- array
- $limit : mixed
- string
- $startTimer : float|null
- mixed
Methods
- detectDatabaseEngineVersion() : void
- Detect the MySql/MariaDB engine version and set global constants for next calls
- elapsedTime() : float
- Return the time elapsed betwen two UNIX timestamp with microseconds
- formatAlias() : string
- Format fields as aliases
- formatAliasWithExceptions() : string
- Format fields as aliases
- formatUpdate() : string
- Format fields for an UPDATE statement
- getExecutionError() : void
- Get error information from db drivers at connection
- internalQuery() : bool|array<string|int, mixed>|null
- Execute queries and return recordset
- sqlDie() : mixed
- Die or throw an exception depending on the configuration
- sqlTimerOff() : void
- Turn SQL timer OFF
- sqlTimerOn() : void
- Turn SQL timer ON
- subClause() : string
- Formulate subclause after main query
Properties
$collateSet
bool
private
bool
$collateSet
= \FALSE
$endTimer
mixed
private
float|null
$endTimer
$group
string
private
mixed
$group
= \FALSE
$handle
object
private
mysqli|null
$handle
= \NULL
$joinUpdate
array
private
array<string|int, mixed>
$joinUpdate
= []
$limit
string
private
mixed
$limit
= \FALSE
$startTimer
mixed
private
float|null
$startTimer
Methods
detectDatabaseEngineVersion()
Detect the MySql/MariaDB engine version and set global constants for next calls
private
detectDatabaseEngineVersion() : void
Set WIKINDX_CURRENT_DB_ENGINE_NAME and WIKINDX_CURRENT_DB_ENGINE_VERSION.
elapsedTime()
Return the time elapsed betwen two UNIX timestamp with microseconds
private
elapsedTime() : float
Return values
floatformatAlias()
Format fields as aliases
private
formatAlias(array<string|int, mixed> $array[, bool $table = FALSE ][, bool $tidyLeft = TRUE ]) : string
Parameters
- $array : array<string|int, mixed>
-
[VALUE => ALIAS]
- $table : bool = FALSE
-
Default is FALSE. If TRUE, prepend VALUE to ALIAS
- $tidyLeft : bool = TRUE
-
Default is TRUE. If FALSE, do not quote the left hand side of the alias
Return values
stringformatAliasWithExceptions()
Format fields as aliases
private
formatAliasWithExceptions(array<string|int, mixed> $array[, bool $tidyLeft = TRUE ]) : string
Array keys are checked for UNIX_TIMESTAMP or DATE_FORMAT
Parameters
- $array : array<string|int, mixed>
-
[VALUE => ALIAS]
- $tidyLeft : bool = TRUE
-
Default is TRUE. If FALSE, do not quote the left hand side of the alias
Return values
stringformatUpdate()
Format fields for an UPDATE statement
private
formatUpdate(array<string|int, mixed> $array) : string
Parameters
- $array : array<string|int, mixed>
Return values
stringgetExecutionError()
Get error information from db drivers at connection
private
getExecutionError() : void
internalQuery()
Execute queries and return recordset
private
internalQuery(string $querystring) : bool|array<string|int, mixed>|null
If WIKINDX_DEBUG_SQL is TRUE then the script always die on db error.
Parameters
- $querystring : string
Return values
bool|array<string|int, mixed>|null —An array, or a boolean if there are no data to return. Only the first result set is returned
sqlDie()
Die or throw an exception depending on the configuration
private
sqlDie(string $errorMessage[, string $beautified = "" ]) : mixed
Parameters
- $errorMessage : string
- $beautified : string = ""
-
Offending SQL statement
sqlTimerOff()
Turn SQL timer OFF
private
sqlTimerOff() : void
sqlTimerOn()
Turn SQL timer ON
private
sqlTimerOn() : void
subClause()
Formulate subclause after main query
private
subClause() : string