\Pop\DbDb

Db class

Summary

Methods
Properties
Constants
connect()
mysqlConnect()
pdoConnect()
pgsqlConnect()
sqlsrvConnect()
sqliteConnect()
check()
install()
getAvailableAdapters()
isAvailable()
hasDb()
setDb()
addClassToTable()
hasClassToTable()
setDefaultDb()
getDb()
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

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

pdoConnect()

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

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

pgsqlConnect()

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

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

sqlsrvConnect()

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

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

sqliteConnect()

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

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

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

install()

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

Install a database schema

Parameters

string $sql
string $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

hasDb()

hasDb(string  $class = null) : boolean

Check for a DB adapter

Parameters

string $class

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

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

getDb()

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

Get DB adapter

Parameters

string $class

Throws

\Pop\Db\Exception

Returns

\Pop\Db\Adapter\AbstractAdapter

getAll()

getAll() : array

Get all DB adapters

Returns

array