Table
extends Node
in package
Represents the Table of the DB
Table of Contents
Properties
- $alias : mixed
- $name : mixed
- $precedence : mixed
- $type : Type|null
Methods
- __construct() : mixed
- Consruct a Table
- accept() : mixed
- Visit the current Node
- addColumn() : AlterStatement
- Add a column to the table
- alias() : Table
- construct a copy of the table and alias it
- as() : AliasOperator
- Construct an alias for the current node
- asc() : AscOperator
- Construct an ascending order for the current node
- bulkInsert() : InsertStatement
- Construct an InsertStatement for this table
- caseWhen() : WhenNode
- Construct a CASE WHEN expression (without value)
- cast() : Cast
- Cast the current node to a given type
- coalesce() : mixed
- comment() : CommentStatement
- Add a comment to the table
- commentColumn() : CommentStatement
- Add a comment to a column
- create() : CreateStatement
- Construct a CreateStatement for this table
- desc() : DescOperator
- Construct a descending order for the current node
- drop() : DropStatement
- Construct a DropStatement for this table
- dropColumn() : AlterStatement
- Construct a drop column statement
- eq() : EqualityOperator|IsNullOperator
- Construct a '=' boolean expression
- false() : EqualityOperator|IsNullOperator
- Construct a Node corresponding to a non tautology
- firstValue() : mixed
- Construct a FIRST_VALUE function from the current node
- get() : Column
- Construct a Column node
- getAlias() : mixed
- Getter for the table alias
- getName() : mixed
- Getter for the table name
- getPrecedence() : int
- getType() : Type|null
- Get the type of the Node
- grouping() : Grouping
- Construct a Grouping node
- in() : InOperator|NotInOperator
- Construct a 'IN' boolean expression
- json() : mixed
- lastValue() : mixed
- Construct a LAST_VALUE function from the current node
- modifyColumn() : AlterStatement
- Modify a column type
- neq() : NotEqualityOperator|IsNotNullOperator
- Construct a '!=' boolean expression
- nodeArray() : array<string|int, mixed>
- transform any object into a array of Node
- notIn() : NotInOperator|InOperator
- Construct a 'NOT IN' boolean expression
- of() : Literal|Node
- Transform any object into a Node (does nothing on a Node)
- query() : SelectStatement
- Construct a SelectStatement from this table
- rename() : AlterStatement
- Rename the table
- renameColumn() : AlterStatement
- Rename a column
- repeat() : Repeat
- Repeat the current node $times times
- setType() : void
- Set the type of the Node
- standardizeArray() : array<string|int, mixed>
- Transform any object into a array
- table() : Table
- Construct a Table node
- toDeleteStatement() : DeleteStatement
- Construct an DeleteStatement for this table
- toSql() : mixed
- transform the node into a SQL query string
- toUpdateStatement() : UpdateStatement
- Construct an UpdateStatement for this table
- true() : EqualityOperator|IsNullOperator
- Construct a Node corresponding to a tautology
- truncate() : TruncateStatement
- Construct a TruncateStatement for this table
- tuple() : ExpressionList
- Construct a Tuple node
- typed() : Node
- Set the type of the Node and return the Node
- when() : WhenNode
- Construct a CASE expression from the current node and define the first WHEN clause with a given condition
Properties
$alias
private
mixed
$alias
$name
private
mixed
$name
$precedence
private
static mixed
$precedence
= [[\PhpParser\Node\Expr\Cast::class, \FND\QueryBuilder\Nodes\FunctionCall::class, \FND\QueryBuilder\Nodes\Literal::class], [\FND\QueryBuilder\Nodes\ExpressionList::class], [\FND\QueryBuilder\Nodes\Column::class], [\FND\QueryBuilder\Nodes\BinaryOperators\MulOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\DivOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\AddOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\SubOperator::class], [\FND\QueryBuilder\Nodes\UnaryOperators\IsNullOperator::class, \FND\QueryBuilder\Nodes\UnaryOperators\IsNotNullOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\InOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\NotInOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\MatchOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\LesserOrEqualOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\LesserThanOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\GreaterOrEqualOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\GreaterThanOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\EqualityOperator::class, \FND\QueryBuilder\Nodes\BinaryOperators\NotEqualityOperator::class], [\FND\QueryBuilder\Nodes\NotOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\AndOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\OrOperator::class], [\FND\QueryBuilder\Nodes\BinaryOperators\AliasOperator::class]]
$type
private
Type|null
$type
= null
Methods
__construct()
Consruct a Table
public
__construct(mixed $name[, mixed $alias = null ]) : mixed
Parameters
- $name : mixed
-
the table name
- $alias : mixed = null
-
the table alias (can be null)
accept()
Visit the current Node
public
accept(mixed $visitor) : mixed
Parameters
- $visitor : mixed
-
a visitor
Return values
mixed —the result string of the visit
addColumn()
Add a column to the table
public
addColumn(Column $column) : AlterStatement
Parameters
- $column : Column
-
the column to add
Return values
AlterStatement —the new ALTER query
alias()
construct a copy of the table and alias it
public
alias(mixed $alias) : Table
Parameters
- $alias : mixed
-
the alias
Return values
Table —the new Table
as()
Construct an alias for the current node
public
as(mixed $alias) : AliasOperator
Parameters
- $alias : mixed
-
the alias
Return values
AliasOperator —the alias node
asc()
Construct an ascending order for the current node
public
asc() : AscOperator
Return values
AscOperator —the ascending order node
bulkInsert()
Construct an InsertStatement for this table
public
bulkInsert(mixed $columns, mixed $values) : InsertStatement
Parameters
- $columns : mixed
-
the column list
- $values : mixed
-
a list of list containing the values to insert
Return values
InsertStatementcaseWhen()
Construct a CASE WHEN expression (without value)
public
static caseWhen(mixed $condition) : WhenNode
Parameters
- $condition : mixed
-
the first WHEN clause condition
Return values
WhenNode —the CASE WHEN expression
cast()
Cast the current node to a given type
public
cast(Type $type) : Cast
Parameters
- $type : Type
-
the type to cast to
Return values
Cast —the cast node
coalesce()
public
coalesce(mixed $args) : mixed
Parameters
- $args : mixed
comment()
Add a comment to the table
public
comment(string $comment) : CommentStatement
Parameters
- $comment : string
-
the comment
Return values
CommentStatement —the new ALTER query
commentColumn()
Add a comment to a column
public
commentColumn(mixed $column, string $comment) : CommentStatement
Parameters
- $column : mixed
-
the column to comment
- $comment : string
-
the comment
Return values
CommentStatement —the new ALTER query
create()
Construct a CreateStatement for this table
public
create(mixed $columns[, mixed $check = false ]) : CreateStatement
Parameters
- $columns : mixed
-
the column list
- $check : mixed = false
-
the check value
Return values
CreateStatementdesc()
Construct a descending order for the current node
public
desc() : DescOperator
Return values
DescOperator —the descending order node
drop()
Construct a DropStatement for this table
public
drop([mixed $check = false ]) : DropStatement
Parameters
- $check : mixed = false
-
the check value
Return values
DropStatementdropColumn()
Construct a drop column statement
public
dropColumn(Column|string $column) : AlterStatement
Parameters
- $column : Column|string
-
the column to drop
Return values
AlterStatement —the new ALTER query
eq()
Construct a '=' boolean expression
public
eq(mixed $other) : EqualityOperator|IsNullOperator
Parameters
- $other : mixed
-
the other operand
Return values
EqualityOperator|IsNullOperator —the equality node
false()
Construct a Node corresponding to a non tautology
public
static false() : EqualityOperator|IsNullOperator
Return values
EqualityOperator|IsNullOperatorfirstValue()
Construct a FIRST_VALUE function from the current node
public
firstValue([mixed $groups = [] ][, mixed $orders = [] ][, mixed $rows = [] ][, mixed $nullsDirective = 0 ]) : mixed
Parameters
- $groups : mixed = []
-
values to partitioned by (for window functions)
- $orders : mixed = []
-
values to order with (for window functions)
- $rows : mixed = []
-
values to bound with (for window functions)
- $nullsDirective : mixed = 0
get()
Construct a Column node
public
get(string $column_name) : Column
Parameters
- $column_name : string
-
the column name ("*" is handled)
Return values
Column —the Column
getAlias()
Getter for the table alias
public
getAlias() : mixed
Return values
mixed —the table alias
getName()
Getter for the table name
public
getName() : mixed
Return values
mixed —the table name
getPrecedence()
public
getPrecedence() : int
Return values
intgetType()
Get the type of the Node
public
getType() : Type|null
Return values
Type|null —the type
grouping()
Construct a Grouping node
public
static grouping(mixed $node) : Grouping
Parameters
- $node : mixed
-
a node
Return values
Grouping —the new Grouping node
in()
Construct a 'IN' boolean expression
public
in([mixed $others = NULL ]) : InOperator|NotInOperator
Parameters
- $others : mixed = NULL
-
the other operands
Return values
InOperator|NotInOperatorjson()
public
json() : mixed
lastValue()
Construct a LAST_VALUE function from the current node
public
lastValue([mixed $groups = [] ][, mixed $orders = [] ][, mixed $rows = [] ][, mixed $nullsDirective = 0 ]) : mixed
Parameters
- $groups : mixed = []
-
values to partitioned by (for window functions)
- $orders : mixed = []
-
values to order with (for window functions)
- $rows : mixed = []
-
values to bound with (for window functions)
- $nullsDirective : mixed = 0
modifyColumn()
Modify a column type
public
modifyColumn(mixed $column) : AlterStatement
Parameters
- $column : mixed
-
the column to modify
Return values
AlterStatement —the new ALTER query
neq()
Construct a '!=' boolean expression
public
neq(mixed $other) : NotEqualityOperator|IsNotNullOperator
Parameters
- $other : mixed
-
the other operand
Return values
NotEqualityOperator|IsNotNullOperatornodeArray()
transform any object into a array of Node
public
static nodeArray(mixed $args) : array<string|int, mixed>
Parameters
- $args : mixed
-
any object
Return values
array<string|int, mixed> —an array of Node
notIn()
Construct a 'NOT IN' boolean expression
public
notIn([mixed $others = NULL ]) : NotInOperator|InOperator
Parameters
- $others : mixed = NULL
-
the other operands
Return values
NotInOperator|InOperatorof()
Transform any object into a Node (does nothing on a Node)
public
static of(mixed $value) : Literal|Node
Parameters
- $value : mixed
-
any value
Return values
Literal|Node —a Node
query()
Construct a SelectStatement from this table
public
query() : SelectStatement
Return values
SelectStatement —the new SELECT query
rename()
Rename the table
public
rename(string $new_table) : AlterStatement
Parameters
- $new_table : string
-
the new name
Return values
AlterStatement —the new ALTER query
renameColumn()
Rename a column
public
renameColumn(string|Column $column, string|Column $new_name) : AlterStatement
Parameters
Return values
AlterStatement —the new ALTER query
repeat()
Repeat the current node $times times
public
repeat(mixed $times) : Repeat
Parameters
- $times : mixed
-
the number of times to repeat the current node
Return values
Repeat —the repeated node
setType()
Set the type of the Node
public
setType(Type $type) : void
Parameters
- $type : Type
-
the type
standardizeArray()
Transform any object into a array
public
static standardizeArray(mixed $args) : array<string|int, mixed>
Parameters
- $args : mixed
-
the object
Return values
array<string|int, mixed> —the array
table()
Construct a Table node
public
static table(mixed $name) : Table
Parameters
- $name : mixed
-
the table name
Return values
Table —the table
toDeleteStatement()
Construct an DeleteStatement for this table
public
toDeleteStatement() : DeleteStatement
Return values
DeleteStatement —the new DELETE query
toSql()
transform the node into a SQL query string
public
toSql([mixed $connection = NULL ]) : mixed
Parameters
- $connection : mixed = NULL
-
the DB connection concerned (to select the right visitor)
Return values
mixed —the SQL string
toUpdateStatement()
Construct an UpdateStatement for this table
public
toUpdateStatement() : UpdateStatement
Return values
UpdateStatement —the new UPDATE query
true()
Construct a Node corresponding to a tautology
public
static true() : EqualityOperator|IsNullOperator
Return values
EqualityOperator|IsNullOperatortruncate()
Construct a TruncateStatement for this table
public
truncate() : TruncateStatement
Return values
TruncateStatementtuple()
Construct a Tuple node
public
static tuple(mixed $array) : ExpressionList
Parameters
- $array : mixed
-
a list
Return values
ExpressionList —the new Tuple node
typed()
Set the type of the Node and return the Node
public
typed(Type $type) : Node
Parameters
- $type : Type
-
the type
Return values
Node —the current Node
when()
Construct a CASE expression from the current node and define the first WHEN clause with a given condition
public
when(mixed $condition) : WhenNode
Parameters
- $condition : mixed
Return values
WhenNode —the case node