Elgg
Version 3.0
|
Database abstraction query builder. More...
Public Member Functions | |
subquery ($table, $alias=null) | |
Creates a new SelectQueryBuilder for join/where subqueries using the DB connection of the primary QueryBuilder. More... | |
addClause (Clause $clause, $alias=null) | |
Apply clause to this instance. More... | |
prefix ($table) | |
Prefixes the table name with installation DB prefix. More... | |
getTableName () | |
Returns the name of the primary table. More... | |
getTableAlias () | |
Returns the alias of the primary table. More... | |
param ($value, $type=null, $key=null) | |
Sets a new parameter assigning it a unique parameter key/name if none provided Returns the name of the new parameter. More... | |
execute (bool $track_query=true) | |
from ($table, $alias=null) | |
{} More... | |
insert ($insert=null) | |
{} More... | |
update ($table=null, $alias=null) | |
{} More... | |
delete ($table=null, $alias=null) | |
{} More... | |
join ($fromAlias, $join, $alias, $condition=null) | |
{} More... | |
innerJoin ($fromAlias, $join, $alias, $condition=null) | |
{} More... | |
leftJoin ($fromAlias, $join, $alias, $condition=null) | |
{} More... | |
rightJoin ($fromAlias, $join, $alias, $condition=null) | |
{} More... | |
merge ($parts=null, $boolean= 'AND') | |
Merges multiple composite expressions with a boolean. More... | |
compare ($x, $comparison, $y=null, $type=null, $case_sensitive=null) | |
Build value comparison clause. More... | |
between ($x, $lower=null, $upper=null, $type=null) | |
Build a between clause. More... | |
getNextJoinAlias () | |
Get an index of the next available join alias. More... | |
joinEntitiesTable ($from_alias= '', $from_column= 'guid', $join_type= 'inner', $joined_alias=null) | |
Join entity table from alias and return joined table alias. More... | |
joinMetadataTable ($from_alias= '', $from_column= 'guid', $name=null, $join_type= 'inner', $joined_alias=null) | |
Join metadata table from alias and return joined table alias. More... | |
joinAnnotationTable ($from_alias= '', $from_column= 'guid', $name=null, $join_type= 'inner', $joined_alias=null) | |
Join annotations table from alias and return joined table alias. More... | |
joinPrivateSettingsTable ($from_alias= '', $from_column= 'guid', $name=null, $join_type= 'inner', $joined_alias=null) | |
Join private settings table from alias and return joined table alias. More... | |
joinRelationshipTable ($from_alias= '', $from_column= 'guid', $name=null, $inverse=false, $join_type= 'inner', $joined_alias=null) | |
Join relationship table from alias and return joined table alias. More... | |
Public Attributes | |
const | TABLE_ENTITIES = 'entities' |
const | TABLE_METADATA = 'metadata' |
const | TABLE_ANNOTATIONS = 'annotations' |
const | TABLE_RELATIONSHIPS = 'entity_relationships' |
const | TABLE_PRIVATE_SETTINGS = 'private_settings' |
Static Public Attributes | |
static | $calculations |
Protected Attributes | |
$joins = [] | |
$join_index = 0 | |
$table_name | |
$table_alias | |
Database abstraction query builder.
Definition at line 16 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::addClause | ( | Clause | $clause, |
$alias = null |
|||
) |
Apply clause to this instance.
Clause | $clause | Clause |
string | $alias | Table alias |
Definition at line 77 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::between | ( | $x, | |
$lower = null , |
|||
$upper = null , |
|||
$type = null |
|||
) |
Build a between clause.
string | $x | Comparison value (e.g. prefixed column name) |
mixed | $lower | Lower bound |
mixed | $upper | Upper bound |
Definition at line 315 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::compare | ( | $x, | |
$comparison, | |||
$y = null , |
|||
$type = null , |
|||
$case_sensitive = null |
|||
) |
Build value comparison clause.
string | $x | Comparison value (e.g. prefixed column name) |
string | $comparison | Comparison operator |
mixed | $y | Value to compare against If the value is an array, comparisons will be performed in such as a way as to ensure that either all or none of the elements of the array meet the criteria, e.g. in case of LIKE will return results where at least one element matches the criteria, where as with NOT LIKE will return results where none of the criteria are met |
string | $type | Value type for sanitization/casting |
bool | $case_sensitive | Use case sensitive comparison for strings |
Definition at line 302 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::delete | ( | $table = null , |
|
$alias = null |
|||
) |
{}
Definition at line 211 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::execute | ( | bool | $track_query = true | ) |
bool | $track_query | should the query be tracked by timers and loggers |
Definition at line 160 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::from | ( | $table, | |
$alias = null |
|||
) |
{}
Definition at line 176 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::getNextJoinAlias | ( | ) |
Get an index of the next available join alias.
Definition at line 331 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::getTableAlias | ( | ) |
Returns the alias of the primary table.
Definition at line 122 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::getTableName | ( | ) |
Returns the name of the primary table.
Definition at line 114 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::innerJoin | ( | $fromAlias, | |
$join, | |||
$alias, | |||
$condition = null |
|||
) |
{}
Definition at line 228 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::insert | ( | $insert = null | ) |
{}
Definition at line 188 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::join | ( | $fromAlias, | |
$join, | |||
$alias, | |||
$condition = null |
|||
) |
{}
Definition at line 221 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::joinAnnotationTable | ( | $from_alias = '' , |
|
$from_column = 'guid' , |
|||
$name = null , |
|||
$join_type = 'inner' , |
|||
$joined_alias = null |
|||
) |
Join annotations table from alias and return joined table alias.
string | $from_alias | Main table alias |
string | $from_column | Guid column name in the main table |
string|string[] | $name Annotation name | |
string | $join_type | JOIN type |
string | $joined_alias | Joined table alias |
Definition at line 436 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::joinEntitiesTable | ( | $from_alias = '' , |
|
$from_column = 'guid' , |
|||
$join_type = 'inner' , |
|||
$joined_alias = null |
|||
) |
Join entity table from alias and return joined table alias.
string | $from_alias | Main table alias |
string | $from_column | Guid column name in the main table |
string | $join_type | JOIN type |
string | $joined_alias | Joined table alias |
Definition at line 347 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::joinMetadataTable | ( | $from_alias = '' , |
|
$from_column = 'guid' , |
|||
$name = null , |
|||
$join_type = 'inner' , |
|||
$joined_alias = null |
|||
) |
Join metadata table from alias and return joined table alias.
string | $from_alias | Alias of the main table |
string | $from_column | Guid column name in the main table |
string|string[] | $name Metadata name(s) | |
string | $join_type | JOIN type |
string | $joined_alias | Joined table alias |
Definition at line 389 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::joinPrivateSettingsTable | ( | $from_alias = '' , |
|
$from_column = 'guid' , |
|||
$name = null , |
|||
$join_type = 'inner' , |
|||
$joined_alias = null |
|||
) |
Join private settings table from alias and return joined table alias.
string | $from_alias | Main table alias |
string | $from_column | Guid column name in the main table |
string|string[] | $name Private setting name | |
string | $join_type | JOIN type |
string | $joined_alias | Joined table alias |
Definition at line 483 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::joinRelationshipTable | ( | $from_alias = '' , |
|
$from_column = 'guid' , |
|||
$name = null , |
|||
$inverse = false , |
|||
$join_type = 'inner' , |
|||
$joined_alias = null |
|||
) |
Join relationship table from alias and return joined table alias.
string | $from_alias | Main table alias |
string | $from_column | Guid column name in the main table |
string | $name | Relationship name |
bool | $inverse | Join on guid_two column |
string | $join_type | JOIN type |
string | $joined_alias | Joined table alias |
Definition at line 532 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::leftJoin | ( | $fromAlias, | |
$join, | |||
$alias, | |||
$condition = null |
|||
) |
{}
Definition at line 235 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::merge | ( | $parts = null , |
|
$boolean = 'AND' |
|||
) |
Merges multiple composite expressions with a boolean.
mixed | $parts | Composite expression(s) or string(s) |
string | $boolean | AND|OR |
Definition at line 254 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::param | ( | $value, | |
$type = null , |
|||
$key = null |
|||
) |
Sets a new parameter assigning it a unique parameter key/name if none provided Returns the name of the new parameter.
mixed | $value | Parameter value |
string | $type | Parameter type |
string | $key | Parameter key/index |
Definition at line 136 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::prefix | ( | $table | ) |
Prefixes the table name with installation DB prefix.
string | $table |
Definition at line 96 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::rightJoin | ( | $fromAlias, | |
$join, | |||
$alias, | |||
$condition = null |
|||
) |
{}
Definition at line 242 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::subquery | ( | $table, | |
$alias = null |
|||
) |
Creates a new SelectQueryBuilder for join/where subqueries using the DB connection of the primary QueryBuilder.
string | $table | Main table name |
string | $alias | Select alias |
Definition at line 62 of file QueryBuilder.php.
Elgg\Database\QueryBuilder::update | ( | $table = null , |
|
$alias = null |
|||
) |
{}
Definition at line 199 of file QueryBuilder.php.
|
static |
Definition at line 24 of file QueryBuilder.php.
|
protected |
Definition at line 42 of file QueryBuilder.php.
|
protected |
Definition at line 37 of file QueryBuilder.php.
|
protected |
Definition at line 52 of file QueryBuilder.php.
|
protected |
Definition at line 47 of file QueryBuilder.php.
const Elgg\Database\QueryBuilder::TABLE_ANNOTATIONS = 'annotations' |
Definition at line 20 of file QueryBuilder.php.
const Elgg\Database\QueryBuilder::TABLE_ENTITIES = 'entities' |
Definition at line 18 of file QueryBuilder.php.
const Elgg\Database\QueryBuilder::TABLE_METADATA = 'metadata' |
Definition at line 19 of file QueryBuilder.php.
const Elgg\Database\QueryBuilder::TABLE_PRIVATE_SETTINGS = 'private_settings' |
Definition at line 22 of file QueryBuilder.php.
const Elgg\Database\QueryBuilder::TABLE_RELATIONSHIPS = 'entity_relationships' |
Definition at line 21 of file QueryBuilder.php.