Db
in package
Db class
Tags
Table of Contents
Properties
- $classToTable : array<string|int, mixed>
- Database connection class to table relationship
- $db : array<string|int, mixed>
- Database connection(s)
Methods
- addClassToTable() : void
- Add class-to-table relationship
- check() : mixed
- Check the database connection
- connect() : AbstractAdapter
- Method to connect to a database and return the database adapter object
- db() : AbstractAdapter
- Get DB adapter (alias)
- executeSql() : void
- Execute SQL
- executeSqlFile() : void
- Execute SQL
- getAll() : array<string|int, mixed>
- Get all DB adapters
- getAvailableAdapters() : array<string|int, mixed>
- Get the available database adapters
- getDb() : AbstractAdapter
- Get DB adapter
- hasClassToTable() : bool
- Check if class-to-table relationship exists
- hasDb() : bool
- Check for a DB adapter
- isAvailable() : bool
- Determine if a database adapter is available
- mysqlConnect() : Mysql|AbstractAdapter
- Method to connect to a MySQL database and return the MySQL database adapter object
- pdoConnect() : Pdo|AbstractAdapter
- Method to connect to a PDO database and return the PDO database adapter object
- pgsqlConnect() : Pgsql|AbstractAdapter
- Method to connect to a PostgreSQL database and return the PostgreSQL database adapter object
- setDb() : void
- Set DB adapter
- setDefaultDb() : void
- Set DB adapter
- sqliteConnect() : Sqlite|AbstractAdapter
- Method to connect to a SQLite database and return the SQLite database adapter object
- sqlsrvConnect() : Sqlsrv|AbstractAdapter
- Method to connect to a SQL Server database and return the SQL Server database adapter object
Properties
$classToTable
Database connection class to table relationship
protected
static array<string|int, mixed>
$classToTable
= []
$db
Database connection(s)
protected
static array<string|int, mixed>
$db
= ['default' => null]
Methods
addClassToTable()
Add class-to-table relationship
public
static addClassToTable(string $class, string $table) : void
Parameters
- $class : string
- $table : string
check()
Check the database connection
public
static check(string $adapter, array<string|int, mixed> $options[, string $prefix = '\Pop\Db\Adapter\' ]) : mixed
Parameters
- $adapter : string
- $options : array<string|int, mixed>
- $prefix : string = '\Pop\Db\Adapter\'
connect()
Method to connect to a database and return the database adapter object
public
static connect(string $adapter, array<string|int, mixed> $options[, string $prefix = '\Pop\Db\Adapter\' ]) : AbstractAdapter
Parameters
- $adapter : string
- $options : array<string|int, mixed>
- $prefix : string = '\Pop\Db\Adapter\'
Tags
Return values
AbstractAdapterdb()
Get DB adapter (alias)
public
static db([string|null $class = null ]) : AbstractAdapter
Parameters
- $class : string|null = null
Tags
Return values
AbstractAdapterexecuteSql()
Execute SQL
public
static executeSql(string $sql, mixed $adapter[, array<string|int, mixed> $options = [] ][, string $prefix = '\Pop\Db\Adapter\' ]) : void
Parameters
- $sql : string
- $adapter : mixed
- $options : array<string|int, mixed> = []
- $prefix : string = '\Pop\Db\Adapter\'
Tags
executeSqlFile()
Execute SQL
public
static executeSqlFile(string $sqlFile, mixed $adapter[, array<string|int, mixed> $options = [] ][, string $prefix = '\Pop\Db\Adapter\' ]) : void
Parameters
- $sqlFile : string
- $adapter : mixed
- $options : array<string|int, mixed> = []
- $prefix : string = '\Pop\Db\Adapter\'
Tags
getAll()
Get all DB adapters
public
static getAll() : array<string|int, mixed>
Return values
array<string|int, mixed>getAvailableAdapters()
Get the available database adapters
public
static getAvailableAdapters() : array<string|int, mixed>
Return values
array<string|int, mixed>getDb()
Get DB adapter
public
static getDb([string|null $class = null ]) : AbstractAdapter
Parameters
- $class : string|null = null
Tags
Return values
AbstractAdapterhasClassToTable()
Check if class-to-table relationship exists
public
static hasClassToTable(string $class) : bool
Parameters
- $class : string
Return values
boolhasDb()
Check for a DB adapter
public
static hasDb([string|null $class = null ]) : bool
Parameters
- $class : string|null = null
Return values
boolisAvailable()
Determine if a database adapter is available
public
static isAvailable(string $adapter) : bool
Parameters
- $adapter : string
Return values
boolmysqlConnect()
Method to connect to a MySQL database and return the MySQL database adapter object
public
static mysqlConnect(array<string|int, mixed> $options[, string $prefix = '\Pop\Db\Adapter\' ]) : Mysql|AbstractAdapter
Parameters
- $options : array<string|int, mixed>
- $prefix : string = '\Pop\Db\Adapter\'
Tags
Return values
Mysql|AbstractAdapterpdoConnect()
Method to connect to a PDO database and return the PDO database adapter object
public
static pdoConnect(array<string|int, mixed> $options[, string $prefix = '\Pop\Db\Adapter\' ]) : Pdo|AbstractAdapter
Parameters
- $options : array<string|int, mixed>
- $prefix : string = '\Pop\Db\Adapter\'
Tags
Return values
Pdo|AbstractAdapterpgsqlConnect()
Method to connect to a PostgreSQL database and return the PostgreSQL database adapter object
public
static pgsqlConnect(array<string|int, mixed> $options[, string $prefix = '\Pop\Db\Adapter\' ]) : Pgsql|AbstractAdapter
Parameters
- $options : array<string|int, mixed>
- $prefix : string = '\Pop\Db\Adapter\'
Tags
Return values
Pgsql|AbstractAdaptersetDb()
Set DB adapter
public
static setDb(AbstractAdapter $db[, string|null $class = null ][, string|null $prefix = null ][, bool $isDefault = false ]) : void
Parameters
- $db : AbstractAdapter
- $class : string|null = null
- $prefix : string|null = null
- $isDefault : bool = false
setDefaultDb()
Set DB adapter
public
static setDefaultDb(AbstractAdapter $db[, string|null $class = null ][, string|null $prefix = null ]) : void
Parameters
- $db : AbstractAdapter
- $class : string|null = null
- $prefix : string|null = null
sqliteConnect()
Method to connect to a SQLite database and return the SQLite database adapter object
public
static sqliteConnect(array<string|int, mixed> $options[, string $prefix = '\Pop\Db\Adapter\' ]) : Sqlite|AbstractAdapter
Parameters
- $options : array<string|int, mixed>
- $prefix : string = '\Pop\Db\Adapter\'
Tags
Return values
Sqlite|AbstractAdaptersqlsrvConnect()
Method to connect to a SQL Server database and return the SQL Server database adapter object
public
static sqlsrvConnect(array<string|int, mixed> $options[, string $prefix = '\Pop\Db\Adapter\' ]) : Sqlsrv|AbstractAdapter
Parameters
- $options : array<string|int, mixed>
- $prefix : string = '\Pop\Db\Adapter\'