AbstractDriver
extends PDO
in package
implements
DriverInterface
Base Database class
Extends PDO to simplify cross-database issues
Interfaces, Classes, Traits and Enums
- DriverInterface
- PDO Interface to implement for database drivers
Table of Contents
- __call() : mixed
- Allow invoke to work on table object
- __construct() : mixed
- PDO constructor wrapper
- _quote() : mixed
- Helper method for quote_ident
- affectedRows() : int
- Returns number of rows affected by an INSERT, UPDATE, DELETE type query
- driverQuery() : array<string|int, mixed>|null
- Method to simplify retrieving db results for meta-data queries
- getColumns() : array<string|int, mixed>|null
- Retrieve column information for the current database table
- getDbs() : array<string|int, mixed>|null
- Return list of dbs for the current connection, if possible
- getFks() : array<string|int, mixed>|null
- Retrieve foreign keys for the table
- getFunctions() : array<string|int, mixed>|null
- Return list of functions for the current database
- getIndexes() : array<string|int, mixed>|null
- Retrieve indexes for the table
- getLastQuery() : string
- Get the last sql query executed
- getProcedures() : array<string|int, mixed>|null
- Return list of stored procedures for the current database
- getSchemas() : array<string|int, mixed>|null
- Return schemas for databases that list them
- getSequences() : array<string|int, mixed>|null
- Return list of sequences for the current database, if they exist
- getSql() : SQLInterface
- Get the SQL class for the current driver
- getSystemTables() : array<string|int, mixed>|null
- Retrieves an array of non-user-created tables for the connection/database
- getTables() : array<string|int, mixed>|null
- Return list of tables for the current database
- getTriggers() : array<string|int, mixed>|null
- Return list of triggers for the current database
- getTypes() : array<string|int, mixed>|null
- Retrieve list of data types for the database
- getUtil() : AbstractUtil
- Get the Util class for the current driver
- getVersion() : string
- Get the version of the database engine
- getViews() : array<string|int, mixed>|null
- Return list of views for the current database
- insertBatch() : array<string|int, mixed>
- Create sql for batch insert
- numRows() : int|null
- Return the number of rows returned for a SELECT query
- prefixTable() : string
- Prefixes a table if it is not already prefixed
- prepareExecute() : PDOStatement
- Create and execute a prepared statement with the provided parameters
- prepareQuery() : PDOStatement
- Simplifies prepared statements for database queries
- quoteIdent() : string|array<string|int, mixed>
- Surrounds the string with the databases identifier escape characters
- quoteTable() : string
- Quote database table name, and set prefix
- returning() : string
- Generate the returning clause for the current database
- setLastQuery() : void
- Set the last query sql
- setTablePrefix() : void
- Set the common table name prefix
- truncate() : PDOStatement
- Empty the passed table
- updateBatch() : array<string|int, mixed>
- Creates a batch update, and executes it.
Methods
__call()
Allow invoke to work on table object
public
__call(string $name[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $name : string
- $args : array<string|int, mixed> = []
Tags
Return values
mixed —__construct()
PDO constructor wrapper
public
__construct(string $dsn[, string $username = NULL ][, string $password = NULL ][, array<string|int, mixed> $driverOptions = [] ]) : mixed
Parameters
- $dsn : string
- $username : string = NULL
- $password : string = NULL
- $driverOptions : array<string|int, mixed> = []
Return values
mixed —_quote()
Helper method for quote_ident
public
_quote(mixed $str) : mixed
Parameters
- $str : mixed
Return values
mixed —affectedRows()
Returns number of rows affected by an INSERT, UPDATE, DELETE type query
public
affectedRows() : int
Return values
int —driverQuery()
Method to simplify retrieving db results for meta-data queries
public
driverQuery(string|array<string|int, mixed> $query[, bool $filteredIndex = TRUE ]) : array<string|int, mixed>|null
Parameters
- $query : string|array<string|int, mixed>
- $filteredIndex : bool = TRUE
Return values
array<string|int, mixed>|null —getColumns()
Retrieve column information for the current database table
public
getColumns(string $table) : array<string|int, mixed>|null
Parameters
- $table : string
Return values
array<string|int, mixed>|null —getDbs()
Return list of dbs for the current connection, if possible
public
getDbs() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —getFks()
Retrieve foreign keys for the table
public
getFks(string $table) : array<string|int, mixed>|null
Parameters
- $table : string
Return values
array<string|int, mixed>|null —getFunctions()
Return list of functions for the current database
public
getFunctions() : array<string|int, mixed>|null
Tags
Return values
array<string|int, mixed>|null —getIndexes()
Retrieve indexes for the table
public
getIndexes(string $table) : array<string|int, mixed>|null
Parameters
- $table : string
Return values
array<string|int, mixed>|null —getLastQuery()
Get the last sql query executed
public
getLastQuery() : string
Return values
string —getProcedures()
Return list of stored procedures for the current database
public
getProcedures() : array<string|int, mixed>|null
Tags
Return values
array<string|int, mixed>|null —getSchemas()
Return schemas for databases that list them
public
getSchemas() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —getSequences()
Return list of sequences for the current database, if they exist
public
getSequences() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —getSql()
Get the SQL class for the current driver
public
getSql() : SQLInterface
Return values
SQLInterface —getSystemTables()
Retrieves an array of non-user-created tables for the connection/database
public
getSystemTables() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —getTables()
Return list of tables for the current database
public
getTables() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —getTriggers()
Return list of triggers for the current database
public
getTriggers() : array<string|int, mixed>|null
Tags
Return values
array<string|int, mixed>|null —getTypes()
Retrieve list of data types for the database
public
getTypes() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —getUtil()
Get the Util class for the current driver
public
getUtil() : AbstractUtil
Return values
AbstractUtil —getVersion()
Get the version of the database engine
public
getVersion() : string
Return values
string —getViews()
Return list of views for the current database
public
getViews() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —insertBatch()
Create sql for batch insert
public
insertBatch(string $table[, array<string|int, mixed> $data = [] ]) : array<string|int, mixed>
Parameters
- $table : string
- $data : array<string|int, mixed> = []
Return values
array<string|int, mixed> —numRows()
Return the number of rows returned for a SELECT query
public
numRows() : int|null
Tags
Return values
int|null —prefixTable()
Prefixes a table if it is not already prefixed
public
prefixTable(string $table) : string
Parameters
- $table : string
Return values
string —prepareExecute()
Create and execute a prepared statement with the provided parameters
public
prepareExecute(string $sql, array<string|int, mixed> $params) : PDOStatement
Parameters
- $sql : string
- $params : array<string|int, mixed>
Tags
Return values
PDOStatement —prepareQuery()
Simplifies prepared statements for database queries
public
prepareQuery(string $sql, array<string|int, mixed> $data) : PDOStatement
Parameters
- $sql : string
- $data : array<string|int, mixed>
Return values
PDOStatement —quoteIdent()
Surrounds the string with the databases identifier escape characters
public
quoteIdent(string|array<string|int, mixed> $identifier) : string|array<string|int, mixed>
Parameters
- $identifier : string|array<string|int, mixed>
Return values
string|array<string|int, mixed> —quoteTable()
Quote database table name, and set prefix
public
quoteTable(string $table) : string
Parameters
- $table : string
Return values
string —returning()
Generate the returning clause for the current database
public
returning(string $query, string $select) : string
Parameters
- $query : string
- $select : string
Return values
string —setLastQuery()
Set the last query sql
public
setLastQuery(string $queryString) : void
Parameters
- $queryString : string
Return values
void —setTablePrefix()
Set the common table name prefix
public
setTablePrefix(string $prefix) : void
Parameters
- $prefix : string
Return values
void —truncate()
Empty the passed table
public
truncate(string $table) : PDOStatement
Parameters
- $table : string
Return values
PDOStatement —updateBatch()
Creates a batch update, and executes it.
public
updateBatch(string $table, array<string|int, mixed> $data, string $where) : array<string|int, mixed>
Returns the number of affected rows
Parameters
- $table : string
-
The table to update
- $data : array<string|int, mixed>
-
an array of update values
- $where : string
-
The where key