PHP Класс Pheasant\Database\Mysqli\Table

Показать файл Открыть проект

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

Метод Описание
__construct ( $name, $connection ) Constructor
__toString ( ) Return the string name of the table
columns ( ) : array Returns all the database columns in SHOW COLUMN format
create ( $columns, $options = 'charset=utf8 engine=innodb' ) Creates the table, fails if the table exists
createIfNotExists ( $columns, $options = 'charset=utf8 engine=innodb' ) Creates the table if it doesn't exist
delete ( $criteria = NULL ) Deletes rows in the table
drop ( ) Drops the table
dropIfExists ( ) Drops the table if it exists
exists ( ) Determines if the table exists (name only, column definition not checked)
insert ( $data ) Inserts a row into the table
name ( ) Returns the name of the table as a TableName
query ( $criteria = null ) Builds a Query object for the table
replace ( $data ) Inserts a row, or replaces it entirely if a row with the primary key exists
truncate ( ) Truncates the table
update ( $data, Criteria $where, $limit = false ) Updates a row into the table
upsert ( $data ) Tries to update a record, or inserts if it doesn't exist. Worth noting that affectedRows will be 2 on an update, 1 on an insert.
where ( $where, $params = [] ) Builds a TableCriteria object for the table

Приватные методы

Метод Описание
_buildSet ( $data ) Builds a series of X=?, Y=?, Z=?

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

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

Constructor
public __construct ( $name, $connection )
$name TableName

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

Return the string name of the table
public __toString ( )

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

Returns all the database columns in SHOW COLUMN format
public columns ( ) : array
Результат array

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

Creates the table, fails if the table exists
public create ( $columns, $options = 'charset=utf8 engine=innodb' )
$columns a map defining columns to Type objects

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

Creates the table if it doesn't exist
public createIfNotExists ( $columns, $options = 'charset=utf8 engine=innodb' )

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

Deletes rows in the table
public delete ( $criteria = NULL )

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

Drops the table
public drop ( )

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

Drops the table if it exists
public dropIfExists ( )

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

Determines if the table exists (name only, column definition not checked)
public exists ( )

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

Inserts a row into the table
public insert ( $data )

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

Returns the name of the table as a TableName
public name ( )

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

Builds a Query object for the table
public query ( $criteria = null )

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

Inserts a row, or replaces it entirely if a row with the primary key exists
См. также: http://dev.mysql.com/doc/refman/5.0/en/replace.html
public replace ( $data )

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

Truncates the table
public truncate ( )

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

Updates a row into the table
public update ( $data, Criteria $where, $limit = false )
$where Pheasant\Query\Criteria

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

Tries to update a record, or inserts if it doesn't exist. Worth noting that affectedRows will be 2 on an update, 1 on an insert.
public upsert ( $data )

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

Builds a TableCriteria object for the table
public where ( $where, $params = [] )