PhpToolCase
Api Documentation Version 0.9.2
PtcDb Class Reference

Static Public Member Functions

static add ($options, $name= 'default')
 Adds a connection to the manager, will trigger an error if connection name is already present. More...
 
static getConnection ($name=null)
 Retrieves connection details previously configured. More...
 
static getPdo ($name)
 Retrieves the Pdo object. More...
 
static getQB ($name)
 Retreives the query builder object if present. More...
 
static __callStatic ($method, $args=null)
 Calls Pdo or query builder methods from the default connection directly. More...
 

Static Protected Member Functions

static _initializeConnection ($name)
 Initializes the pdo and query builder obejcts. More...
 
static _checkConnectionName ($name)
 Checks if a given connection exists. More...
 
static _pdoDriver ($driver, $host)
 Builds the pdo driver. More...
 
static _debug ($string, $statement=null, $category=null)
 Sends messsages to the PtcDebug class if present. More...
 

Static Protected Attributes

static $_connectionOptions
 Default connection options property, see Connection Options. More...
 
static $_connections = array( )
 Pdo and query builder objects property. More...
 
static $_connectionsDetails = array( )
 Connection details property. More...
 

Member Function Documentation

static __callStatic (   $method,
  $args = null 
)
static

Calls Pdo or query builder methods from the default connection directly.

Parameters
string$methodthe name of the method to call
array$argsarguments for the method

Definition at line 99 of file PtcDb.php.

static _checkConnectionName (   $name)
staticprotected

Checks if a given connection exists.

Parameters
string$namethe name of the connection to check
Returns
true if connection exists, false otherwise

Definition at line 189 of file PtcDb.php.

static _debug (   $string,
  $statement = null,
  $category = null 
)
staticprotected

Sends messsages to the PtcDebug class if present.

Parameters
mixed$stringthe string to pass
mixed$statementsome statement if required
string$categorysome category

Definition at line 219 of file PtcDb.php.

static _initializeConnection (   $name)
staticprotected

Initializes the pdo and query builder obejcts.

Parameters
string$namethe name of the connection

Definition at line 150 of file PtcDb.php.

static _pdoDriver (   $driver,
  $host 
)
staticprotected

Builds the pdo driver.

Parameters
string$driverthe driver type
string$hostthe database server host
Returns
the Pdo driver

Definition at line 205 of file PtcDb.php.

static add (   $options,
  $name = 'default' 
)
static

Adds a connection to the manager, will trigger an error if connection name is already present.

See Getting Started

Parameters
array$optionsthe details of the connection, see Connection Options
string$namethe name of the connection
Returns
an array with the connection details as values or false if name is already present

Definition at line 22 of file PtcDb.php.

static getConnection (   $name = null)
static

Retrieves connection details previously configured.

See Getting Connection Details

Parameters
string$namethe name of the connection to retrieve
Returns
an array with the connection as values if $name is set, otherwise all connections set

Definition at line 58 of file PtcDb.php.

static getPdo (   $name)
static

Retrieves the Pdo object.

See Using Pdo with the Connection Manager

Parameters
string$namethe name of the connection
Returns
the Pdo object

Definition at line 69 of file PtcDb.php.

static getQB (   $name)
static

Retreives the query builder object if present.

See Using the Query Builder

Parameters
string$namethe name of the connection
Returns
the query builder object

Definition at line 80 of file PtcDb.php.

Field Documentation

$_connectionOptions
staticprotected
Initial value:
= array
(
'name' => 'default' ,
'driver' => 'mysql' ,
'user' => 'root' ,
'pass' => '' ,
'host' => 'localhost' ,
'db' => 'database' ,
'charset' => 'utf8' ,
'query_builder' => false ,
'query_builder_class' => 'PtcQueryBuilder' ,
'pdo_attributes' => array
(
PDO::ATTR_ERRMODE => PDO::ERRMODE_WARNING ,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ
)
)

Default connection options property, see Connection Options.

Definition at line 121 of file PtcDb.php.

$_connections = array( )
staticprotected

Pdo and query builder objects property.

Definition at line 141 of file PtcDb.php.

$_connectionsDetails = array( )
staticprotected

Connection details property.

Definition at line 145 of file PtcDb.php.


The documentation for this class was generated from the following file: