Documentation

PostgresGrammar extends Grammar
in package

Table of Contents

$operators  : array<string|int, mixed>
All of the available clause operators.
$selectComponents  : array<string|int, mixed>
The components that make up a select clause.
$tablePrefix  : string
The grammar table prefix.
columnize()  : string
Convert an array of column names into a delimited string.
compileDelete()  : string
Compile a delete statement into SQL.
compileExists()  : string
Compile an exists statement into SQL.
compileInsert()  : string
Compile an insert statement into SQL.
compileInsertGetId()  : string
Compile an insert and get ID statement into SQL.
compileRandom()  : string
Compile the random statement into SQL.
compileSavepoint()  : string
Compile the SQL statement to define a savepoint.
compileSavepointRollBack()  : string
Compile the SQL statement to execute a savepoint rollback.
compileSelect()  : string
Compile a select query into SQL.
compileTruncate()  : array<string|int, mixed>
Compile a truncate table statement into SQL.
compileUpdate()  : string
Compile an update statement into SQL.
getDateFormat()  : string
Get the format for database stored dates.
getOperators()  : array<string|int, mixed>
Get the grammar specific operators.
getTablePrefix()  : string
Get the grammar's table prefix.
getValue()  : string
Get the value of a raw expression.
isExpression()  : bool
Determine if the given value is a raw expression.
parameter()  : string
Get the appropriate query parameter place-holder for a value.
parameterize()  : string
Create query parameter place-holders for an array.
prepareBindingsForDelete()  : array<string|int, mixed>
Prepare the bindings for a delete statement.
prepareBindingsForUpdate()  : array<string|int, mixed>
Prepare the bindings for an update statement.
setTablePrefix()  : $this
Set the grammar's table prefix.
supportsSavepoints()  : bool
Determine if the grammar supports savepoints.
wrap()  : string
Wrap a value in keyword identifiers.
wrapArray()  : array<string|int, mixed>
Wrap an array of values.
wrapTable()  : string
Wrap a table in keyword identifiers.
compileAggregate()  : string
Compile an aggregated select clause.
compileBasicHaving()  : string
Compile a basic having clause.
compileColumns()  : string|null
Compile the "select *" portion of the query.
compileComponents()  : array<string|int, mixed>
Compile the components necessary for a select clause.
compileDeleteWithJoins()  : string
Compile a delete query that uses joins.
compileFrom()  : string
Compile the "from" portion of the query.
compileGroups()  : string
Compile the "group by" portions of the query.
compileHaving()  : string
Compile a single having clause.
compileHavings()  : string
Compile the "having" portions of the query.
compileJoins()  : string
Compile the "join" portions of the query.
compileLimit()  : string
Compile the "limit" portions of the query.
compileLock()  : string
Compile the lock into SQL.
compileOffset()  : string
Compile the "offset" portions of the query.
compileOrders()  : string
Compile the "order by" portions of the query.
compileOrdersToArray()  : array<string|int, mixed>
Compile the query orders to an array.
compileUnion()  : string
Compile a single union statement.
compileUnions()  : string
Compile the "union" queries attached to the main query.
compileUpdateColumns()  : string
Compile the columns for the update statement.
compileUpdateFrom()  : string|null
Compile the "from" clause for an update with a join.
compileUpdateJoinWheres()  : string
Compile the "join" clause where clauses for an update.
compileUpdateWheres()  : string
Compile the additional where clauses for updates with joins.
compileWheres()  : string
Compile the "where" portions of the query.
compileWheresToArray()  : array<string|int, mixed>
Get an array of all the where clauses for the query.
concatenate()  : string
Concatenate an array of segments, removing empties.
concatenateWhereClauses()  : string
Format the where clause statements into one string.
dateBasedWhere()  : string
Compile a date based where clause.
removeLeadingBoolean()  : string
Remove the leading boolean from a statement.
whereBasic()  : string
Compile a basic where clause.
whereBetween()  : string
Compile a "between" where clause.
whereColumn()  : string
Compile a where clause comparing two columns.
whereDate()  : string
Compile a "where date" clause.
whereDay()  : string
Compile a "where day" clause.
whereExists()  : string
Compile a where exists clause.
whereIn()  : string
Compile a "where in" clause.
whereInSub()  : string
Compile a where in sub-select clause.
whereMonth()  : string
Compile a "where month" clause.
whereNested()  : string
Compile a nested where clause.
whereNotExists()  : string
Compile a where exists clause.
whereNotIn()  : string
Compile a "where not in" clause.
whereNotInSub()  : string
Compile a where not in sub-select clause.
whereNotNull()  : string
Compile a "where not null" clause.
whereNull()  : string
Compile a "where null" clause.
whereRaw()  : string
Compile a raw where clause.
whereSub()  : string
Compile a where condition with a sub-select.
whereTime()  : string
Compile a "where time" clause.
whereYear()  : string
Compile a "where year" clause.
wrapAliasedValue()  : string
Wrap a value that has an alias.
wrapJsonPathAttributes()  : array<string|int, mixed>
Wrap the attributes of the give JSON path.
wrapJsonSelector()  : string
Wrap the given JSON selector.
wrapSegments()  : string
Wrap the given value segments.
wrapValue()  : string
Wrap a single string in keyword identifiers.

