SqlBuilder
class SqlBuilder
Builds SQL query.
SqlBuilder is based on great library NotORM http://www.notorm.com written by Jakub Vrana.
Properties
protected | $tableName | ||
protected | $conventions | ||
protected | $delimitedTable | ||
protected | $select | column to select |
|
protected | $where | ||
protected | $joinCondition | ||
protected | $conditions | where conditions for caching |
|
protected | $parameters | parameters passed to where conditions |
|
protected | $order | columns to order by |
|
protected | $limit | number of rows to fetch |
|
protected | $offset | first row to fetch |
|
protected | $group | columns to grouping |
|
protected | $having | grouping condition |
|
protected | $reservedTableNames | reserved table names associated with chain |
|
protected | $aliases | table aliases |
|
protected | $currentAlias | currently parsing alias for joins |
Methods
No description
No description
No description
No description
Returns select query hash for caching.
Returns SQL query.
No description
No description
No description
No description
No description
No description
No description
No description
Adds alias.
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
No description
Details
at line 88
__construct(string $tableName, Explorer $explorer)
No description
at line 100
string
getTableName()
No description
at line 106
string
buildInsertQuery()
No description
at line 112
string
buildUpdateQuery()
No description
at line 128
string
buildDeleteQuery()
No description
at line 142
string
getSelectQueryHash(array|null $columns = null)
Returns select query hash for caching.
at line 176
string
buildSelectQuery(array|null $columns = null)
Returns SQL query.
at line 225
array
getParameters()
No description
at line 242
void
importConditions(SqlBuilder $builder)
No description
at line 254
bool
importGroupConditions(SqlBuilder $builder)
No description
at line 271
void
addSelect($columns, ...$params)
No description
at line 282
array
getSelect()
No description
at line 288
void
resetSelect()
No description
at line 295
bool
addWhere($condition, ...$params)
No description
at line 301
bool
addJoinCondition(string $tableChain, $condition, ...$params)
No description
at line 312
protected bool
addCondition($condition, array $params, array $conditions, array $conditionsParameters)
No description
at line 434
array
getConditions()
No description
at line 443
void
addAlias(string $chain, string $alias)
Adds alias.
at line 454
protected void
checkUniqueTableName(string $tableName, string $chain)
No description
at line 472
void
addOrder($columns, ...$params)
No description
at line 479
void
setOrder(array $columns, array $parameters)
No description
at line 486
array
getOrder()
No description
at line 492
void
setLimit(int|null $limit, int|null $offset)
No description
at line 499
int|null
getLimit()
No description
at line 505
int|null
getOffset()
No description
at line 511
void
setGroup($columns, ...$params)
No description
at line 518
string
getGroup()
No description
at line 524
void
setHaving($having, ...$params)
No description
at line 531
string
getHaving()
No description
at line 540
protected string
buildSelect(array $columns)
No description
at line 546
protected array
parseJoinConditions($joins, $joinConditions)
No description
at line 582
protected void
getSortedJoins(string $table, $leftJoinDependency, $tableJoins, $finalJoins)
No description
at line 627
protected void
parseJoins($joins, $query)
No description
at line 643
string
parseJoinsCb($joins, $match)
No description
at line 761
protected string
buildQueryJoins(array $joins, array $leftJoinConditions = [])
No description
at line 775
protected array
buildJoinConditions()
No description
at line 786
protected string
buildConditions()
No description
at line 794
protected string
buildQueryEnd()
No description
at line 813
protected string
tryDelimite(string $s)
No description
at line 821
protected bool
addConditionComposition(array $columns, array $parameters, array $conditions, array $conditionsParameters)
No description
Traits
Strict class for better experience.