class PostgresGrammar extends Grammar

Properties

protected string $tablePrefix

The grammar table prefix.

from  Grammar
protected array $operators

All of the available clause operators.

protected array $selectComponents

The components that make up a select clause.

from  Grammar

Methods

array
wrapArray(array $values)

Wrap an array of values.

from  Grammar
string
wrapTable(Expression|string $table)

Wrap a table in keyword identifiers.

from  Grammar
string
wrap(Expression|string $value, bool $prefixAlias = false)

Wrap a value in keyword identifiers.

from  Grammar
string
wrapAliasedValue(string $value, bool $prefixAlias = false)

Wrap a value that has an alias.

from  Grammar
string
wrapSegments(array $segments)

Wrap the given value segments.

from  Grammar
string
wrapValue(string $value)

Wrap a single string in keyword identifiers.

string
columnize(array $columns)

Convert an array of column names into a delimited string.

from  Grammar
string
parameterize(array $values)

Create query parameter place-holders for an array.

from  Grammar
string
parameter(mixed $value)

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

from  Grammar
bool
isExpression(mixed $value)

Determine if the given value is a raw expression.

from  Grammar
string
getValue(Expression $expression)

Get the value of a raw expression.

from  Grammar
string
getDateFormat()

Get the format for database stored dates.

from  Grammar
string
getTablePrefix()

Get the grammar's table prefix.

from  Grammar
$this
setTablePrefix(string $prefix)

Set the grammar's table prefix.

from  Grammar
string
compileSelect(Builder $query)

Compile a select query into SQL.

from  Grammar
array
compileComponents(Builder $query)

Compile the components necessary for a select clause.

from  Grammar
string
compileAggregate(Builder $query, array $aggregate)

Compile an aggregated select clause.

from  Grammar
string|null
compileColumns(Builder $query, array $columns)

Compile the "select *" portion of the query.

from  Grammar
string
compileFrom(Builder $query, string $table)

Compile the "from" portion of the query.

from  Grammar
string
compileJoins(Builder $query, array $joins)

Compile the "join" portions of the query.

from  Grammar
string
compileWheres(Builder $query)

Compile the "where" portions of the query.

from  Grammar
array
compileWheresToArray(Builder $query)

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

from  Grammar
string
concatenateWhereClauses(Builder $query, array $sql)

Format the where clause statements into one string.

from  Grammar
string
whereRaw(Builder $query, array $where)

Compile a raw where clause.

from  Grammar
string
whereBasic(Builder $query, array $where)

Compile a basic where clause.

from  Grammar
string
whereIn(Builder $query, array $where)

Compile a "where in" clause.

from  Grammar
string
whereNotIn(Builder $query, array $where)

Compile a "where not in" clause.

from  Grammar
string
whereInSub(Builder $query, array $where)

Compile a where in sub-select clause.

from  Grammar
string
whereNotInSub(Builder $query, array $where)

Compile a where not in sub-select clause.

from  Grammar
string
whereNull(Builder $query, array $where)

Compile a "where null" clause.

from  Grammar
string
whereNotNull(Builder $query, array $where)

Compile a "where not null" clause.

from  Grammar
string
whereBetween(Builder $query, array $where)

Compile a "between" where clause.

from  Grammar
string
whereDate(Builder $query, array $where)

Compile a "where date" clause.

string
whereTime(Builder $query, array $where)

Compile a "where time" clause.

from  Grammar
string
whereDay(Builder $query, array $where)

Compile a "where day" clause.

from  Grammar
string
whereMonth(Builder $query, array $where)

Compile a "where month" clause.

from  Grammar
string
whereYear(Builder $query, array $where)

Compile a "where year" clause.

from  Grammar
string
dateBasedWhere(string $type, Builder $query, array $where)

Compile a date based where clause.

string
whereColumn(Builder $query, array $where)

Compile a where clause comparing two columns.

from  Grammar
string
whereNested(Builder $query, array $where)

Compile a nested where clause.

from  Grammar
string
whereSub(Builder $query, array $where)

Compile a where condition with a sub-select.

from  Grammar
string
whereExists(Builder $query, array $where)

Compile a where exists clause.

from  Grammar
string
whereNotExists(Builder $query, array $where)

Compile a where exists clause.

from  Grammar
string
compileGroups(Builder $query, array $groups)

