\app\framework\Component\Database\ConnectionConnection

Class Connection Representing and holding an database connection.

Summary

Methods
Properties
Constants
__construct()
getQueryLog()
flushQueryLog()
enableQueryLog()
disableQueryLog()
logging()
getDatabaseName()
setDatabaseName()
getName()
getDriver()
select()
insert()
update()
delete()
statement()
affectingStatement()
logQuery()
fetch()
No public properties found
No constants found
eventManager()
run()
runQueryCallback()
$pdo
$name
$database
$config
$queryLog
$loggingQueries
N/A
No private methods found
No private properties found
N/A

Properties

$pdo

$pdo : \PDO

The active pdo connection

Type

\PDO

$name

$name : string

The name of the connection.

Type

string

$database

$database : string

The name of the connected database.

Type

string

$config

$config : array

The database connection configuration options.

Type

array

$queryLog

$queryLog : array

All of the queries run against the connection.

Type

array

$loggingQueries

$loggingQueries : boolean

Indicates whether queries are being logged.

Type

boolean

Methods

__construct()

__construct(\PDO  $pdo, \app\framework\Component\Database\Connection\string  $database = '', \app\framework\Component\Database\Connection\string  $name = '', array  $conf = array()) 

Parameters

\PDO $pdo
\app\framework\Component\Database\Connection\string $database
\app\framework\Component\Database\Connection\string $name
array $conf

getQueryLog()

getQueryLog() : array

Get the connection query log.

Returns

array

flushQueryLog()

flushQueryLog() : void

Clear the query log.

enableQueryLog()

enableQueryLog() : void

Enable the query log on the connection.

disableQueryLog()

disableQueryLog() : void

Disable the query log on the connection.

logging()

logging() : boolean

Determine whether we're logging queries.

Returns

boolean

getDatabaseName()

getDatabaseName() : string

Get the name of the connected database.

Returns

string

setDatabaseName()

setDatabaseName(string  $database) 

Set the name of the connected database.

Parameters

string $database

getName()

getName() 

getDriver()

getDriver() 

select()

select(\app\framework\Component\Database\Connection\string  $query, array  $bindings = array()) 

Parameters

\app\framework\Component\Database\Connection\string $query
array $bindings

insert()

insert(string  $query, array  $bindings = array()) : boolean

Run an insert statement against the database.

Parameters

string $query
array $bindings

Returns

boolean

update()

update(string  $query, array  $bindings = array()) : integer

Run an update statement against the database.

Parameters

string $query
array $bindings

Returns

integer

delete()

delete(string  $query, array  $bindings = array()) : integer

Run a delete statement against the database.

Parameters

string $query
array $bindings

Returns

integer

statement()

statement(string  $query, array  $bindings = array()) : boolean

Execute an SQL statement and return the boolean result.

Parameters

string $query
array $bindings

Returns

boolean

affectingStatement()

affectingStatement(string  $query, array  $bindings = array()) : integer

Run an SQL statement and get the number of rows affected.

Parameters

string $query
array $bindings

Returns

integer

run()

run(string  $query, array  $bindings, \Closure  $callback) : mixed

Run a SQL statement and log its execution context.

Parameters

string $query
array $bindings
\Closure $callback

Returns

mixed

runQueryCallback()

runQueryCallback(string  $query, array  $bindings, \Closure  $callback) : mixed

Run a SQL statement.

Parameters

string $query
array $bindings
\Closure $callback

Throws

Returns

mixed