Properties

$operators

All of the available clause operators.

protected array<string|int, mixed> $operators = ['=', '<', '>', '<=', '>=', '<>', '!=', 'like', 'not like', 'between', 'ilike', '~', '&', '|', '#', '<<', '>>', '<<=', '>>=', '&&', '@>', '<@', '?', '?|', '?&', '||', '-', '+', '#-']

$selectComponents

The components that make up a select clause.

protected array<string|int, mixed> $selectComponents = ['aggregate', 'columns', 'from', 'joins', 'wheres', 'groups', 'havings', 'orders', 'limit', 'offset', 'unions', 'lock']

$tablePrefix

The grammar table prefix.

protected string $tablePrefix = ''

Methods

columnize()

Convert an array of column names into a delimited string.

public columnize(array<string|int, mixed> $columns) : string
Parameters
$columns : array<string|int, mixed>
Return values
string

compileDelete()

Compile a delete statement into SQL.

public compileDelete(Builder $query) : string
Parameters
$query : Builder
Return values
string

compileExists()

Compile an exists statement into SQL.

public compileExists(Builder $query) : string
Parameters
$query : Builder
Return values
string

compileInsert()

Compile an insert statement into SQL.

public compileInsert(Builder $query, array<string|int, mixed> $values) : string
Parameters
$query : Builder
$values : array<string|int, mixed>
Return values
string

compileInsertGetId()

Compile an insert and get ID statement into SQL.

public compileInsertGetId(Builder $query, array<string|int, mixed> $values, string $sequence) : string
Parameters
$query : Builder
$values : array<string|int, mixed>
$sequence : string
Return values
string

compileRandom()

Compile the random statement into SQL.

public compileRandom(string $seed) : string
Parameters
$seed : string
Return values
string

compileSavepoint()

Compile the SQL statement to define a savepoint.

public compileSavepoint(string $name) : string
Parameters
$name : string
Return values
string

compileSavepointRollBack()

Compile the SQL statement to execute a savepoint rollback.

public compileSavepointRollBack(string $name) : string
Parameters
$name : string
Return values
string

compileSelect()

Compile a select query into SQL.

public compileSelect(Builder $query) : string
Parameters
$query : Builder
Return values
string

compileTruncate()

Compile a truncate table statement into SQL.

public compileTruncate(Builder $query) : array<string|int, mixed>
Parameters
$query : Builder
Return values
array<string|int, mixed>

compileUpdate()

Compile an update statement into SQL.

public compileUpdate(Builder $query, array<string|int, mixed> $values) : string
Parameters
$query : Builder
$values : array<string|int, mixed>
Return values
string

getDateFormat()

Get the format for database stored dates.

public getDateFormat() : string
Return values
string

getOperators()

Get the grammar specific operators.

public getOperators() : array<string|int, mixed>
Return values
array<string|int, mixed>

getTablePrefix()

Get the grammar's table prefix.

public getTablePrefix() : string
Return values
string

getValue()

Get the value of a raw expression.

public getValue(Expression $expression) : string
Parameters
$expression : Expression
Return values
string

isExpression()

Determine if the given value is a raw expression.