Compile the "group by" portions of the query.

from  Grammar
string
compileHavings(Builder $query, array $havings)

Compile the "having" portions of the query.

from  Grammar
string
compileHaving(array $having)

Compile a single having clause.

from  Grammar
string
compileBasicHaving(array $having)

Compile a basic having clause.

from  Grammar
string
compileOrders(Builder $query, array $orders)

Compile the "order by" portions of the query.

from  Grammar
array
compileOrdersToArray(Builder $query, array $orders)

Compile the query orders to an array.

from  Grammar
string
compileRandom(string $seed)

Compile the random statement into SQL.

from  Grammar
string
compileLimit(Builder $query, int $limit)

Compile the "limit" portions of the query.

from  Grammar
string
compileOffset(Builder $query, int $offset)

Compile the "offset" portions of the query.

from  Grammar
string
compileUnions(Builder $query)

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

from  Grammar
string
compileUnion(array $union)

Compile a single union statement.

from  Grammar
string
compileExists(Builder $query)

Compile an exists statement into SQL.

from  Grammar
string
compileInsert(Builder $query, array $values)

Compile an insert statement into SQL.

string
compileInsertGetId(Builder $query, array $values, string $sequence)

Compile an insert and get ID statement into SQL.

string
compileUpdate(Builder $query, array $values)

Compile an update statement into SQL.

array
prepareBindingsForUpdate(array $bindings, array $values)

Prepare the bindings for an update statement.

string
compileDelete(Builder $query)

Compile a delete statement into SQL.

array
compileTruncate(Builder $query)

Compile a truncate table statement into SQL.

string
compileLock(Builder $query, bool|string $value)

Compile the lock into SQL.

bool
supportsSavepoints()

Determine if the grammar supports savepoints.

from  Grammar
string
compileSavepoint(string $name)

Compile the SQL statement to define a savepoint.

from  Grammar
string
compileSavepointRollBack(string $name)

Compile the SQL statement to execute a savepoint rollback.

from  Grammar
string
concatenate(array $segments)

Concatenate an array of segments, removing empties.

from  Grammar
string
removeLeadingBoolean(string $value)

Remove the leading boolean from a statement.

from  Grammar
array
getOperators()

Get the grammar specific operators.

from  Grammar
string
compileUpdateColumns(array $values)

Compile the columns for the update statement.

string|null
compileUpdateFrom(Builder $query)

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

string
compileUpdateWheres(Builder $query)

Compile the additional where clauses for updates with joins.

string
compileUpdateJoinWheres(Builder $query)

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

string
compileDeleteWithJoins(Builder $query, string $table)

Compile a delete query that uses joins.

string
wrapJsonSelector(string $value)

Wrap the given JSON selector.

array
wrapJsonPathAttributes(array $path)

Wrap the attributes of the give JSON path.

Details

in Grammar at line 22
array wrapArray(array $values)

Wrap an array of values.

Parameters

array $values

Return Value

array

in Grammar at line 33
string wrapTable(Expression|string $table)

Wrap a table in keyword identifiers.

Parameters

Expression|string $table

Return Value

string

in Grammar at line 49
string wrap(Expression|string $value, bool $prefixAlias = false)

Wrap a value in keyword identifiers.

Parameters

Expression|string $value
bool $prefixAlias

Return Value

string

in Grammar at line 72
protected string wrapAliasedValue(string $value, bool $prefixAlias = false)

Wrap a value that has an alias.

Parameters

string $value
bool $prefixAlias

Return Value

string

in Grammar at line 94
protected string wrapSegments(array $segments)

Wrap the given value segments.

Parameters

array $segments

Return Value

string

at line 280
protected string wrapValue(string $value)

Wrap a single string in keyword identifiers.

Parameters

string $value

Return Value

string

in Grammar at line 124
string columnize(array $columns)

Convert an array of column names into a delimited string.

Parameters

array $columns

Return Value

string

in Grammar at line 135
string parameterize(array $values)

Create query parameter place-holders for an array.

Parameters

array $values

Return Value

string

in Grammar at line 146
string parameter(mixed $value)

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

Parameters

mixed $value

Return Value

string

in Grammar at line 157
bool isExpression(mixed $value)

Determine if the given value is a raw expression.

Parameters

mixed $value

Return Value

bool

in Grammar at line 168
string getValue(Expression $expression)

