PHP Класс Cake\Database\Expression\ValuesExpression

Helps generate SQL with the correct number of placeholders and bind values correctly into the statement.
Наследование: implements Cake\Database\ExpressionInterface, use trait Cake\Database\Type\ExpressionTypeCasterTrait, use trait Cake\Database\TypeMapTrait
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$_castedExpressions string Whether or not values have been casted to expressions already.
$_columns array List of columns to ensure are part of the insert.
$_query Cake\Database\Query | null The Query object to use as a values expression
$_values array Array of values to insert.

Открытые методы

Метод Описание
__construct ( array $columns, Cake\Database\TypeMap $typeMap ) Constructor
add ( array | Query $data ) : void Add a row of data to be inserted.
columns ( array | null $cols = null ) : array | $this Sets the columns to be inserted. If no params are passed, then it returns the currently stored columns
query ( Query $query = null ) : Query | null Sets the query object to be used as the values expression to be evaluated to insert records in the table. If no params are passed, then it returns the currently stored query
sql ( ValueBinder $generator ) : string Convert the values into a SQL string with placeholders.
traverse ( callable $visitor ) : void Traverse the values expression.
values ( array | null $values = null ) : array | $this Sets the values to be inserted. If no params are passed, then it returns the currently stored values

Защищенные методы

Метод Описание
_columnNames ( ) : array Get the bare column names.
_processExpressions ( ) : void Converts values that need to be casted to expressions

Описание методов

__construct() публичный метод

Constructor
public __construct ( array $columns, Cake\Database\TypeMap $typeMap )
$columns array The list of columns that are going to be part of the values.
$typeMap Cake\Database\TypeMap A dictionary of column -> type names

_columnNames() защищенный метод

Because column names could be identifier quoted, we need to strip the identifiers off of the columns.
protected _columnNames ( ) : array
Результат array

_processExpressions() защищенный метод

Converts values that need to be casted to expressions
protected _processExpressions ( ) : void
Результат void

add() публичный метод

Add a row of data to be inserted.
public add ( array | Query $data ) : void
$data array | Cake\Database\Query Array of data to append into the insert, or a query for doing INSERT INTO .. SELECT style commands
Результат void

columns() публичный метод

Sets the columns to be inserted. If no params are passed, then it returns the currently stored columns
public columns ( array | null $cols = null ) : array | $this
$cols array | null arrays with columns to be inserted
Результат array | $this

query() публичный метод

Sets the query object to be used as the values expression to be evaluated to insert records in the table. If no params are passed, then it returns the currently stored query
public query ( Query $query = null ) : Query | null
$query Cake\Database\Query The query to set/get
Результат Cake\Database\Query | null

sql() публичный метод

Convert the values into a SQL string with placeholders.
public sql ( ValueBinder $generator ) : string
$generator Cake\Database\ValueBinder Placeholder generator object
Результат string

traverse() публичный метод

This method will also traverse any queries that are to be used in the INSERT values.
public traverse ( callable $visitor ) : void
$visitor callable The visitor to traverse the expression with.
Результат void

values() публичный метод

Sets the values to be inserted. If no params are passed, then it returns the currently stored values
public values ( array | null $values = null ) : array | $this
$values array | null arrays with values to be inserted
Результат array | $this

Описание свойств

$_castedExpressions защищенное свойство

Whether or not values have been casted to expressions already.
protected string $_castedExpressions
Результат string

$_columns защищенное свойство

List of columns to ensure are part of the insert.
protected array $_columns
Результат array

$_query защищенное свойство

The Query object to use as a values expression
protected Query,Cake\Database|null $_query
Результат Cake\Database\Query | null

$_values защищенное свойство

Array of values to insert.
protected array $_values
Результат array