class NuoDB extends Compiler

Compiles NuoDB queries.

Constants

JSON_PATH_SEPARATOR

JSON path separator.

Properties

static protected $dateFormat {@inheritdoc}
protected Query $query Query builder. from Compiler
protected array $params Query parameters. from Compiler

Methods

__construct(Query $query)

Constructor.

from Compiler
static string
setDateFormat(string $dateFormat)

Sets the date format.

from Compiler
static string
getDateFormat()

Gets the date format.

from Compiler
string
raw(Raw $raw)

Compiles a raw SQL statement.

from Compiler
string
subquery(Subquery $subquery, bool $enclose = true)

Compiles subquery, merges parameters and returns subquery SQL.

from Compiler
string
escapeIdentifier(string $identifier)

Returns an escaped identifier.

string
escapeIdentifiers(array $identifiers)

Returns an array of escaped identifiers.

from Compiler
bool
hasJsonPath(string $string)

Does the string have a JSON path?

from Compiler
string
buildJsonGet(string $column, array $segments)

Builds a JSON value getter.

from Compiler
string
buildJsonSet(string $column, array $segments, string $param)

Builds a JSON value setter.

from Compiler
string
escapeTableName(string $table)

Escapes a table name.

from Compiler
string
table(mixed $table)

Compiles a table.

from Compiler
string
escapeColumnName(string $column)

Escapes a column name.

from Compiler
string
columnName(string $column)

Compiles a column name.

from Compiler
string
columnNames(array $columns)

Returns a comma-separated list of column names.

from Compiler
string
column(mixed $column, bool $allowAlias = false)

Compiles a column.

from Compiler
string
columns(array $columns, bool $allowAlias = false)

Returns a comma-separated list of compiled columns.

from Compiler
string
commonTableExpressions(array $commonTableExpressions)

Compiles common table expressions.

from Compiler
string
setOperations(array $setOperations)

Compiles set operations.

from Compiler
string
param(mixed $param, bool $enclose = true)

Returns raw SQL or a paramter placeholder.

from Compiler
string
params(array $params, bool $enclose = true)

Returns a comma-separated list of parameters.

from Compiler
string
simpleParam(mixed $param)

Returns a parameter placeholder.

from Compiler
string
simpleParams(array $params)

Returns a comma-separated list of parameter placeholders.

from Compiler
string
from(mixed $table)

Compiles the FROM clause.

from Compiler
string
where(array $where)

Compiles WHERE conditions.

from Compiler
string
whereRaw(array $where)

Compiles a raw WHERE condition.

from Compiler
string
whereDate(array $where)

Compiles date comparison clauses.

from Compiler
string
whereColumn(array $where)

Compiles column comparison clauses.

from Compiler
string
between(array $where)

Compiles BETWEEN clauses.

from Compiler
string
betweenDate(array $where)

Compiles date range clauses.

from Compiler
string
in(array $where)

Compiles IN clauses.

from Compiler
string
null(array $where)

Compiles IS NULL clauses.

from Compiler
string
exists(array $where)

Compiles EXISTS clauses.

from Compiler
string
nestedWhere(array $where)

Compiles nested WHERE conditions.

from Compiler
string
whereConditions(array $wheres)

Compiles WHERE conditions.

from Compiler
string
wheres(array $wheres)

Compiles WHERE clauses.

from Compiler
string
joinCondition(array $condition)

Compiles a JOIN condition.

from Compiler
string
nestedJoinCondition(array $condition)

Compiles nested JOIN condition.

from Compiler
string
joinConditions(Join $join)

Compiles JOIN conditions.

from Compiler
string
joins(array $joins)

Compiles JOIN clauses.

from Compiler
string
groupings(array $groupings)

Compiles GROUP BY clauses.

from Compiler
string
orderings(array $orderings)

Compiles ORDER BY clauses.

from Compiler
string
havingCondictions(array $havings)

Compiles HAVING conditions.

from Compiler
string
havings(array $havings)

Compiles HAVING clauses.

from Compiler
string
limit(int|null $limit)

Compiles LIMIT clauses.

from Compiler
string
offset(int|null $offset)

Compiles OFFSET clauses.

from Compiler
string
lock(bool|string|null $lock)

Compiles locking clause.

array
select()

Compiles a SELECT query.

from Compiler
string
insertWithValues(array $values)

