Statement class abstract

Framework\Database\Manipulation\Statement

Class Statement.

Extends Framework\Database\Statement

Implements: Stringable

Defined in libraries/database/src/Manipulation/Statement.php

Methods #

options()
Sets the statement options.
hasOptions()
Tells if the statement has options set.
renderAliasedIdentifier()
Renders a column part with an optional alias name, AS clause.
renderAssignment()
Renders an assignment part.
renderIdentifier()
Renders a column part.
renderLimit()
Renders the LIMIT clause.
renderOptions()
-
renderValue()
Renders a subquery or quote a value.
setLimit()
Sets the LIMIT clause.
subquery()
Returns an SQL part between parentheses.

options()

public function options(string $option, string ...$options): static

Sets the statement options.

Parameters
  • string $option - One of the OPT_* constants
  • string $options
Returns static

hasOptions()

protected function hasOptions(): bool

Tells if the statement has options set.

Returns bool

renderAliasedIdentifier()

protected function renderAliasedIdentifier(Closure|array|string $column): string

Renders a column part with an optional alias name, AS clause.

Parameters
  • Closure|array|string $column - The column name, a subquery or an array where the index is the alias and the value is the column/subquery
Returns string

renderAssignment()

protected function renderAssignment(string $identifier, Closure|string|int|float|null $expression): string

Renders an assignment part.

Parameters
  • string $identifier - Identifier/column name
  • Closure|string|int|float|null $expression - Expression/value
Returns string

renderIdentifier()

protected function renderIdentifier(Closure|string $column): string

Renders a column part.

Parameters
  • Closure|string $column - The column name or a subquery
Returns string

renderLimit()

protected function renderLimit(): ?string

Renders the LIMIT clause.

Returns ?string

renderOptions()

protected abstract function renderOptions(): ?string
Returns ?string

renderValue()

protected function renderValue(Closure|string|int|float|null $value): string|int|float

Renders a subquery or quote a value.

Parameters
  • Closure|string|int|float|null $value - A {@see Closure} for subquery, other types to quote
Returns string|int|float

setLimit()

protected function setLimit(int $limit, ?int $offset = NULL): static

Sets the LIMIT clause.

Parameters
  • int $limit
  • ?int $offset
Returns static

subquery()

protected function subquery(Closure $subquery): string

Returns an SQL part between parentheses.

Parameters
  • Closure $subquery - A {@see Closure} having the current Manipulation instance as first argument. The returned value must be scalar
Returns string

Inherited methods #