Get the value of a raw expression.

Parameters

Expression $expression

Return Value

string

in Grammar at line 178
string getDateFormat()

Get the format for database stored dates.

Return Value

string

in Grammar at line 188
string getTablePrefix()

Get the grammar's table prefix.

Return Value

string

in Grammar at line 199
$this setTablePrefix(string $prefix)

Set the grammar's table prefix.

Parameters

string $prefix

Return Value

$this

in Grammar at line 45
string compileSelect(Builder $query)

Compile a select query into SQL.

Parameters

Builder $query

Return Value

string

in Grammar at line 74
protected array compileComponents(Builder $query)

Compile the components necessary for a select clause.

Parameters

Builder $query

Return Value

array

in Grammar at line 99
protected string compileAggregate(Builder $query, array $aggregate)

Compile an aggregated select clause.

Parameters

Builder $query
array $aggregate

Return Value

string

in Grammar at line 120
protected string|null compileColumns(Builder $query, array $columns)

Compile the "select *" portion of the query.

Parameters

Builder $query
array $columns

Return Value

string|null

in Grammar at line 141
protected string compileFrom(Builder $query, string $table)

Compile the "from" portion of the query.

Parameters

Builder $query
string $table

Return Value

string

in Grammar at line 153
protected string compileJoins(Builder $query, array $joins)

Compile the "join" portions of the query.

Parameters

Builder $query
array $joins

Return Value

string

in Grammar at line 168
protected string compileWheres(Builder $query)

Compile the "where" portions of the query.

Parameters

Builder $query

Return Value

string

in Grammar at line 193
protected array compileWheresToArray(Builder $query)

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

Parameters

Builder $query

Return Value

array

in Grammar at line 207
protected string concatenateWhereClauses(Builder $query, array $sql)

Format the where clause statements into one string.

Parameters

Builder $query
array $sql

Return Value

string

in Grammar at line 221
protected string whereRaw(Builder $query, array $where)

Compile a raw where clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 233
protected string whereBasic(Builder $query, array $where)

Compile a basic where clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 247
protected string whereIn(Builder $query, array $where)

Compile a "where in" clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 263
protected string whereNotIn(Builder $query, array $where)

Compile a "where not in" clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 279
protected string whereInSub(Builder $query, array $where)

Compile a where in sub-select clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 291
protected string whereNotInSub(Builder $query, array $where)

Compile a where not in sub-select clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 303
protected string whereNull(Builder $query, array $where)

Compile a "where null" clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 315
protected string whereNotNull(Builder $query, array $where)

Compile a "where not null" clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 327
protected string whereBetween(Builder $query, array $where)

Compile a "between" where clause.

Parameters

Builder $query
array $where

Return Value

string

at line 30
protected string whereDate(Builder $query, array $where)

Compile a "where date" clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 353
protected string whereTime(Builder $query, array $where)

Compile a "where time" clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 365
protected string whereDay(Builder $query, array $where)

Compile a "where day" clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 377
protected string whereMonth(Builder $query, array $where)

Compile a "where month" clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 389
protected string whereYear(Builder $query, array $where)

Compile a "where year" clause.

Parameters

Builder $query
array $where

Return Value

string

at line 45
protected string dateBasedWhere(string $type, Builder $query, array $where)

Compile a date based where clause.

Parameters

string $type
Builder $query
array $where

Return Value

string

in Grammar at line 416
protected string whereColumn(Builder $query, array $where)

Compile a where clause comparing two columns.

.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 428
protected string whereNested(Builder $query, array $where)

Compile a nested where clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 445
protected string whereSub(Builder $query, array $where)

Compile a where condition with a sub-select.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 459
protected string whereExists(Builder $query, array $where)

Compile a where exists clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 471
protected string whereNotExists(Builder $query, array $where)

Compile a where exists clause.

Parameters

Builder $query
array $where

Return Value

string

in Grammar at line 483
protected string compileGroups(Builder $query, array $groups)

Compile the "group by" portions of the query.

Parameters

Builder $query
array $groups

Return Value

string

in Grammar at line 495
protected string compileHavings(Builder $query, array $havings)

Compile the "having" portions of the query.

Parameters

Builder $query
array $havings

Return Value

string

in Grammar at line 508
protected string compileHaving(array $having)

