valueBinder() public method

A ValueBinder is responsible for generating query placeholders and temporarily associate values to those placeholders so that they can be passed correctly statement object.
public valueBinder ( ValueBinder | null $binder = null )
$binder ValueBinder | null new instance to be set. If no value is passed the default one will be returned
 /**
  * Iterates over each of the clauses in a query looking for identifiers and
  * quotes them
  *
  * @param Query $query The query to have its identifiers quoted
  * @return Query
  */
 public function quote(Query $query)
 {
     $binder = $query->valueBinder();
     $query->valueBinder(false);
     if ($query->type() === 'insert') {
         $this->_quoteInsert($query);
     } else {
         $this->_quoteParts($query);
     }
     $query->traverseExpressions([$this, 'quoteExpression']);
     $query->valueBinder($binder);
     return $query;
 }
Example #2
0
 /**
  * Executes the provided query after compiling it for the specific dirver
  * dialect and returns the executed Statement object.
  *
  * @param \Cake\Database\Query $query The query to be executed
  * @return \Cake\Database\StatementInterface executed statement
  */
 public function run(Query $query)
 {
     $binder = $query->valueBinder();
     $binder->resetCount();
     list($query, $sql) = $this->driver()->compileQuery($query, $binder);
     $statement = $this->prepare($sql);
     $binder->attachTo($statement);
     $statement->execute();
     return $statement;
 }