Exemple #1
0
 /**
  * Updates all rows in result set.
  * Joins in UPDATE are supported only in MySQL
  * @param  array|Traversable ($column => $value)
  * @return int number of affected rows or FALSE in case of an error
  */
 public function update($data)
 {
     if ($data instanceof Traversable) {
         $data = iterator_to_array($data);
     } elseif (!is_array($data)) {
         throw new InvalidArgumentException();
     }
     if (!$data) {
         return 0;
     }
     return $this->connection->queryArgs($this->sqlBuilder->buildUpdateQuery(), array_merge(array($data), $this->sqlBuilder->getParameters()))->rowCount();
 }