Properties

$connector

$connector : array

this is an array of to hold connection objects to each DSN that is called by the application

Type

array

$dataSchema

$dataSchema : array

dataSchema -tableDefinitions

Type

array

$logger

$logger : mixed

logger

Type

mixed — logger

$connectorCfg

$connectorCfg : array

an array to store tables definitions for MySQL/postgres or the equivelent for NoSQL/File stores

Type

array

Methods

__construct()

__construct(array  $cfg) : null

Constructor, sets up the logger and loads connection pool data nothing is set for the connection pool to save resources, connections are automatically set/checked on request

Parameters

array $cfg

Returns

null

setIntrospectionObject()

setIntrospectionObject(  $DSN) : NULL

DESCRIPTOR: setIntrospectionObject

Parameters

$DSN

Returns

NULL

introspectTable()

introspectTable(  $DSN, string  $tableName) : \JCORE\DATA\API\obj

DESCRIPTOR: GET A TABLE DEFINITION (only MySQL for now) This method passes the connection object to the introspection class make this agnostic, pass to connection object

Parameters

$DSN
string $tableName

Returns

\JCORE\DATA\API\obj

set_connection()

set_connection(string  $DSN, array  $settings) : boolean

DESCRIPTOR: (RE)SETS A CONNECTION OBJECT TO THE POOL $settings expected to be $this->connectorCfg[$DSN] this resets the whole connection object the DSN & settings are set in INI/config.dbConnectionPool.ini $settings[persistent] from INI can be over ridden here set it as a boolean or a string $settings["implementation"] allows a class to be defined @ runtime in config.dbConnection.ini the connection object also has a set_connection method to reset the connection resource

Parameters

string $DSN
array $settings

Returns

boolean —

true

verify_connection()

verify_connection(string  $DSN) : \JCORE\DATA\API\outputErrors

DESCRIPTOR: VERIFIES A CONNECTION OBJECT && RESOURCE have to modify this later for NoSQL? connection may not be a resource

Parameters

string $DSN

Returns

\JCORE\DATA\API\outputErrors

checkIsSlave()

checkIsSlave(string  $DSN) : boolean

DESCRIPTOR: CHECKS IF THE DB IS A SLAVE

Parameters

string $DSN

Returns

boolean

setMaster()

setMaster(string  $DSN) : string

DESCRIPTOR: CHOPS "_SLAVE" FROM THE DSN read can be done from slave, writes will go back to master

Parameters

string $DSN

Returns

string —

DSN

raw()

raw(string  $DSN, string  $query) : \JCORE\DATA\API\$result

DESCRIPTOR: EXECUTE A QUERY exception handling and logging dealt with

Parameters

string $DSN
string $query

Returns

\JCORE\DATA\API\$result

retrieve()

retrieve(string  $DSN, string  $query, array  $args = array('returnArray' => true)) : \JCORE\DATA\API\$result

DESCRIPTOR: EXECUTE A SELECT if $returnArray === true the function will return the result as a PHP array use stdobj to get an object back $args[returnArray] = true

Parameters

string $DSN
string $query
array $args

Returns

\JCORE\DATA\API\$result

update()

update(string  $DSN, string  $query,   $args = array('returnArray' => true)) : \JCORE\DATA\API\$result

DESCRIPTOR: EXECUTE AN UPDATE if $returnArray === true the function will return the number of affected rows as well as the "mysql_info" from the query

Parameters

string $DSN
string $query
$args

Returns

\JCORE\DATA\API\$result

create()

create(string  $DSN, string  $query, array  $args = array('returnArray' => true)) : \JCORE\DATA\API\$result

DESCRIPTOR: EXECUTE AN INSERT if $returnArray === true the function will return the "mysql_insert_id" the number of "mysql_affected_rows" as well as the "mysql_info" from the query

Parameters

string $DSN
string $query
array $args

Returns

\JCORE\DATA\API\$result

delete()

delete(string  $DSN, string  $query,   $args = array('returnArray' => true)) : \JCORE\DATA\API\bool/array

DESCRIPTOR: EXECUTE A DELETE if $returnArray === true the function will return the number of affected rows as well as the "mysql_info" from the query

Parameters

string $DSN
string $query
$args

Returns

\JCORE\DATA\API\bool/array —

$result

resultToAssoc()

resultToAssoc(resource  $result, string  $DSN) : array

must be maintained allow pass-trough PASSED DOWN TO THE CONNECCTION OBJECT DESCRIPTOR: converts a SQL result to a PHP array

HACKING THIS.... for the time being a local mysql only implementation Just to keep the name space consistent from the beginning

Parameters

resource $result
string $DSN

Returns

array —

$result

SQLResultToAssoc()

SQLResultToAssoc(  $result,   $query = '') : NULL

DESCRIPTOR: SQLResultToAssoc return a raw result as an associative array

Parameters

$result
$query

Returns

NULL

__destruct()

__destruct() : NULL

DESCRIPTOR: __destruct

Returns

NULL