Grammar
abstract class Grammar
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected Connection | $connection | The connection used for escaping values. |
Methods
Mix another object into the class.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Wrap an array of values.
Wrap a table in keyword identifiers.
Wrap a value that has an alias.
Wrap a table that has an alias.
Wrap the given value segments.
Wrap a single string in keyword identifiers.
Wrap the given JSON selector.
Determine if the given string is a JSON selector.
Convert an array of column names into a delimited string.
Create query parameter place-holders for an array.
Get the appropriate query parameter place-holder for a value.
Quote the given string literal.
Escapes a value for safe SQL embedding.
Determine if the given value is a raw expression.
Get the format for database stored dates.
Flush all static state.
Details
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 24
__construct(Connection $connection)
Create a new grammar instance.
at line 35
array
wrapArray(array $values)
Wrap an array of values.
at line 43
string
wrapTable(Expression|string $table, string|null $prefix = null)
Wrap a table in keyword identifiers.
at line 75
string|int|float
wrap(Expression|string $value)
Wrap a value in keyword identifiers.
at line 101
protected string
wrapAliasedValue(string $value)
Wrap a value that has an alias.
at line 111
protected string
wrapAliasedTable(string $value, string|null $prefix = null)
Wrap a table that has an alias.
at line 125
protected string
wrapSegments(array $segments)
Wrap the given value segments.
at line 137
protected string
wrapValue(string $value)
Wrap a single string in keyword identifiers.
at line 151
protected string
wrapJsonSelector(string $value)
Wrap the given JSON selector.
at line 159
protected bool
isJsonSelector(string $value)
Determine if the given string is a JSON selector.
at line 169
string
columnize(array $columns)
Convert an array of column names into a delimited string.
at line 177
string
parameterize(array $values)
Create query parameter place-holders for an array.
at line 185
string|int|float
parameter(mixed $value)
Get the appropriate query parameter place-holder for a value.
at line 195
string
quoteString(string|array $value)
Quote the given string literal.
at line 207
string
escape(string|float|int|bool|null $value, bool $binary = false)
Escapes a value for safe SQL embedding.
at line 215
bool
isExpression(mixed $value)
Determine if the given value is a raw expression.
at line 223
string|int|float
getValue(Expression|string|int|float $expression)
Transforms expressions to their scalar types.
at line 235
string
getDateFormat()
Get the format for database stored dates.
at line 246
static void
flushState()
Flush all static state.