\coreDBConnection

This class is a singleton for establishing a connection to the database

Summary

Methods
Properties
Constants
handle()
__clone()
isReadOnly()
exec()
lastID()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
__construct()
$instanceUSER
$instanceINST
$instanceEXTERNAL
$instanceFRONTEND
$databaseInstance
$connection
$loggerInstance
$readOnly
N/A

Properties

$instanceUSER

$instanceUSER : \core\DBConnection

Holds the singleton instance reference to USER database

Type

\core\DBConnection —

$instanceINST

$instanceINST : \core\DBConnection

Holds the singleton instance reference to INST database

Type

\core\DBConnection —

$instanceEXTERNAL

$instanceEXTERNAL : \core\DBConnection

Holds the singleton instance reference to EXTERNAL database

Type

\core\DBConnection —

$instanceFRONTEND

$instanceFRONTEND : \core\DBConnection

Holds the singleton instance reference to FRONTEND database

Type

\core\DBConnection —

$databaseInstance

$databaseInstance : 

after instantiation, keep state of which DB *this one* talks to

Type

— which database does this instance talk to

$connection

$connection : \mysqli

The connection to the DB server

Type

\mysqli —

$loggerInstance

$loggerInstance : \core\common\Logging

Type

\core\common\Logging —

$readOnly

$readOnly : 

Keeps state whether we are a readonly DB instance

Type

Methods

handle()

handle( database) : \core\DBConnection

This is the actual constructor for the singleton. It creates a database connection if it is not up yet, and returns a handle to the database connection on every call.

Parameters

database

Returns

\core\DBConnection —

the (only) instance of this class

__clone()

__clone() 

Implemented for safety reasons only. Cloning is forbidden and will tell the user so.

isReadOnly()

isReadOnly() : 

tells the caller if the database is to be accessed read-only

Returns

exec()

exec(  querystring,  types = NULL,  arguments) : 

executes a query and triggers logging to the SQL audit log if it's not a SELECT

Parameters

querystring

the query to be executed

types
arguments

Returns

the query result as mysqli_result object; or TRUE on non-return-value statements

lastID()

lastID() : 

Retrieves the last auto-id of an INSERT. Needs to be called immediately after the corresponding exec() call

Returns

the last autoincrement-ID

__construct()

__construct( database) 

Class constructor. Cannot be called directly; use handle()

Parameters

database