PHP 클래스 Nette\Database\Table\Selection

Selection is based on the great library NotORM http://www.notorm.com written by Jakub Vrana.
저자: Jakub Vrana
저자: Jan Skrasek
상속: extends Nette\Object, implements Iterator, implements ArrayAccess, implements Countable
파일 보기 프로젝트 열기: nette/database 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$accessedColumns of touched columns
$aggregation of [conditions => [key => IRow]]; used by GroupedSelection
$cache Nette\Caching\Cache
$context Nette\Database\Context
$conventions Nette\Database\IConventions
$data modifiable data in [primary key => IRow] format
$dataRefreshed boolean
$generalCacheKey string
$globalRefCache cache array of Selection and GroupedSelection prototypes
$keys of primary key values
$name table name
$observeCache should instance observe accessed columns caching
$previousAccessedColumns of earlier touched columns
$primary primary key field name
$primarySequence primary column sequence name, FALSE for autodetection
$refCache mixed
$rows data read from database in [primary key => IRow] format
$specificCacheKey string
$sqlBuilder SqlBuilder

공개 메소드들

메소드 설명
__clone ( )
__construct ( Context $context, Nette\Database\IConventions $conventions, $tableName, Nette\Caching\IStorage $cacheStorage = NULL ) Creates filtered table representation.
__destruct ( )
accessColumn ( $key, $selectColumn = TRUE ) : boolean
aggregation ( $function ) : string Executes aggregation function.
alias ( $tableChain, $alias ) : self Aliases table. Example ':book:book_tag.tag', 'tg'
count ( $column = NULL ) : integer Counts number of rows.
createSelectionInstance ( $table = NULL )
current ( ) : Nette\Database\Table\IRow
delete ( ) : integer Deletes all rows in result set.
fetch ( )
fetchAll ( )
fetchAssoc ( $path )
fetchField ( $column = NULL ) : mixed | FALSE Fetches single field.
fetchPairs ( $key = NULL, $value = NULL )
get ( $key ) : Nette\Database\Table\IRow Returns row specified by primary key.
getDataRefreshed ( ) : boolean Returns if selection requeried for more columns.
getName ( ) : string
getPreviousAccessedColumns ( ) : array | false Loads cache of previous accessed columns and returns it.
getPrimary ( $need = TRUE ) : string | array | null
getPrimarySequence ( ) : string
getReferencedTable ( ActiveRow $row, $table, $column = NULL ) : ActiveRow | null | FALSE Returns referenced row.
getReferencingTable ( $table, $column, $active = NULL ) : GroupedSelection Returns referencing rows.
getSql ( ) : string
getSqlBuilder ( ) : SqlBuilder
group ( $columns, $params ) : self Sets group clause, more calls rewrite old value.
having ( $having, $params ) : self Sets having clause, more calls rewrite old value.
insert ( $data ) : Nette\Database\Table\IRow | integer | boolean Inserts row in a table.
joinWhere ( $tableChain, $condition, $params ) : self Adds ON condition when joining specified table, more calls appends with AND.
key ( ) : string
limit ( $limit, $offset = NULL ) : self Sets limit clause, more calls rewrite old values.
max ( $column ) : integer Returns maximum value from a column.
min ( $column ) : integer Returns minimum value from a column.
next ( )
offsetExists ( $key ) : boolean Tests if row exists.
offsetGet ( $key ) : Nette\Database\Table\IRow Returns specified row.
offsetSet ( $key, $value ) : null Mimic row.
offsetUnset ( $key ) : null Removes row from result set.
order ( $columns, $params ) : self Adds order clause, more calls appends to the end.
page ( $page, $itemsPerPage, &$numOfPages = NULL ) : self Sets offset using page number, more calls rewrite old values.
removeAccessColumn ( $key )
rewind ( ) ******************* interface Iterator ****************d*g*
select ( $columns, $params ) : self Adds select clause, more calls appends to the end.
setPrimarySequence ( $sequence ) : self
sum ( $column ) : integer Returns sum of values in a column.
update ( $data ) : integer Updates all rows in result set.
valid ( )
where ( $condition, $params ) : self Adds where condition, more calls appends with AND.
whereOr ( array $parameters ) : self Adds where condition using the OR operator between parameters.
wherePrimary ( $key ) : self Adds condition for primary key.

보호된 메소드들

