class Grammar extends Grammar (View source)

Properties

protected string $tablePrefix The grammar table prefix. from Grammar
protected array $selectComponents The components that make up a select clause.

Methods

array
wrapArray(array $values)

Wrap an array of values.

from Grammar
string
wrapTable(string $table)

Wrap a table in keyword identifiers.

from Grammar
string
wrap(string $value)

Wrap a value in keyword identifiers.

from Grammar
string
wrapValue(string $value)

Wrap a single string in keyword identifiers.

from Grammar
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
string
getValue(Expression $expression)

Get the value of a raw expression.

from Grammar
bool
isExpression(mixed $value)

Determine if the given value is 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.

array
compileComponents(Builder $query)

Compile the components necessary for a select clause.

string
compileAggregate(Builder $query, array $aggregate)

Compile an aggregated select clause.

string
compileColumns(Builder $query, array $columns)

Compile the "select *" portion of the query.

string
compileFrom(Builder $query, string $table)

Compile the "from" portion of the query.

string
compileJoins(Builder $query, array $joins)

Compile the "join" portions of the query.

string
compileJoinConstraint(array $clause)

Create a join clause constraint segment.

string
compileWheres(Builder $query)

Compile the "where" portions of the query.

string
whereNested(Builder $query, array $where)

Compile a nested where clause.

string
whereSub(Builder $query, array $where)

Compile a where condition with a sub-select.

string
whereBasic(Builder $query, array $where)

Compile a basic where clause.

string
whereBetween(Builder $query, array $where)

Compile a "between" where clause.

string
whereExists(Builder $query, array $where)

Compile a where exists clause.

string
whereNotExists(Builder $query, array $where)

Compile a where exists clause.

string
whereIn(Builder $query, array $where)

Compile a "where in" clause.

string
whereNotIn(Builder $query, array $where)

Compile a "where not in" clause.

string
whereInSub(Builder $query, array $where)

Compile a where in sub-select clause.

string
whereNotInSub(Builder $query, array $where)

Compile a where not in sub-select clause.

string
whereNull(Builder $query, array $where)

Compile a "where null" clause.

string
whereNotNull(Builder $query, array $where)

Compile a "where not null" clause.

string
whereDate(Builder $query, array $where)

Compile a "where date" clause.

string
whereDay(Builder $query, array $where)

Compile a "where day" clause.

string
whereMonth(Builder $query, array $where)

Compile a "where month" clause.

string
whereYear(Builder $query, array $where)

Compile a "where year" clause.

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

Compile a date based where clause.

string
whereRaw(Builder $query, array $where)

Compile a raw where clause.

string
compileGroups(Builder $query, array $groups)

Compile the "group by" portions of the query.

string
compileHavings(Builder $query, array $havings)

Compile the "having" portions of the query.

string
compileHaving(array $having)

Compile a single having clause.

string
compileBasicHaving(array $having)

Compile a basic having clause.

string
compileOrders(Builder $query, array $orders)

Compile the "order by" portions of the query.

string
compileLimit(Builder $query, int $limit)

Compile the "limit" portions of the query.

string
compileOffset(Builder $query, int $offset)

Compile the "offset" portions of the query.

string
compileUnions(Builder $query)

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

string
compileUnion(array $union)

Compile a single union statement.

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.

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.

string
concatenate(array $segments)

Concatenate an array of segments, removing empties.

string
removeLeadingBoolean(string $value)

Remove the leading boolean from a statement.

Details

array wrapArray(array $values)

Wrap an array of values.

Parameters

array $values

Return Value

array

string wrapTable(string $table)

Wrap a table in keyword identifiers.

Parameters

string $table

Return Value

string

string wrap(string $value)

Wrap a value in keyword identifiers.

Parameters

string $value

Return Value

string

protected string wrapValue(string $value)

Wrap a single string in keyword identifiers.

Parameters

string $value

Return Value

string

string columnize(array $columns)

Convert an array of column names into a delimited string.

Parameters

array $columns

Return Value

string

string parameterize(array $values)

Create query parameter place-holders for an array.

Parameters

array $values

Return Value

string

string parameter(mixed $value)

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

Parameters

mixed $value

Return Value

string

string getValue(Expression $expression)

Get the value of a raw expression.

Parameters

Expression $expression

Return Value

string

bool isExpression(mixed $value)

Determine if the given value is a raw expression.

Parameters

mixed $value

Return Value

bool

string getDateFormat()

Get the format for database stored dates.

Return Value

string

string getTablePrefix()

Get the grammar's table prefix.

Return Value

string

$this setTablePrefix(string $prefix)

