Method |
Description |
|
__construct ( PDO $pdo = null, string $dbEngine = '' ) |
Dependency-Injectable constructor |
|
beginTransaction ( ) : boolean |
Initiates a transaction |
|
cell ( string $statement, $params ) : mixed |
Variadic version of $this->single() |
|
col ( string $statement, integer $offset, $params ) : mixed |
Variadic version of $this->column() |
|
column ( string $statement, array $params = [], integer $offset ) : mixed |
Fetch a column |
|
commit ( ) : boolean |
Commits a transaction |
|
delete ( string $table, array $conditions = [] ) : mixed |
Delete rows in a database table. |
|
errorCode ( ) : string |
Fetch the SQLSTATE associated with the last operation on the database
handle |
|
errorInfo ( ) : array |
Fetch extended error information associated with the last operation on
the database handle |
|
escapeIdentifier ( string $string, boolean $quote = true ) : string |
Make sure only valid characters make it in column/table names |
|
escapeValueSet ( array $values, string $type = 'string' ) : string |
Create a parenthetical statement e.g. for NOT IN queries. |
|
exec ( string $statement ) : integer |
Execute an SQL statement and return the number of affected rows |
|
exists ( string $statement, $params ) : boolean |
Use with SELECT COUNT queries to determine if a record exists. |
|
factory ( string $dsn, string $username = '', string $password = '', array $options = [] ) : Database |
Create a new Database object based on PDO constructors |
|
first ( string $statement, $params ) : mixed |
Variadic version of $this->column(), with an offset of 0 |
|
flattenDSN ( array $dbConf, string $username = '', string $password = '' ) : array |
Flatten an array into a DSN string and driver |
|
getAttribute ( integer $attr ) : mixed |
Retrieve a database connection attribute |
|
getAvailableDrivers ( ) : array |
Return an array of available PDO drivers |
|
getDriver ( ) : string |
Which database driver are we operating on? |
|
getPdo ( ) : PDO |
Return the PDO object directly |
|
inTransaction ( ) : boolean |
Checks if inside a transaction |
|
insert ( string $table, array $map = [] ) : mixed |
Insert a new row to a table in a database. |
|
insertGet ( string $table, array $map, string $field ) : mixed |
Insert a new record then get a particular field from the new row |
|
insertMany ( string $table, array $maps ) : boolean |
Insert many new rows to a table in a database. using the same prepared statement |
|
lastInsertId ( $args ) : string |
Returns the ID of the last inserted row or sequence value |
|
prepare ( $args ) : PDOStatement | boolean |
Prepares a statement for execution and returns a statement object |
|
query ( string $statement, integer $mode = PDO::ATTR_DEFAULT_FETCH_MODE, mixed $arg3 = null ) : PDOStatement | boolean |
Executes an SQL statement, returning a result set as a PDOStatement object |
|
quote ( $args ) : string |
Quotes a string for use in a query |
|
rollBack ( ) : boolean |
Rolls back a transaction |
|
row ( string $statement, $params ) : mixed |
Similar to $this->row() except it only returns a single row |
|
run ( string $statement, $params ) : mixed |
PHP 5.6 variadic shorthand for $this->safeQuery() |
|
safeQuery ( string $statement, array $params = [], integer $fetch_style = PDO::FETCH_ASSOC ) : mixed |
Perform a Parameterized Query |
|
setAttribute ( $args ) : boolean |
Set an attribute |
|
single ( string $statement, array $params = [] ) : mixed |
Fetch a single result -- useful for SELECT COUNT() queries |
|
update ( string $table, array $changes, array $conditions ) : mixed |
Update a row in a database table. |
|