\Pop\DbDb

Db class

Summary

Methods
Properties
Constants
connect()
mysqlConnect()
pdoConnect()
pgsqlConnect()
sqlsrvConnect()
sqliteConnect()
check()
executeSql()
executeSqlFile()
getAvailableAdapters()
isAvailable()
setDb()
getDb()
hasDb()
addClassToTable()
hasClassToTable()
setDefaultDb()
db()
getAll()
No public properties found
No constants found
No protected methods found
$db
$classToTable
N/A
No private methods found
No private properties found
N/A

Properties

$db

$db : array

Database connection(s)

Type

array

$classToTable

$classToTable : array

Database connection class to table relationship

Type

array

Methods

connect()

connect(string  $adapter, array  $options, string  $prefix = '\Pop\Db\Adapter\\') : \Pop\Db\Adapter\AbstractAdapter

Method to connect to a database and return the database adapter object

Parameters

string $adapter
array $options
string $prefix

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Adapter\AbstractAdapter

mysqlConnect()

mysqlConnect(array  $options, string  $prefix = '\Pop\Db\Adapter\\') : \Pop\Db\Adapter\Mysql|\Pop\Db\Adapter\AbstractAdapter

Method to connect to a MySQL database and return the MySQL database adapter object

Parameters

array $options
string $prefix

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Adapter\Mysql|\Pop\Db\Adapter\AbstractAdapter

pdoConnect()

pdoConnect(array  $options, string  $prefix = '\Pop\Db\Adapter\\') : \Pop\Db\Adapter\Pdo|\Pop\Db\Adapter\AbstractAdapter

Method to connect to a PDO database and return the PDO database adapter object

Parameters

array $options
string $prefix

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Adapter\Pdo|\Pop\Db\Adapter\AbstractAdapter

pgsqlConnect()

pgsqlConnect(array  $options, string  $prefix = '\Pop\Db\Adapter\\') : \Pop\Db\Adapter\Pgsql|\Pop\Db\Adapter\AbstractAdapter

Method to connect to a PostgreSQL database and return the PostgreSQL database adapter object

Parameters

array $options
string $prefix

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Adapter\Pgsql|\Pop\Db\Adapter\AbstractAdapter

sqlsrvConnect()

sqlsrvConnect(array  $options, string  $prefix = '\Pop\Db\Adapter\\') : \Pop\Db\Adapter\Sqlsrv|\Pop\Db\Adapter\AbstractAdapter

Method to connect to a SQL Server database and return the SQL Server database adapter object

Parameters

array $options
string $prefix

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Adapter\Sqlsrv|\Pop\Db\Adapter\AbstractAdapter

sqliteConnect()

sqliteConnect(array  $options, string  $prefix = '\Pop\Db\Adapter\\') : \Pop\Db\Adapter\Sqlite|\Pop\Db\Adapter\AbstractAdapter

Method to connect to a SQLite database and return the SQLite database adapter object

Parameters

array $options
string $prefix

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Adapter\Sqlite|\Pop\Db\Adapter\AbstractAdapter

check()

check(string  $adapter, array  $options, string  $prefix = '\Pop\Db\Adapter\\') : mixed

Check the database connection

Parameters

string $adapter
array $options
string $prefix

Returns

mixed

executeSql()

executeSql(string  $sql, mixed  $adapter, array  $options = array(), string  $prefix = '\Pop\Db\Adapter\\') : void

Execute SQL

Parameters

string $sql
mixed $adapter
array $options
string $prefix

Throws

\Pop\Db\Exception

executeSqlFile()

executeSqlFile(string  $sqlFile, mixed  $adapter, array  $options = array(), string  $prefix = '\Pop\Db\Adapter\\') : void

Execute SQL

Parameters

string $sqlFile
mixed $adapter
array $options
string $prefix

Throws

\Pop\Db\Exception

getAvailableAdapters()

getAvailableAdapters() : array

Get the available database adapters

Returns

array

isAvailable()

isAvailable(string  $adapter) : boolean

Determine if a database adapter is available

Parameters

string $adapter

Returns

boolean

setDb()

setDb(\Pop\Db\Adapter\AbstractAdapter  $db, string  $class = null, string  $prefix = null, boolean  $isDefault = false) : void

Set DB adapter

Parameters

\Pop\Db\Adapter\AbstractAdapter $db
string $class
string $prefix
boolean $isDefault

getDb()

getDb(string  $class = null) : \Pop\Db\Adapter\AbstractAdapter

Get DB adapter

Parameters

string $class

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Adapter\AbstractAdapter

hasDb()

hasDb(string  $class = null) : boolean

Check for a DB adapter

Parameters

string $class

Returns

boolean

addClassToTable()

addClassToTable(string  $class, string  $table) : void

Add class-to-table relationship

Parameters

string $class
string $table

hasClassToTable()

hasClassToTable(string  $class) : boolean

Check if class-to-table relationship exists

Parameters

string $class

Returns

boolean

setDefaultDb()

setDefaultDb(\Pop\Db\Adapter\AbstractAdapter  $db, string  $class = null, string  $prefix = null) : void

Set DB adapter

Parameters

\Pop\Db\Adapter\AbstractAdapter $db
string $class
string $prefix

getAll()

getAll() : array

Get all DB adapters

Returns

array