WindowExpression
in package
implements
ExpressionInterface, WindowInterface
This represents a SQL window expression used by aggregate and window functions.
Table of Contents
Interfaces
- ExpressionInterface
- An interface used by Expression objects.
- WindowInterface
- This defines the functions used for building window expressions.
Properties
- $exclusion : string|null
- $frame : array<string|int, mixed>|null
- $name : IdentifierExpression
- $order : OrderByExpression|null
- $partitions : array<string|int, ExpressionInterface>
Methods
- __clone() : void
- Clone this object and its subtree of expressions.
- __construct() : mixed
- excludeCurrent() : $this
- Adds current row frame exclusion.
- excludeGroup() : $this
- Adds group frame exclusion.
- excludeTies() : $this
- Adds ties frame exclusion.
- frame() : $this
- Adds a frame to the window.
- groups() : $this
- Adds a simple groups frame to the window.
- isNamedOnly() : bool
- Return whether is only a named window expression.
- name() : $this
- Sets the window name.
- order() : $this
- Adds one or more order clauses to the window.
- partition() : $this
- Adds one or more partition expressions to the window.
- range() : $this
- Adds a simple range frame to the window.
- rows() : $this
- Adds a simple rows frame to the window.
- sql() : string
- Converts the Node into a SQL string fragment.
- traverse() : $this
- Iterates over each part of the expression recursively for every level of the expressions tree and executes the $callback callable passing as first parameter the instance of the expression currently being iterated.
- buildOffsetSql() : string
- Builds frame offset sql.
Properties
$exclusion
protected
string|null
$exclusion
$frame
protected
array<string|int, mixed>|null
$frame
$name
protected
IdentifierExpression
$name
$order
protected
OrderByExpression|null
$order
$partitions
protected
array<string|int, ExpressionInterface>
$partitions
= []
Methods
__clone()
Clone this object and its subtree of expressions.
public
__clone() : void
__construct()
public
__construct([string $name = '' ]) : mixed
Parameters
- $name : string = ''
-
Window name
excludeCurrent()
Adds current row frame exclusion.
public
excludeCurrent() : $this
Tags
Return values
$thisexcludeGroup()
Adds group frame exclusion.
public
excludeGroup() : $this
Tags
Return values
$thisexcludeTies()
Adds ties frame exclusion.
public
excludeTies() : $this
Tags
Return values
$thisframe()
Adds a frame to the window.
public
frame(string $type, mixed $startOffset, string $startDirection, mixed $endOffset, string $endDirection) : $this
Parameters
- $type : string
-
Frame type
- $startOffset : mixed
-
Frame start offset
- $startDirection : string
-
Frame start direction
- $endOffset : mixed
-
Frame end offset
- $endDirection : string
-
Frame end direction
Tags
Return values
$thisgroups()
Adds a simple groups frame to the window.
public
groups(int|null $start[, int|null $end = 0 ]) : $this
Parameters
- $start : int|null
-
Frame start
- $end : int|null = 0
-
Frame end If not passed in, only frame start SQL will be generated.
Tags
Return values
$thisisNamedOnly()
Return whether is only a named window expression.
public
isNamedOnly() : bool
These window expressions only specify a named window and do not specify their own partitions, frame or order.
Return values
boolname()
Sets the window name.
public
name(string $name) : $this
Parameters
- $name : string
-
Window name
Return values
$thisorder()
Adds one or more order clauses to the window.
public
order(mixed $fields) : $this
Parameters
- $fields : mixed
-
Order expressions
Tags
Return values
$thispartition()
Adds one or more partition expressions to the window.
public
partition(mixed $partitions) : $this
Parameters
- $partitions : mixed
-
Partition expressions
Tags
Return values
$thisrange()
Adds a simple range frame to the window.
public
range(mixed $start[, mixed $end = 0 ]) : $this
Parameters
- $start : mixed
-
Frame start
- $end : mixed = 0
-
Frame end If not passed in, only frame start SQL will be generated.
Tags
Return values
$thisrows()
Adds a simple rows frame to the window.
public
rows(int|null $start[, int|null $end = 0 ]) : $this
Parameters
- $start : int|null
-
Frame start
- $end : int|null = 0
-
Frame end If not passed in, only frame start SQL will be generated.
Tags
Return values
$thissql()
Converts the Node into a SQL string fragment.
public
sql(ValueBinder $binder) : string
Parameters
- $binder : ValueBinder
-
Parameter binder
Tags
Return values
stringtraverse()
Iterates over each part of the expression recursively for every level of the expressions tree and executes the $callback callable passing as first parameter the instance of the expression currently being iterated.
public
traverse(Closure $callback) : $this
Parameters
- $callback : Closure
-
The callable to apply to all nodes.
Tags
Return values
$thisbuildOffsetSql()
Builds frame offset sql.
protected
buildOffsetSql(ValueBinder $binder, ExpressionInterface|string|int|null $offset, string $direction) : string
Parameters
- $binder : ValueBinder
-
Value binder
- $offset : ExpressionInterface|string|int|null
-
Frame offset
- $direction : string
-
Frame offset direction