PHP Class Cake\Database\ValueBinder

Afficher le fichier Open project: cakephp/cakephp Class Usage Examples

Protected Properties

Свойство Type Description
$_bindings array Array containing a list of bound values to the conditions on this object. Each array entry is another array structure containing the actual bound value, its type and the placeholder it is bound to.
$_bindingsCount integer A counter of the number of parameters bound in this expression object

Méthodes publiques

Méthode Description
attachTo ( Cake\Database\StatementInterface $statement ) : void Binds all the stored values in this object to the passed statement.
bind ( string | integer $param, mixed $value, string | integer $type = 'string' ) : void Associates a query placeholder to a value and a type
bindings ( ) : array Returns all values bound to this expression object at this nesting level.
generateManyNamed ( array | Traversable $values, string $type = 'string' ) : array Creates unique named placeholders for each of the passed values and binds them with the specified type.
placeholder ( string $token ) : string Creates a unique placeholder name if the token provided does not start with ":" otherwise, it will return the same string and internally increment the number of placeholders generated by this object.
reset ( ) : void Clears any bindings that were previously registered
resetCount ( ) : void Resets the bindings count without clearing previously bound values

Method Details

attachTo() public méthode

Binds all the stored values in this object to the passed statement.
public attachTo ( Cake\Database\StatementInterface $statement ) : void
$statement Cake\Database\StatementInterface The statement to add parameters to.
Résultat void

bind() public méthode

Associates a query placeholder to a value and a type
public bind ( string | integer $param, mixed $value, string | integer $type = 'string' ) : void
$param string | integer placeholder to be replaced with quoted version of $value
$value mixed The value to be bound
$type string | integer the mapped type name, used for casting when sending to database
Résultat void

bindings() public méthode

Subexpression bound values will not be returned with this function.
public bindings ( ) : array
Résultat array

generateManyNamed() public méthode

Creates unique named placeholders for each of the passed values and binds them with the specified type.
public generateManyNamed ( array | Traversable $values, string $type = 'string' ) : array
$values array | Traversable The list of values to be bound
$type string The type with which all values will be bound
Résultat array with the placeholders to insert in the query

placeholder() public méthode

Creates a unique placeholder name if the token provided does not start with ":" otherwise, it will return the same string and internally increment the number of placeholders generated by this object.
public placeholder ( string $token ) : string
$token string string from which the placeholder will be derived from, if it starts with a colon, then the same string is returned
Résultat string to be used as a placeholder in a query expression

reset() public méthode

Clears any bindings that were previously registered
public reset ( ) : void
Résultat void

resetCount() public méthode

Resets the bindings count without clearing previously bound values
public resetCount ( ) : void
Résultat void

Property Details

$_bindings protected_oe property

Array containing a list of bound values to the conditions on this object. Each array entry is another array structure containing the actual bound value, its type and the placeholder it is bound to.
protected array $_bindings
Résultat array

$_bindingsCount protected_oe property

A counter of the number of parameters bound in this expression object
protected int $_bindingsCount
Résultat integer