Ejemplo n.º 1
0
 public function getArguments(QueryPlaceholderInterface $queryPlaceholder = NULL)
 {
     if (!isset($queryPlaceholder)) {
         $queryPlaceholder = $this;
     }
     $this->where->compile($this->connection, $queryPlaceholder);
     $this->having->compile($this->connection, $queryPlaceholder);
     $args = $this->where->arguments() + $this->having->arguments();
     foreach ($this->tables as $table) {
         if ($table['arguments']) {
             $args += $table['arguments'];
         }
         // If this table is a subquery, grab its arguments recursively.
         if ($table['table'] instanceof SelectQueryInterface) {
             $args += $table['table']->getArguments($queryPlaceholder);
         }
     }
     foreach ($this->expressions as $expression) {
         if ($expression['arguments']) {
             $args += $expression['arguments'];
         }
     }
     // If there are any dependent queries to UNION,
     // incorporate their arguments recursively.
     foreach ($this->union as $union) {
         $args += $union['query']->getArguments($queryPlaceholder);
     }
     return $args;
 }
Ejemplo n.º 2
0
 /**
  * Implements QueryConditionInterface::arguments().
  */
 public function arguments()
 {
     return $this->condition->arguments();
 }
Ejemplo n.º 3
0
 /**
  * Executes the UPDATE query.
  *
  * @return
  *   The number of rows affected by the update.
  */
 public function execute()
 {
     // Expressions take priority over literal fields, so we process those first
     // and remove any literal fields that conflict.
     $fields = $this->fields;
     $update_values = array();
     foreach ($this->expressionFields as $field => $data) {
         if (!empty($data['arguments'])) {
             $update_values += $data['arguments'];
         }
         unset($fields[$field]);
     }
     // Because we filter $fields the same way here and in __toString(), the
     // placeholders will all match up properly.
     $max_placeholder = 0;
     foreach ($fields as $field => $value) {
         $update_values[':db_update_placeholder_' . $max_placeholder++] = $value;
     }
     if (count($this->condition)) {
         $this->condition->compile($this->connection, $this);
         $update_values = array_merge($update_values, $this->condition->arguments());
     }
     return $this->connection->query((string) $this, $update_values, $this->queryOptions);
 }