Returns a INSERT query with values.

from Compiler
string
insertWithoutValues()

Returns a INSERT query without values.

from Compiler
array
insert(array $values = [])

Compiles a INSERT query.

from Compiler
string
updateColumns(array $columns)

Compiles update columns.

from Compiler
array
update(array $values)

Compiles a UPDATE query.

from Compiler
array
delete()

Compiles a DELETE query.

from Compiler

Details

in Compiler at line 69
__construct(Query $query)

Constructor.

Parameters

Query $query Query builder

in Compiler at line 80
static string setDateFormat(string $dateFormat)

Sets the date format.

Parameters

string $dateFormat Date format

Return Value

string

in Compiler at line 90
static string getDateFormat()

Gets the date format.

Return Value

string

in Compiler at line 101
protected string raw(Raw $raw)

Compiles a raw SQL statement.

Parameters

Raw $raw Raw SQL

Return Value

string

in Compiler at line 120
protected string subquery(Subquery $subquery, bool $enclose = true)

Compiles subquery, merges parameters and returns subquery SQL.

Parameters

Subquery $subquery Subquery container
bool $enclose Should the subquery be enclosed in parentheses?

Return Value

string

at line 27
string escapeIdentifier(string $identifier)

Returns an escaped identifier.

Parameters

string $identifier Identifier to escape

Return Value

string

in Compiler at line 167
string escapeIdentifiers(array $identifiers)

Returns an array of escaped identifiers.

Parameters

array $identifiers Identifiers to escape

Return Value

string

in Compiler at line 183
protected bool hasJsonPath(string $string)

Does the string have a JSON path?

Parameters

string $string String

Return Value

bool

in Compiler at line 196
protected string buildJsonGet(string $column, array $segments)

Builds a JSON value getter.

Parameters

string $column Column name
array $segments JSON path segments

Return Value

string

Exceptions

RuntimeException

in Compiler at line 210
protected string buildJsonSet(string $column, array $segments, string $param)

Builds a JSON value setter.

Parameters

string $column Column name
array $segments JSON path segments
string $param Parameter

Return Value

string

Exceptions

RuntimeException

in Compiler at line 221
string escapeTableName(string $table)

Escapes a table name.

Parameters

string $table Table name

Return Value

string

in Compiler at line 239
string table(mixed $table)

Compiles a table.

Parameters

mixed $table Table

Return Value

string

in Compiler at line 265
string escapeColumnName(string $column)

Escapes a column name.

Parameters

string $column Column name

Return Value

string

in Compiler at line 290
string columnName(string $column)

Compiles a column name.

Parameters

string $column Column name

Return Value

string

in Compiler at line 310
string columnNames(array $columns)

Returns a comma-separated list of column names.

Parameters

array $columns Array of column names

Return Value

string

in Compiler at line 329
string column(mixed $column, bool $allowAlias = false)

Compiles a column.

Parameters

mixed $column Column
bool $allowAlias Allow aliases?

Return Value

string

in Compiler at line 356
string columns(array $columns, bool $allowAlias = false)

Returns a comma-separated list of compiled columns.

Parameters

array $columns Array of columns
bool $allowAlias Allow aliases?

Return Value

string

in Compiler at line 374
protected string commonTableExpressions(array $commonTableExpressions)

Compiles common table expressions.

Parameters

array $commonTableExpressions Common table expressions

Return Value

string

in Compiler at line 406
protected string setOperations(array $setOperations)

Compiles set operations.

Parameters

array $setOperations Set operations

Return Value

string

in Compiler at line 430
protected string param(mixed $param, bool $enclose = true)

Returns raw SQL or a paramter placeholder.

Parameters

mixed $param Parameter
bool $enclose Should subqueries be enclosed in parentheses?

Return Value

string

in Compiler at line 459
protected string params(array $params, bool $enclose = true)

Returns a comma-separated list of parameters.

Parameters

array $params Array of parameters
bool $enclose Should subqueries be enclosed in parentheses?

Return Value

string

in Compiler at line 477
protected string simpleParam(mixed $param)

Returns a parameter placeholder.

Parameters

mixed $param Parameter

Return Value

string

in Compiler at line 490
protected string simpleParams(array $params)

Returns a comma-separated list of parameter placeholders.

Parameters

array $params Parameters

Return Value

string

in Compiler at line 508
protected string from(mixed $table)