메소드 설명
condition ( $condition, array $params, $tableChain = NULL ) : void Adds condition, more calls appends with AND.
createGroupedSelectionInstance ( $table, $column )
createRow ( array $row )
emptyResultSet ( $clearCache = TRUE, $deleteRererencedCache = TRUE )
execute ( ) ******************* internal ****************d*g*
getGeneralCacheKey ( ) : string Returns general cache key independent on query parameters or sql limit Used e.g. for previously accessed columns caching
getRefTable ( &$refPath ) : self Returns Selection parent for caching.
getSpecificCacheKey ( ) : string Returns object specific cache key dependent on query parameters Used e.g. for reference memory caching
loadRefCache ( ) Loads refCache references
query ( $query )
saveCacheState ( )

메소드 상세

__clone() 공개 메소드

public __clone ( )

__construct() 공개 메소드

Creates filtered table representation.
public __construct ( Context $context, Nette\Database\IConventions $conventions, $tableName, Nette\Caching\IStorage $cacheStorage = NULL )
$context Nette\Database\Context
$conventions Nette\Database\IConventions
$cacheStorage Nette\Caching\IStorage

__destruct() 공개 메소드

public __destruct ( )

accessColumn() 공개 메소드

public accessColumn ( $key, $selectColumn = TRUE ) : boolean
리턴 boolean if selection requeried for more columns.

aggregation() 공개 메소드

Executes aggregation function.
public aggregation ( $function ) : string
리턴 string

alias() 공개 메소드

Aliases table. Example ':book:book_tag.tag', 'tg'
public alias ( $tableChain, $alias ) : self
리턴 self

condition() 보호된 메소드

Adds condition, more calls appends with AND.
protected condition ( $condition, array $params, $tableChain = NULL ) : void
$params array
리턴 void

count() 공개 메소드

Counts number of rows.
public count ( $column = NULL ) : integer
리턴 integer

createGroupedSelectionInstance() 보호된 메소드

protected createGroupedSelectionInstance ( $table, $column )

createRow() 보호된 메소드

protected createRow ( array $row )
$row array

createSelectionInstance() 공개 메소드

public createSelectionInstance ( $table = NULL )

current() 공개 메소드

public current ( ) : Nette\Database\Table\IRow
리턴 Nette\Database\Table\IRow

delete() 공개 메소드

Deletes all rows in result set.
public delete ( ) : integer
리턴 integer number of affected rows

emptyResultSet() 보호된 메소드

protected emptyResultSet ( $clearCache = TRUE, $deleteRererencedCache = TRUE )

execute() 보호된 메소드

******************* internal ****************d*g*
protected execute ( )

fetch() 공개 메소드

public fetch ( )

fetchAll() 공개 메소드

public fetchAll ( )

fetchAssoc() 공개 메소드

public fetchAssoc ( $path )

fetchField() 공개 메소드

Fetches single field.
public fetchField ( $column = NULL ) : mixed | FALSE
리턴 mixed | FALSE

fetchPairs() 공개 메소드

public fetchPairs ( $key = NULL, $value = NULL )

get() 공개 메소드

Returns row specified by primary key.
public get ( $key ) : Nette\Database\Table\IRow
리턴 Nette\Database\Table\IRow or FALSE if there is no such row

getDataRefreshed() 공개 메소드

Returns if selection requeried for more columns.
public getDataRefreshed ( ) : boolean
리턴 boolean

getGeneralCacheKey() 보호된 메소드

Returns general cache key independent on query parameters or sql limit Used e.g. for previously accessed columns caching
protected getGeneralCacheKey ( ) : string
리턴 string

getName() 공개 메소드

public getName ( ) : string
리턴 string

getPreviousAccessedColumns() 공개 메소드

Loads cache of previous accessed columns and returns it.
public getPreviousAccessedColumns ( ) : array | false
리턴 array | false

getPrimary() 공개 메소드

public getPrimary ( $need = TRUE ) : string | array | null
리턴 string | array | null

getPrimarySequence() 공개 메소드

public getPrimarySequence ( ) : string
리턴 string

getRefTable() 보호된 메소드

Returns Selection parent for caching.
protected getRefTable ( &$refPath ) : self
리턴 self

getReferencedTable() 공개 메소드

Returns referenced row.
public getReferencedTable ( ActiveRow $row, $table, $column = NULL ) : ActiveRow | null | FALSE
$row ActiveRow
리턴 ActiveRow | null | FALSE NULL if the row does not exist, FALSE if the relationship does not exist

getReferencingTable() 공개 메소드

Returns referencing rows.
public getReferencingTable ( $table, $column, $active = NULL ) : GroupedSelection
리턴 GroupedSelection

getSpecificCacheKey() 보호된 메소드

Returns object specific cache key dependent on query parameters Used e.g. for reference memory caching
protected getSpecificCacheKey ( ) : string
리턴 string

getSql() 공개 메소드

