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
파일 보기 프로젝트 열기: cakephp/cakephp

보호된 프로퍼티들

프로퍼티 타입 설명
$_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