Compiles the FROM clause.

Parameters

mixed $table Table

Return Value

string

in Compiler at line 519
protected string where(array $where)

Compiles WHERE conditions.

Parameters

array $where Where clause

Return Value

string

in Compiler at line 539
protected string whereRaw(array $where)

Compiles a raw WHERE condition.

Parameters

array $where Where clause

Return Value

string

in Compiler at line 551
protected string whereDate(array $where)

Compiles date comparison clauses.

Parameters

array $where Where clause

Return Value

string

Exceptions

RuntimeException

in Compiler at line 562
protected string whereColumn(array $where)

Compiles column comparison clauses.

Parameters

array $where Where clause

Return Value

string

in Compiler at line 582
protected string between(array $where)

Compiles BETWEEN clauses.

Parameters

array $where Where clause

Return Value

string

in Compiler at line 594
protected string betweenDate(array $where)

Compiles date range clauses.

Parameters

array $where Where clause

Return Value

string

Exceptions

RuntimeException

in Compiler at line 605
protected string in(array $where)

Compiles IN clauses.

Parameters

array $where Where clause

Return Value

string

in Compiler at line 618
protected string null(array $where)

Compiles IS NULL clauses.

Parameters

array $where Where clause

Return Value

string

in Compiler at line 629
protected string exists(array $where)

Compiles EXISTS clauses.

Parameters

array $where Exists clause

Return Value

string

in Compiler at line 640
protected string nestedWhere(array $where)

Compiles nested WHERE conditions.

Parameters

array $where Where clause

Return Value

string

in Compiler at line 651
protected string whereConditions(array $wheres)

Compiles WHERE conditions.

Parameters

array $wheres Where conditions

Return Value

string

in Compiler at line 673
protected string wheres(array $wheres)

Compiles WHERE clauses.

Parameters

array $wheres Array of where clauses

Return Value

string

in Compiler at line 689
protected string joinCondition(array $condition)

Compiles a JOIN condition.

Parameters

array $condition Join condition

Return Value

string

in Compiler at line 700
protected string nestedJoinCondition(array $condition)

Compiles nested JOIN condition.

Parameters

array $condition Join condition

Return Value

string

in Compiler at line 713
protected string joinConditions(Join $join)

Compiles JOIN conditions.

Parameters

Join $join Join

Return Value

string

in Compiler at line 735
protected string joins(array $joins)

Compiles JOIN clauses.

Parameters

array $joins Array of joins

Return Value

string

in Compiler at line 758
protected string groupings(array $groupings)

Compiles GROUP BY clauses.

Parameters

array $groupings Array of column names

Return Value

string

in Compiler at line 769
protected string orderings(array $orderings)

Compiles ORDER BY clauses.

Parameters

array $orderings Array of order by clauses

Return Value

string

in Compiler at line 792
protected string havingCondictions(array $havings)

Compiles HAVING conditions.

Parameters

array $havings Having conditions

Return Value

string

in Compiler at line 814
protected string havings(array $havings)

Compiles HAVING clauses.

Parameters

array $havings Array of having clauses

Return Value

string

in Compiler at line 830
protected string limit(int|null $limit)

Compiles LIMIT clauses.

Parameters

int|null $limit Limit

Return Value

string

in Compiler at line 841
protected string offset(int|null $offset)

Compiles OFFSET clauses.

Parameters

int|null $offset Limit

Return Value

string

at line 35
string lock(bool|string|null $lock)

Compiles locking clause.

Parameters

bool|string|null $lock

Return Value

string

in Compiler at line 862
array select()

Compiles a SELECT query.

Return Value

array

in Compiler at line 888
protected string insertWithValues(array $values)

Returns a INSERT query with values.

Parameters

array $values Array of values

Return Value

string

in Compiler at line 903
protected string insertWithoutValues()

Returns a INSERT query without values.

Return Value

string

in Compiler at line 914
array insert(array $values = [])

Compiles a INSERT query.

Parameters

array $values Array of values

Return Value

array

in Compiler at line 936
protected string updateColumns(array $columns)

Compiles update columns.

Parameters

array $columns Associative array of columns and values

Return Value

string

in Compiler at line 967
array update(array $values)

Compiles a UPDATE query.

Parameters

array $values Array of values

Return Value

array

in Compiler at line 984
array delete()

Compiles a DELETE query.

Return Value

array