PHP Interface Airship\Engine\Contract\DBInterface

An interface for database interaction.
Afficher le fichier Open project: paragonie/airship Interface Usage Examples

Méthodes publiques

Méthode Description
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
delete ( string $table, array $conditions ) Delete rows in a database table.
first ( string $statement, $params ) : mixed Variadic version of $this->column(), with an offset of 0
getDriver ( ) : string Which database driver are we operating on?
getPdo ( ) : PDO Return the PDO object directly
insert ( string $table, array $map ) Insert a new row to a table in a database.
row ( string $statement, $params ) Similar to $this->run() except it only returns a single row
run ( string $statement, $params ) : mixed Run a query, get a 2D array with all the results
single ( string $statement, array $params = [] ) : mixed Fetch a single result -- useful for SELECT COUNT() queries
update ( string $table, array $changes, array $conditions ) Update a row in a database table.

Method Details

cell() public méthode

Variadic version of $this->single()
public cell ( string $statement, $params ) : mixed
$statement string SQL query without user data
$params Parameters
Résultat mixed

col() public méthode

Variadic version of $this->column()
public col ( string $statement, integer $offset, $params ) : mixed
$statement string SQL query without user data
$offset integer - How many columns from the left are we grabbing from each row?
$params Parameters
Résultat mixed

column() public méthode

Fetch a column
public column ( string $statement, array $params = [], integer $offset ) : mixed
$statement string SQL query without user data
$params array Parameters
$offset integer - How many columns from the left are we grabbing from each row?
Résultat mixed

delete() public méthode

Delete rows in a database table.
public delete ( string $table, array $conditions )
$table string - table name
$conditions array - WHERE clause

first() public méthode

Variadic version of $this->column(), with an offset of 0
public first ( string $statement, $params ) : mixed
$statement string SQL query without user data
$params Parameters
Résultat mixed

getDriver() public méthode

Which database driver are we operating on?
public getDriver ( ) : string
Résultat string

getPdo() public méthode

Return the PDO object directly
public getPdo ( ) : PDO
Résultat PDO

insert() public méthode

Insert a new row to a table in a database.
public insert ( string $table, array $map )
$table string - table name
$map array - associative array of which values should be assigned to each field

row() public méthode

Similar to $this->run() except it only returns a single row
public row ( string $statement, $params )
$statement string SQL query without user data
$params Parameters

run() public méthode

Run a query, get a 2D array with all the results
public run ( string $statement, $params ) : mixed
$statement string SQL query without user data
$params Parameters
Résultat mixed - If successful, a 2D array

single() public méthode

Fetch a single result -- useful for SELECT COUNT() queries
public single ( string $statement, array $params = [] ) : mixed
$statement string
$params array
Résultat mixed

update() public méthode

Update a row in a database table.
public update ( string $table, array $changes, array $conditions )
$table string - table name
$changes array - associative array of which values should be assigned to each field
$conditions array - WHERE clause