AbstractDatabase
extends PDO
in package
A basic wrapper around php's PDO class to hide the host, user, password, etc.
The children of this class will expect to be passed an instance of \TiqConfig
Tags
Table of Contents
- $conf : mixed
- $db_name : mixed
- $debug : bool
- $dsn : mixed
- $error_message : mixed
- Base error message, this belongs in com_think's configuration class
- $host : mixed
- $password : mixed
- $port : mixed
- $user_name : mixed
- __construct() : mixed
- Parses Config info and sets some default options
- errorMessage() : string
- Returns an error message that should be actionable. The information in the error message comes from the database
- run() : mixed
- Compresses a basic query down into one function
- parseConfig() : void
- Breaks down the \TiqConfig Object
- parseException() : array<string|int, mixed>
- Initial version of hint parsing code.
Properties
$conf
protected
mixed
$conf
$db_name
protected
mixed
$db_name
$debug
protected
bool
$debug
= false
Tags
$dsn
protected
mixed
$dsn
$error_message
Base error message, this belongs in com_think's configuration class
protected
mixed
$error_message
= 'An issue occurred, please contact ThinkIQ for Support and enable debugging'
Tags
$host
protected
mixed
$host
$password
protected
mixed
$password
$port
protected
mixed
$port
$user_name
protected
mixed
$user_name
Methods
__construct()
Parses Config info and sets some default options
public
__construct(TiqConfig $conf[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $conf : TiqConfig
-
Contains sensitive configuration data
- $options : array<string|int, mixed> = []
-
PDO class attributes
Return values
mixed —errorMessage()
Returns an error message that should be actionable. The information in the error message comes from the database
public
errorMessage(PDOException $exception) : string
Parameters
- $exception : PDOException
Tags
Return values
string —run()
Compresses a basic query down into one function
public
run(string $sql[, mixed $args = NULL ]) : mixed
Parameters
- $sql : string
-
sql query
- $args : mixed = NULL
-
arguments to be used in the sql string
Return values
mixed —parseConfig()
Breaks down the \TiqConfig Object
protected
parseConfig(TiqConfig $conf) : void
Parameters
- $conf : TiqConfig
-
Contains sensitive configuration data
Return values
void —parseException()
Initial version of hint parsing code.
private
parseException(PDOException $e) : array<string|int, mixed>
TODO: Make unit tests and make this more solid!
Parameters
- $e : PDOException