Aplus Framework Docs

Statement extends Statement
in package

Class Statement.

Tags
see
https://mariadb.com/kb/en/data-manipulation/

Table of Contents

$database  : Database
$sql  : array<string|int, mixed>
SQL clauses and parts.
__construct()  : mixed
Statement constructor.
__toString()  : string
options()  : static
Sets the statement options.
reset()  : static
Resets SQL clauses and parts.
run()  : mixed
Runs the SQL statement.
sql()  : string
Renders the SQL statement.
hasOptions()  : bool
Tells if the statement has options set.
renderAliasedIdentifier()  : string
Renders a column part with an optional alias name, AS clause.
renderAssignment()  : string
Renders an assignment part.
renderIdentifier()  : string
Renders a column part.
renderLimit()  : string|null
Renders the LIMIT clause.
renderOptions()  : string|null
renderValue()  : float|int|string
Renders a subquery or quote a value.
setLimit()  : static
Sets the LIMIT clause.
subquery()  : string
Returns an SQL part between parentheses.

Properties

$sql

SQL clauses and parts.

protected array<string|int, mixed> $sql = []

Methods

__construct()

Statement constructor.

public __construct(Database $database) : mixed
Parameters
$database : Database
Return values
mixed

__toString()

public __toString() : string
Return values
string

options()

Sets the statement options.

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

One of the OPT_* constants

$options : string

Each option value must be one of the OPT_* constants

Return values
static

reset()

Resets SQL clauses and parts.

public reset([string|null $sql = null ]) : static
Parameters
$sql : string|null = null

A part name or null to reset all

Tags
see
Statement::$sql
Return values
static

run()

Runs the SQL statement.

public abstract run() : mixed
Return values
mixed

sql()

Renders the SQL statement.

public abstract sql() : string
Return values
string

hasOptions()

Tells if the statement has options set.

protected hasOptions() : bool
Return values
bool

renderAliasedIdentifier()

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

protected renderAliasedIdentifier(Closure|array<string, \Closure|string>|string $column) : string
Parameters
$column : Closure|array<string, \Closure|string>|string

The column name, a subquery or an array where the index is the alias and the value is the column/subquery

Return values
string

renderIdentifier()

Renders a column part.

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

The column name or a subquery

Return values
string

renderLimit()

Renders the LIMIT clause.

protected renderLimit() : string|null
Return values
string|null

renderOptions()

protected abstract renderOptions() : string|null
Return values
string|null

renderValue()

Renders a subquery or quote a value.

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

A Closure for subquery, other types to quote

Return values
float|int|string

setLimit()

Sets the LIMIT clause.

protected setLimit(int $limit[, int|null $offset = null ]) : static
Parameters
$limit : int
$offset : int|null = null
Tags
see
https://mariadb.com/kb/en/limit/
Return values
static

Search results