execute() public méthode

Execute update query
public execute ( boolean $getResultAsPdoStatement = false ) : integer | boolean | PDOStatement
$getResultAsPdoStatement boolean true to return the pdo statement instead of row count
Résultat integer | boolean | PDOStatement
 public function execute_logged($message, $tag, $module, $variables = array())
 {
     if (($retval = parent::execute()) !== 0) {
         cvwobase_add_audit($message, $tag, $module, $variables);
     }
     return $retval;
 }
Exemple #2
0
 public static function permit($role, $action, $subject, $subject_id, $control)
 {
     $result = false;
     $params = array(':role' => $role, ':control' => $control, ':action' => $action, ':subject' => $subject, ':subject_id' => $subject_id);
     $query = new SelectQuery('Permission');
     $query->filter('`role` = :role')->filter('`control` = :control')->filter('`action` = :action')->filter('`subject` = :subject')->filter('`subject_id` = :subject_id')->filter('system = 0');
     $id = $query->fetchColumn($params);
     if ($id) {
         $query = new UpdateQuery('Permission');
         $query->data(array('control' => ':control'))->filter('`id` = :id');
         return $query->execute(array(':id' => $id, ':control' => $control));
     } else {
         $data = array('role', 'control', 'action', 'subject', 'subject_id');
         $data = array_combine($data, array_values($params));
         $query = new InsertQuery('Permission');
         $query->data($data);
         return $query->execute();
     }
 }
Exemple #3
0
 public function execute()
 {
     if (!empty($this->queryOptions['sqlite_return_matched_rows'])) {
         return parent::execute();
     }
     // Get the fields used in the update query, and remove those that are already
     // in the condition.
     $fields = $this->expressionFields + $this->fields;
     $this->removeFieldsInCondition($fields, $this->condition);
     // Add the inverse of the fields to the condition.
     $condition = new DatabaseCondition('OR');
     foreach ($fields as $field => $data) {
         if (is_array($data)) {
             // The field is an expression.
             $condition->where($field . ' <> ' . $data['expression']);
             $condition->isNull($field);
         } elseif (!isset($data)) {
             // The field will be set to NULL.
             $condition->isNull($field);
         } else {
             $condition->condition($field, $data, '<>');
             $condition->isNull($field);
         }
     }
     if (count($condition)) {
         $condition->compile($this->connection, $this);
         $this->condition->where((string) $condition, $condition->arguments());
     }
     return parent::execute();
 }
 /**
  * Executes the query without audit logging.
  * @return
  *   The number of rows affected by the update.
  */
 public function execute_special()
 {
     return parent::execute();
 }
Exemple #5
0
 public function execute()
 {
     $this->updateQuery->fields($this->fields);
     $this->updateQuery->execute();
 }