Set the grammar's table prefix.

Parameters

string $prefix

Return Value

$this

string compileSelect(Builder $query)

Compile a select query into SQL.

Parameters

Builder $query

Return Value

string

protected array compileComponents(Builder $query)

Compile the components necessary for a select clause.

Parameters

Builder $query

Return Value

array

protected string compileAggregate(Builder $query, array $aggregate)

Compile an aggregated select clause.

Parameters

Builder $query
array $aggregate

Return Value

string

protected string compileColumns(Builder $query, array $columns)

Compile the "select *" portion of the query.

Parameters

Builder $query
array $columns

Return Value

string

protected string compileFrom(Builder $query, string $table)

Compile the "from" portion of the query.

Parameters

Builder $query
string $table

Return Value

string

protected string compileJoins(Builder $query, array $joins)

Compile the "join" portions of the query.

Parameters

Builder $query
array $joins

Return Value

string

protected string compileJoinConstraint(array $clause)

Create a join clause constraint segment.

Parameters

array $clause

Return Value

string

protected string compileWheres(Builder $query)

Compile the "where" portions of the query.

Parameters

Builder $query

Return Value

string

protected string whereNested(Builder $query, array $where)

Compile a nested where clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereSub(Builder $query, array $where)

Compile a where condition with a sub-select.

Parameters

Builder $query
array $where

Return Value

string

protected string whereBasic(Builder $query, array $where)

Compile a basic where clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereBetween(Builder $query, array $where)

Compile a "between" where clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereExists(Builder $query, array $where)

Compile a where exists clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereNotExists(Builder $query, array $where)

Compile a where exists clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereIn(Builder $query, array $where)

Compile a "where in" clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereNotIn(Builder $query, array $where)

Compile a "where not in" clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereInSub(Builder $query, array $where)

Compile a where in sub-select clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereNotInSub(Builder $query, array $where)

Compile a where not in sub-select clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereNull(Builder $query, array $where)

Compile a "where null" clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereNotNull(Builder $query, array $where)

Compile a "where not null" clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereDate(Builder $query, array $where)

Compile a "where date" clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereDay(Builder $query, array $where)

Compile a "where day" clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereMonth(Builder $query, array $where)

Compile a "where month" clause.

Parameters

Builder $query
array $where

Return Value

string

protected string whereYear(Builder $query, array $where)

Compile a "where year" clause.

Parameters

Builder $query
array $where

Return Value

string

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

protected string whereRaw(Builder $query, array $where)

Compile a raw where clause.

Parameters

Builder $query
array $where

Return Value

string

protected string compileGroups(Builder $query, array $groups)

Compile the "group by" portions of the query.

Parameters

Builder $query
array $groups

Return Value

string

protected string compileHavings(Builder $query, array $havings)

Compile the "having" portions of the query.

Parameters

Builder $query
array $havings

Return Value

string

protected string compileHaving(array $having)

Compile a single having clause.

Parameters

array $having

Return Value

string

protected string compileBasicHaving(array $having)

Compile a basic having clause.

Parameters

array $having

Return Value

string

protected string compileOrders(Builder $query, array $orders)

Compile the "order by" portions of the query.

Parameters

Builder $query
array $orders

Return Value

string

protected string compileLimit(Builder $query, int $limit)

Compile the "limit" portions of the query.

Parameters

Builder $query
int $limit

Return Value

string

protected string compileOffset(Builder $query, int $offset)

Compile the "offset" portions of the query.

Parameters

Builder $query
int $offset

Return Value

string

protected string compileUnions(Builder $query)

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

Parameters

Builder $query

Return Value

string

protected string compileUnion(array $union)

Compile a single union statement.

Parameters

array $union

Return Value

string

string compileInsert(Builder $query, array $values)

Compile an insert statement into SQL.

Parameters

Builder $query
array $values

Return Value

string

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

string compileUpdate(Builder $query, array $values)

Compile an update statement into SQL.

Parameters

Builder $query
array $values

Return Value

string

string compileDelete(Builder $query)

Compile a delete statement into SQL.

Parameters

Builder $query

Return Value

string

array compileTruncate(Builder $query)

Compile a truncate table statement into SQL.

Parameters

Builder $query

Return Value

array

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

Compile the lock into SQL.

Parameters

Builder $query
bool|string $value

Return Value

string

protected string concatenate(array $segments)

Concatenate an array of segments, removing empties.

Parameters

array $segments

Return Value

string

protected string removeLeadingBoolean(string $value)

Remove the leading boolean from a statement.

Parameters

string $value

Return Value

string