public getSql ( ) : string
리턴 string

getSqlBuilder() 공개 메소드

public getSqlBuilder ( ) : SqlBuilder
리턴 SqlBuilder

group() 공개 메소드

Sets group clause, more calls rewrite old value.
public group ( $columns, $params ) : self
리턴 self

having() 공개 메소드

Sets having clause, more calls rewrite old value.
public having ( $having, $params ) : self
리턴 self

insert() 공개 메소드

Inserts row in a table.
public insert ( $data ) : Nette\Database\Table\IRow | integer | boolean
리턴 Nette\Database\Table\IRow | integer | boolean Returns IRow or number of affected rows for Selection or table without primary key

joinWhere() 공개 메소드

Adds ON condition when joining specified table, more calls appends with AND.
public joinWhere ( $tableChain, $condition, $params ) : self
리턴 self

key() 공개 메소드

public key ( ) : string
리턴 string row ID

limit() 공개 메소드

Sets limit clause, more calls rewrite old values.
public limit ( $limit, $offset = NULL ) : self
리턴 self

loadRefCache() 보호된 메소드

Loads refCache references
protected loadRefCache ( )

max() 공개 메소드

Returns maximum value from a column.
public max ( $column ) : integer
리턴 integer

min() 공개 메소드

Returns minimum value from a column.
public min ( $column ) : integer
리턴 integer

next() 공개 메소드

public next ( )

offsetExists() 공개 메소드

Tests if row exists.
public offsetExists ( $key ) : boolean
리턴 boolean

offsetGet() 공개 메소드

Returns specified row.
public offsetGet ( $key ) : Nette\Database\Table\IRow
리턴 Nette\Database\Table\IRow or NULL if there is no such row

offsetSet() 공개 메소드

Mimic row.
public offsetSet ( $key, $value ) : null
리턴 null

offsetUnset() 공개 메소드

Removes row from result set.
public offsetUnset ( $key ) : null
리턴 null

order() 공개 메소드

Adds order clause, more calls appends to the end.
public order ( $columns, $params ) : self
리턴 self

page() 공개 메소드

Sets offset using page number, more calls rewrite old values.
public page ( $page, $itemsPerPage, &$numOfPages = NULL ) : self
리턴 self

query() 보호된 메소드

protected query ( $query )

removeAccessColumn() 공개 메소드

public removeAccessColumn ( $key )

rewind() 공개 메소드

******************* interface Iterator ****************d*g*
public rewind ( )

saveCacheState() 보호된 메소드

protected saveCacheState ( )

select() 공개 메소드

Adds select clause, more calls appends to the end.
public select ( $columns, $params ) : self
리턴 self

setPrimarySequence() 공개 메소드

public setPrimarySequence ( $sequence ) : self
리턴 self

sum() 공개 메소드

Returns sum of values in a column.
public sum ( $column ) : integer
리턴 integer

update() 공개 메소드

Joins in UPDATE are supported only in MySQL
public update ( $data ) : integer
리턴 integer number of affected rows

valid() 공개 메소드

public valid ( )

where() 공개 메소드

Adds where condition, more calls appends with AND.
public where ( $condition, $params ) : self
리턴 self

whereOr() 공개 메소드

More calls appends with AND.
public whereOr ( array $parameters ) : self
$parameters array
리턴 self

wherePrimary() 공개 메소드

Adds condition for primary key.
public wherePrimary ( $key ) : self
리턴 self

프로퍼티 상세

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

of touched columns
protected $accessedColumns

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

of [conditions => [key => IRow]]; used by GroupedSelection
protected $aggregation

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

protected Cache,Nette\Caching $cache
리턴 Nette\Caching\Cache

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

protected Context,Nette\Database $context
리턴 Nette\Database\Context

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

protected IConventions,Nette\Database $conventions
리턴 Nette\Database\IConventions

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

modifiable data in [primary key => IRow] format
protected $data

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

protected bool $dataRefreshed
리턴 boolean

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

protected string $generalCacheKey
리턴 string

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

cache array of Selection and GroupedSelection prototypes
protected $globalRefCache

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

of primary key values
protected $keys

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

table name
protected $name

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

should instance observe accessed columns caching
protected $observeCache

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

of earlier touched columns
protected $previousAccessedColumns

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

primary key field name
protected $primary

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

primary column sequence name, FALSE for autodetection
protected $primarySequence

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

protected mixed $refCache
리턴 mixed

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

data read from database in [primary key => IRow] format
protected $rows

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

protected string $specificCacheKey
리턴 string

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

protected SqlBuilder,Nette\Database\Table $sqlBuilder
리턴 SqlBuilder