PHP Интерфейс Airship\Engine\Contract\DBInterface

An interface for database interaction.
Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
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.

Описание методов

cell() публичный Метод

Variadic version of $this->single()
public cell ( string $statement, $params ) : mixed
$statement string SQL query without user data
$params Parameters
Результат mixed

col() публичный Метод

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
Результат mixed

column() публичный Метод

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?
Результат mixed

delete() публичный Метод

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

first() публичный Метод

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
Результат mixed

getDriver() публичный Метод

Which database driver are we operating on?
public getDriver ( ) : string
Результат string

getPdo() публичный Метод

Return the PDO object directly
public getPdo ( ) : PDO
Результат PDO

insert() публичный Метод

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() публичный Метод

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() публичный Метод

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
Результат mixed - If successful, a 2D array

single() публичный Метод

Fetch a single result -- useful for SELECT COUNT() queries
public single ( string $statement, array $params = [] ) : mixed
$statement string
$params array
Результат mixed

update() публичный Метод

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