PHP Class Nette\Database\Table\SqlBuilder

SqlBuilder is based on great library NotORM http://www.notorm.com written by Jakub Vrana.
Author: Jakub Vrana
Author: Jan Skrasek
Inheritance: extends Nette\Object
Datei anzeigen Open project: nette/database Class Usage Examples

Protected Properties

Property Type Description
$aliases of table aliases
$conditions of where conditions for caching
$conventions Nette\Database\IConventions
$currentAlias currently parsing alias for joins
$delimitedTable delimited table name
$group columns to grouping
$having grouping condition
$joinCondition of array of join conditions
$limit number of rows to fetch
$offset first row to fetch
$order or columns to order by
$parameters of parameters passed to where conditions
$reservedTableNames of reserved table names associated with chain
$select of column to select
$tableName string
$where of where conditions

Public Methods

Method Description
__construct ( $tableName, Context $context )
addAlias ( $chain, $alias ) : void Adds alias.
addJoinCondition ( $tableChain, $condition, $params )
addOrder ( $columns, $params )
addSelect ( $columns, $params ) ******************* SQL selectors ****************d*g*
addWhere ( $condition, $params )
buildDeleteQuery ( )
buildInsertQuery ( )
buildSelectQuery ( $columns = NULL ) : string Returns SQL query.
buildUpdateQuery ( )
getConditions ( )
getGroup ( )
getHaving ( )
getLimit ( )
getOffset ( )
getOrder ( )
getParameters ( )
getSelect ( )
getSelectQueryHash ( $columns = NULL ) : string Returns select query hash for caching.
getTableName ( ) : string
importConditions ( SqlBuilder $builder )
parseJoinsCb ( &$joins, $match )
setGroup ( $columns, $params )
setHaving ( $having, $params )
setLimit ( $limit, $offset )
setOrder ( array $columns, array $parameters )

Protected Methods

Method Description
addCondition ( $condition, array $params, array &$conditions, array &$conditionsParameters )
addConditionComposition ( array $columns, array $parameters, array &$conditions, array &$conditionsParameters )
buildConditions ( )
buildJoinConditions ( )
buildQueryEnd ( )
buildQueryJoins ( array $joins, array $leftJoinConditions = [] )
buildSelect ( array $columns ) ******************* SQL building ****************d*g*
checkUniqueTableName ( $tableName, $chain )
getSortedJoins ( $table, &$leftJoinDependency, &$tableJoins, &$finalJoins )
parseJoinConditions ( &$joins, $joinConditions )
parseJoins ( &$joins, &$query )
tryDelimite ( $s )

Private Methods

Method Description
getCachedTableList ( )
getColumnChainsRegxp ( )
getConditionHash ( $condition, $parameters )

Method Details

__construct() public method

public __construct ( $tableName, Context $context )
$context Nette\Database\Context

addAlias() public method

Adds alias.
public addAlias ( $chain, $alias ) : void
return void

addCondition() protected method

protected addCondition ( $condition, array $params, array &$conditions, array &$conditionsParameters )
$params array
$conditions array
$conditionsParameters array

addConditionComposition() protected method

protected addConditionComposition ( array $columns, array $parameters, array &$conditions, array &$conditionsParameters )
$columns array
$parameters array
$conditions array
$conditionsParameters array

addJoinCondition() public method

public addJoinCondition ( $tableChain, $condition, $params )

addOrder() public method

public addOrder ( $columns, $params )

addSelect() public method

******************* SQL selectors ****************d*g*
public addSelect ( $columns, $params )

addWhere() public method

public addWhere ( $condition, $params )

buildConditions() protected method

protected buildConditions ( )

buildDeleteQuery() public method

public buildDeleteQuery ( )

buildInsertQuery() public method

public buildInsertQuery ( )

buildJoinConditions() protected method

protected buildJoinConditions ( )

buildQueryEnd() protected method

protected buildQueryEnd ( )

buildQueryJoins() protected method

protected buildQueryJoins ( array $joins, array $leftJoinConditions = [] )
$joins array
$leftJoinConditions array

buildSelect() protected method

******************* SQL building ****************d*g*
protected buildSelect ( array $columns )
$columns array

buildSelectQuery() public method

Returns SQL query.
public buildSelectQuery ( $columns = NULL ) : string
return string

buildUpdateQuery() public method

public buildUpdateQuery ( )

checkUniqueTableName() protected method

protected checkUniqueTableName ( $tableName, $chain )

getConditions() public method

public getConditions ( )

getGroup() public method

public getGroup ( )

getHaving() public method

public getHaving ( )

getLimit() public method

public getLimit ( )

getOffset() public method

public getOffset ( )

getOrder() public method

public getOrder ( )

getParameters() public method

public getParameters ( )

getSelect() public method

public getSelect ( )

getSelectQueryHash() public method

Returns select query hash for caching.
public getSelectQueryHash ( $columns = NULL ) : string
return string

getSortedJoins() protected method

protected getSortedJoins ( $table, &$leftJoinDependency, &$tableJoins, &$finalJoins )

getTableName() public method

public getTableName ( ) : string
return string

importConditions() public method

public importConditions ( SqlBuilder $builder )
$builder SqlBuilder

parseJoinConditions() protected method

protected parseJoinConditions ( &$joins, $joinConditions )

parseJoins() protected method

protected parseJoins ( &$joins, &$query )

parseJoinsCb() public method

public parseJoinsCb ( &$joins, $match )

setGroup() public method

public setGroup ( $columns, $params )

setHaving() public method

public setHaving ( $having, $params )

setLimit() public method

public setLimit ( $limit, $offset )

setOrder() public method

public setOrder ( array $columns, array $parameters )
$columns array
$parameters array

tryDelimite() protected method

protected tryDelimite ( $s )

Property Details

$aliases protected_oe property

of table aliases
protected $aliases

$conditions protected_oe property

of where conditions for caching
protected $conditions

$conventions protected_oe property

protected IConventions,Nette\Database $conventions
return Nette\Database\IConventions

$currentAlias protected_oe property

currently parsing alias for joins
protected $currentAlias

$delimitedTable protected_oe property

delimited table name
protected $delimitedTable

$group protected_oe property

columns to grouping
protected $group

$having protected_oe property

grouping condition
protected $having

$joinCondition protected_oe property

of array of join conditions
protected $joinCondition

$limit protected_oe property

number of rows to fetch
protected $limit

$offset protected_oe property

first row to fetch
protected $offset

$order protected_oe property

or columns to order by
protected $order

$parameters protected_oe property

of parameters passed to where conditions
protected $parameters

$reservedTableNames protected_oe property

of reserved table names associated with chain
protected $reservedTableNames

$select protected_oe property

of column to select
protected $select

$tableName protected_oe property

protected string $tableName
return string

$where protected_oe property

of where conditions
protected $where