Compile a single having clause.

Parameters

array $having

Return Value

string

in Grammar at line 526
protected string compileBasicHaving(array $having)

Compile a basic having clause.

Parameters

array $having

Return Value

string

in Grammar at line 542
protected string compileOrders(Builder $query, array $orders)

Compile the "order by" portions of the query.

Parameters

Builder $query
array $orders

Return Value

string

in Grammar at line 558
protected array compileOrdersToArray(Builder $query, array $orders)

Compile the query orders to an array.

Parameters

Builder $query
array $orders

Return Value

array

in Grammar at line 573
string compileRandom(string $seed)

Compile the random statement into SQL.

Parameters

string $seed

Return Value

string

in Grammar at line 585
protected string compileLimit(Builder $query, int $limit)

Compile the "limit" portions of the query.

Parameters

Builder $query
int $limit

Return Value

string

in Grammar at line 597
protected string compileOffset(Builder $query, int $offset)

Compile the "offset" portions of the query.

Parameters

Builder $query
int $offset

Return Value

string

in Grammar at line 608
protected string compileUnions(Builder $query)

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

Parameters

Builder $query

Return Value

string

in Grammar at line 637
protected string compileUnion(array $union)

Compile a single union statement.

Parameters

array $union

Return Value

string

in Grammar at line 650
string compileExists(Builder $query)

Compile an exists statement into SQL.

Parameters

Builder $query

Return Value

string

at line 71
string compileInsert(Builder $query, array $values)

Compile an insert statement into SQL.

Parameters

Builder $query
array $values

Return Value

string

at line 88
string compileInsertGetId(Builder $query, array $values, string $sequence)

Compile an insert and get ID statement into SQL.

Parameters

Builder $query
array $values
string $sequence

Return Value

string

at line 104
string compileUpdate(Builder $query, array $values)

Compile an update statement into SQL.

Parameters

Builder $query
array $values

Return Value

string

at line 217
array prepareBindingsForUpdate(array $bindings, array $values)

Prepare the bindings for an update statement.

Parameters

array $bindings
array $values

Return Value

array

at line 235
string compileDelete(Builder $query)

Compile a delete statement into SQL.

Parameters

Builder $query

Return Value

string

at line 269
array compileTruncate(Builder $query)

Compile a truncate table statement into SQL.

Parameters

Builder $query

Return Value

array

at line 59
protected string compileLock(Builder $query, bool|string $value)

Compile the lock into SQL.

Parameters

Builder $query
bool|string $value

Return Value

string

in Grammar at line 792
bool supportsSavepoints()

Determine if the grammar supports savepoints.

Return Value

bool

in Grammar at line 803
string compileSavepoint(string $name)

Compile the SQL statement to define a savepoint.

Parameters

string $name

Return Value

string

in Grammar at line 814
string compileSavepointRollBack(string $name)

Compile the SQL statement to execute a savepoint rollback.

Parameters

string $name

Return Value

string

in Grammar at line 825
protected string concatenate(array $segments)

Concatenate an array of segments, removing empties.

Parameters

array $segments

Return Value

string

in Grammar at line 838
protected string removeLeadingBoolean(string $value)

Remove the leading boolean from a statement.

Parameters

string $value

Return Value

string

in Grammar at line 848
array getOperators()

Get the grammar specific operators.

Return Value

array

at line 126
protected string compileUpdateColumns(array $values)

Compile the columns for the update statement.

Parameters

array $values

Return Value

string

at line 142
protected string|null compileUpdateFrom(Builder $query)

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

Parameters

Builder $query

Return Value

string|null

at line 166
protected string compileUpdateWheres(Builder $query)

Compile the additional where clauses for updates with joins.

Parameters

Builder $query

Return Value

string

at line 192
protected string compileUpdateJoinWheres(Builder $query)

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

Parameters

Builder $query

Return Value

string

at line 252
protected string compileDeleteWithJoins(Builder $query, string $table)

Compile a delete query that uses joins.

Parameters

Builder $query
string $table

Return Value

string

at line 302
protected string wrapJsonSelector(string $value)

Wrap the given JSON selector.

Parameters

string $value

Return Value

string

at line 325
protected array wrapJsonPathAttributes(array $path)

Wrap the attributes of the give JSON path.

Parameters

array $path

Return Value

array