public isExpression(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

parameter()

Get the appropriate query parameter place-holder for a value.

public parameter(mixed $value) : string
Parameters
$value : mixed
Return values
string

parameterize()

Create query parameter place-holders for an array.

public parameterize(array<string|int, mixed> $values) : string
Parameters
$values : array<string|int, mixed>
Return values
string

prepareBindingsForDelete()

Prepare the bindings for a delete statement.

public prepareBindingsForDelete(array<string|int, mixed> $bindings) : array<string|int, mixed>
Parameters
$bindings : array<string|int, mixed>
Return values
array<string|int, mixed>

prepareBindingsForUpdate()

Prepare the bindings for an update statement.

public prepareBindingsForUpdate(array<string|int, mixed> $bindings, array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$bindings : array<string|int, mixed>
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

setTablePrefix()

Set the grammar's table prefix.

public setTablePrefix(string $prefix) : $this
Parameters
$prefix : string
Return values
$this

supportsSavepoints()

Determine if the grammar supports savepoints.

public supportsSavepoints() : bool
Return values
bool

wrap()

Wrap a value in keyword identifiers.

public wrap(Expression|string $value[, bool $prefixAlias = false ]) : string
Parameters
$value : Expression|string
$prefixAlias : bool = false
Return values
string

wrapArray()

Wrap an array of values.

public wrapArray(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

wrapTable()

Wrap a table in keyword identifiers.

public wrapTable(Expression|string $table) : string
Parameters
$table : Expression|string
Return values
string

compileAggregate()

Compile an aggregated select clause.

protected compileAggregate(Builder $query, array<string|int, mixed> $aggregate) : string
Parameters
$query : Builder
$aggregate : array<string|int, mixed>
Return values
string

compileBasicHaving()

Compile a basic having clause.

protected compileBasicHaving(array<string|int, mixed> $having) : string
Parameters
$having : array<string|int, mixed>
Return values
string

compileColumns()

Compile the "select *" portion of the query.

protected compileColumns(Builder $query, array<string|int, mixed> $columns) : string|null
Parameters
$query : Builder
$columns : array<string|int, mixed>
Return values
string|null

compileComponents()

Compile the components necessary for a select clause.

protected compileComponents(Builder $query) : array<string|int, mixed>
Parameters
$query : Builder
Return values
array<string|int, mixed>

compileDeleteWithJoins()

Compile a delete query that uses joins.

protected compileDeleteWithJoins(Builder $query, string $table) : string
Parameters
$query : Builder
$table : string
Return values
string

compileFrom()

Compile the "from" portion of the query.

protected compileFrom(Builder $query, string $table) : string
Parameters
$query : Builder
$table : string
Return values
string

compileGroups()

Compile the "group by" portions of the query.

protected compileGroups(Builder $query, array<string|int, mixed> $groups) : string
Parameters
$query : Builder
$groups : array<string|int, mixed>
Return values
string

compileHaving()

Compile a single having clause.

protected compileHaving(array<string|int, mixed> $having) : string
Parameters
$having : array<string|int, mixed>
Return values
string

compileHavings()

Compile the "having" portions of the query.

protected compileHavings(Builder $query, array<string|int, mixed> $havings) : string
Parameters
$query : Builder
$havings : array<string|int, mixed>
Return values
string

compileJoins()

Compile the "join" portions of the query.

protected compileJoins(Builder $query, array<string|int, mixed> $joins) : string
Parameters
$query : Builder
$joins : array<string|int, mixed>
Return values
string

compileLimit()

Compile the "limit" portions of the query.

protected compileLimit(Builder $query, int $limit) : string
Parameters
$query : Builder
$limit : int
Return values
string

compileLock()

Compile the lock into SQL.

protected compileLock(Builder $query, bool|string $value) : string
Parameters
$query : Builder
$value : bool|string
Return values
string

compileOffset()

Compile the "offset" portions of the query.

protected compileOffset(Builder $query, int $offset) : string
Parameters
$query : Builder
$offset : int
Return values
string

compileOrders()

Compile the "order by" portions of the query.

protected compileOrders(Builder $query, array<string|int, mixed> $orders) : string
Parameters
$query : Builder
$orders : array<string|int, mixed>
Return values
string

compileOrdersToArray()

Compile the query orders to an array.

protected compileOrdersToArray(Builder $query, array<string|int, mixed> $orders) : array<string|int, mixed>
Parameters
$query : Builder
$orders : array<string|int, mixed>
Return values
array<string|int, mixed>

compileUnion()

Compile a single union statement.

protected compileUnion(array<string|int, mixed> $union) : string
Parameters
$union : array<string|int, mixed>
Return values
string

compileUnions()

Compile the "union" queries attached to the main query.

protected compileUnions(Builder $query) : string
Parameters
$query : Builder
Return values
string

compileUpdateColumns()

Compile the columns for the update statement.

protected compileUpdateColumns(array<string|int, mixed> $values) : string
Parameters
$values : array<string|int, mixed>
Return values
string

compileUpdateFrom()

Compile the "from" clause for an update with a join.

protected compileUpdateFrom(Builder $query) : string|null
Parameters
$query : Builder
Return values
string|null

compileUpdateJoinWheres()

Compile the "join" clause where clauses for an update.

protected compileUpdateJoinWheres(Builder $query) : string
Parameters
$query : Builder
Return values
string

compileUpdateWheres()

Compile the additional where clauses for updates with joins.

protected compileUpdateWheres(Builder $query) : string
Parameters
$query : Builder
Return values
string

compileWheres()

Compile the "where" portions of the query.

protected compileWheres(Builder $query) : string
Parameters
$query : Builder
Return values
string

compileWheresToArray()

Get an array of all the where clauses for the query.

protected compileWheresToArray(Builder $query) : array<string|int, mixed>
Parameters
$query : Builder
Return values
array<string|int, mixed>

concatenate()

Concatenate an array of segments, removing empties.

protected concatenate(array<string|int, mixed> $segments) : string
Parameters
$segments : array<string|int, mixed>
Return values
string

concatenateWhereClauses()

Format the where clause statements into one string.

protected concatenateWhereClauses(Builder $query, array<string|int, mixed> $sql) : string
Parameters
$query : Builder
$sql : array<string|int, mixed>
Return values
string

dateBasedWhere()

Compile a date based where clause.

protected dateBasedWhere(string $type, Builder $query, array<string|int, mixed> $where) : string
Parameters
$type : string
$query : Builder
$where : array<string|int, mixed>
Return values
string

removeLeadingBoolean()

Remove the leading boolean from a statement.

protected removeLeadingBoolean(string $value) : string
Parameters
$value : string
Return values
string

whereBasic()

Compile a basic where clause.

protected whereBasic(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereBetween()

Compile a "between" where clause.

protected whereBetween(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereColumn()

Compile a where clause comparing two columns.

protected whereColumn(Builder $query, array<string|int, mixed> $where) : string

.

Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereDate()

Compile a "where date" clause.

protected whereDate(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereDay()

Compile a "where day" clause.

protected whereDay(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereExists()

Compile a where exists clause.

protected whereExists(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereIn()

Compile a "where in" clause.

protected whereIn(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereInSub()

Compile a where in sub-select clause.

protected whereInSub(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereMonth()

Compile a "where month" clause.

protected whereMonth(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereNested()

Compile a nested where clause.

protected whereNested(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereNotExists()

Compile a where exists clause.

protected whereNotExists(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereNotIn()

Compile a "where not in" clause.

protected whereNotIn(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereNotInSub()

Compile a where not in sub-select clause.

protected whereNotInSub(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereNotNull()

Compile a "where not null" clause.

protected whereNotNull(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereNull()

Compile a "where null" clause.

protected whereNull(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereRaw()

Compile a raw where clause.

protected whereRaw(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereSub()

Compile a where condition with a sub-select.

protected whereSub(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereTime()

Compile a "where time" clause.

protected whereTime(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

whereYear()

Compile a "where year" clause.

protected whereYear(Builder $query, array<string|int, mixed> $where) : string
Parameters
$query : Builder
$where : array<string|int, mixed>
Return values
string

wrapAliasedValue()

Wrap a value that has an alias.

protected wrapAliasedValue(string $value[, bool $prefixAlias = false ]) : string
Parameters
$value : string
$prefixAlias : bool = false
Return values
string

wrapJsonPathAttributes()

Wrap the attributes of the give JSON path.

protected wrapJsonPathAttributes(array<string|int, mixed> $path) : array<string|int, mixed>
Parameters
$path : array<string|int, mixed>
Return values
array<string|int, mixed>

wrapJsonSelector()

Wrap the given JSON selector.

protected wrapJsonSelector(string $value) : string
Parameters
$value : string
Return values
string

wrapSegments()

Wrap the given value segments.

protected wrapSegments(array<string|int, mixed> $segments) : string
Parameters
$segments : array<string|int, mixed>
Return values
string

wrapValue()

Wrap a single string in keyword identifiers.

protected wrapValue(string $value) : string
Parameters
$value : string
Return values
string

Search results