PHP 클래스 LessQL\Result

SELECT {* | select_expr, ...} FROM table [WHERE condition [AND condition [...]]] [ORDER BY {col_name | expr | position} [ASC | DESC], ...] [LIMIT count [OFFSET offset]] TODO Add more SQL dialect specifics like FETCH FIRST, TOP etc.
상속: implements IteratorAggregate, implements JsonSerializable
파일 보기 프로젝트 열기: morris/lessql

보호된 프로퍼티들

프로퍼티 타입 설명
$_cache array
$db Database
$globalRows null | lessql\Row[]
$key null | string
$limitCount null | integer
$limitOffset null | integer
$orderBy array
$parentKey null | string
$parent_ null | Result | lessql\Row
$rows null | lessql\Row[]
$select null | string
$single null | boolean
$table string
$where array
$whereParams array

공개 메소드들

메소드 설명
__call ( string $name, array $args ) : mixed Get referenced row(s) by name. Suffix "List" gets many rows Arguments are passed to where( $where, $params )
__clone ( )
__construct ( Database | Result | lessql\Row $parent, string $name ) Constructor Use $db->createResult( $parent, $name ) instead
aggregate ( string $function ) : mixed Execute aggregate function and return value
count ( string $expr = "*" ) : integer Count number of rows Implements Countable
createRow ( array $data = [] ) : lessql\Row Create a Row for this result's table The row is bound to this result
delete ( ) : PDOStatement Delete all rows matched by this result
execute ( ) Execute the select query defined by this result.
fetch ( ) : lessql\Row Fetch the next row in this result
fetchAll ( ) : lessql\Row[] Fetch all rows in this result
getCache ( string $key ) : null | mixed Get value from cache
getDatabase ( ) : Database Get the database
getDefinition ( ) : string Get a JSON string defining the SELECT information of this Result Used as identification in caches
getGlobalKeys ( string $key ) : array Get global $key values of the result, i.e., disregarding its parent
getIterator ( ) : ArrayIterator IteratorAggregate
getLocalKeys ( string $key ) : array Get $key values of this result
getParent ( ) : Result | lessql\Row Get parent result or row, if any
getRoot ( ) : Result Get the root result
getTable ( ) : string Get the table of this result
insert ( array $rows, string | null $method = null ) : null | PDOStatement Insert one ore more rows into the table of this result See Database::insert for information on $method
isSingle ( ) : boolean Is this result a single association, i.e. not a list of rows?
jsonSerialize ( ) : lessql\Row[] Implements JsonSerialize
limit ( integer $count, integer | null $offset = null ) Set a result limit and optionally an offset
max ( string $expr ) : string Return maximum value from an expression
min ( string $expr ) : string Return minimum value from an expression
orderBy ( string $column, string $direction = "ASC" ) Add an ORDER BY column and direction
paged ( integer $pageSize, integer $page ) Set a paged limit Pages start at 1
primaryResult ( ) : Result Return a new basic result which selects all rows in this result by primary key
referenced ( string $name, string | array | null $where = null, array $params = [] ) : Result Get referenced row(s) by name. Suffix "List" gets many rows
rowCount ( ) : integer Return number of rows in this result
select ( string $expr ) : Result Return a new result with an additional expression to the SELECT part
setCache ( string $key, mixed $value ) Set cache value
sum ( string $expr ) : string Return sum of values in an expression
update ( array $data ) : null | PDOStatement Update the rows matched by this result, setting $data
via ( string $key ) : Result Create result with new reference key
where ( string | array $condition, string | array $params = [] ) : Result Add a WHERE condition (multiple are combined with AND)
whereNot ( string | array $column, string | array | null $value = null ) Add a "$column is not $value" condition to WHERE (multiple are combined with AND)

보호된 메소드들

메소드 설명
getKeys ( lessql\Row[] $rows, string $key ) : array Get $key values of given rows

메소드 상세

__call() 공개 메소드

Get referenced row(s) by name. Suffix "List" gets many rows Arguments are passed to where( $where, $params )
public __call ( string $name, array $args ) : mixed
$name string
$args array
리턴 mixed

__clone() 공개 메소드

public __clone ( )

__construct() 공개 메소드

Constructor Use $db->createResult( $parent, $name ) instead
public __construct ( Database | Result | lessql\Row $parent, string $name )
$parent Database | Result | lessql\Row
$name string

aggregate() 공개 메소드

Execute aggregate function and return value
public aggregate ( string $function ) : mixed
$function string
리턴 mixed

count() 공개 메소드

Count number of rows Implements Countable
public count ( string $expr = "*" ) : integer
$expr string
리턴 integer

createRow() 공개 메소드

Create a Row for this result's table The row is bound to this result
public createRow ( array $data = [] ) : lessql\Row
$data array Row data
리턴 lessql\Row

delete() 공개 메소드

Delete all rows matched by this result
public delete ( ) : PDOStatement
리턴 PDOStatement

execute() 공개 메소드

Execute the select query defined by this result.
public execute ( )

fetch() 공개 메소드

Fetch the next row in this result
public fetch ( ) : lessql\Row
리턴 lessql\Row

fetchAll() 공개 메소드

Fetch all rows in this result
public fetchAll ( ) : lessql\Row[]
리턴 lessql\Row[]

getCache() 공개 메소드

Get value from cache
public getCache ( string $key ) : null | mixed
$key string
리턴 null | mixed

getDatabase() 공개 메소드

Get the database
public getDatabase ( ) : Database
리턴 Database

getDefinition() 공개 메소드

Get a JSON string defining the SELECT information of this Result Used as identification in caches
public getDefinition ( ) : string
리턴 string

getGlobalKeys() 공개 메소드

Get global $key values of the result, i.e., disregarding its parent
public getGlobalKeys ( string $key ) : array
$key string
리턴 array

getIterator() 공개 메소드

IteratorAggregate

getKeys() 보호된 메소드

Get $key values of given rows
protected getKeys ( lessql\Row[] $rows, string $key ) : array
$rows lessql\Row[]
$key string
리턴 array

getLocalKeys() 공개 메소드

Get $key values of this result
public getLocalKeys ( string $key ) : array
$key string
리턴 array

getParent() 공개 메소드

Get parent result or row, if any
public getParent ( ) : Result | lessql\Row
리턴 Result | lessql\Row

getRoot() 공개 메소드

Get the root result
public getRoot ( ) : Result
리턴 Result

getTable() 공개 메소드

Get the table of this result
public getTable ( ) : string
리턴 string

insert() 공개 메소드

Insert one ore more rows into the table of this result See Database::insert for information on $method
public insert ( array $rows, string | null $method = null ) : null | PDOStatement
$rows array
$method string | null
리턴 null | PDOStatement

isSingle() 공개 메소드

Is this result a single association, i.e. not a list of rows?
public isSingle ( ) : boolean
리턴 boolean

jsonSerialize() 공개 메소드

Implements JsonSerialize
public jsonSerialize ( ) : lessql\Row[]
리턴 lessql\Row[]

limit() 공개 메소드

Set a result limit and optionally an offset
public limit ( integer $count, integer | null $offset = null )
$count integer
$offset integer | null

max() 공개 메소드

Return maximum value from an expression
public max ( string $expr ) : string
$expr string
리턴 string

min() 공개 메소드

Return minimum value from an expression
public min ( string $expr ) : string
$expr string
리턴 string

orderBy() 공개 메소드

Add an ORDER BY column and direction
public orderBy ( string $column, string $direction = "ASC" )
$column string
$direction string

paged() 공개 메소드

Set a paged limit Pages start at 1
public paged ( integer $pageSize, integer $page )
$pageSize integer
$page integer

primaryResult() 공개 메소드

Return a new basic result which selects all rows in this result by primary key
public primaryResult ( ) : Result
리턴 Result

referenced() 공개 메소드

Get referenced row(s) by name. Suffix "List" gets many rows
public referenced ( string $name, string | array | null $where = null, array $params = [] ) : Result
$name string
$where string | array | null
$params array
리턴 Result

rowCount() 공개 메소드

Return number of rows in this result
public rowCount ( ) : integer
리턴 integer

select() 공개 메소드

Return a new result with an additional expression to the SELECT part
public select ( string $expr ) : Result
$expr string
리턴 Result

setCache() 공개 메소드

Set cache value
public setCache ( string $key, mixed $value )
$key string
$value mixed

sum() 공개 메소드

Return sum of values in an expression
public sum ( string $expr ) : string
$expr string
리턴 string

update() 공개 메소드

Update the rows matched by this result, setting $data
public update ( array $data ) : null | PDOStatement
$data array
리턴 null | PDOStatement

via() 공개 메소드

Create result with new reference key
public via ( string $key ) : Result
$key string
리턴 Result

where() 공개 메소드

Add a WHERE condition (multiple are combined with AND)
public where ( string | array $condition, string | array $params = [] ) : Result
$condition string | array
$params string | array
리턴 Result

whereNot() 공개 메소드

Add a "$column is not $value" condition to WHERE (multiple are combined with AND)
public whereNot ( string | array $column, string | array | null $value = null )
$column string | array
$value string | array | null

프로퍼티 상세

$_cache 보호되어 있는 프로퍼티

protected array $_cache
리턴 array

$db 보호되어 있는 프로퍼티

protected Database,lessql $db
리턴 Database

$globalRows 보호되어 있는 프로퍼티

protected null|Row[],lessql $globalRows
리턴 null | lessql\Row[]

$key 보호되어 있는 프로퍼티

protected null|string $key
리턴 null | string

$limitCount 보호되어 있는 프로퍼티

protected null|int $limitCount
리턴 null | integer

$limitOffset 보호되어 있는 프로퍼티

protected null|int $limitOffset
리턴 null | integer

$orderBy 보호되어 있는 프로퍼티

protected array $orderBy
리턴 array

$parentKey 보호되어 있는 프로퍼티

protected null|string $parentKey
리턴 null | string

$parent_ 보호되어 있는 프로퍼티

protected null|Result,lessql|Row,lessql $parent_
리턴 null | Result | lessql\Row

$rows 보호되어 있는 프로퍼티

protected null|Row[],lessql $rows
리턴 null | lessql\Row[]

$select 보호되어 있는 프로퍼티

protected null|string $select
리턴 null | string

$single 보호되어 있는 프로퍼티

protected null|bool $single
리턴 null | boolean

$table 보호되어 있는 프로퍼티

protected string $table
리턴 string

$where 보호되어 있는 프로퍼티

protected array $where
리턴 array

$whereParams 보호되어 있는 프로퍼티

protected array $whereParams
리턴 array