Exemplo n.º 1
0
 public function update($table, $values, $where)
 {
     $transaction = $this->beginTransaction();
     $count = 0;
     try {
         $sql = new \Midori\String("UPDATE {$this->quoteIdentifier($table)} SET ");
         foreach ($values as $column => $value) {
             $sql->append("\n\t{$this->quoteIdentifier($column)} = {$this->quote($value)},");
         }
         $sql = $sql->trimEnd(",");
         $sql->append("\n\t WHERE " . $where);
         $query = $sql->__toString();
         $this->log->sql($query);
         //echo "updating $query <br /> " ;
         $count = $this->driver->exec($query);
         if ($transaction) {
             $this->commit();
         }
     } catch (Exception $ex) {
         if ($transaction) {
             $this->rollback();
         }
         throw $ex;
     }
     return $count;
 }
Exemplo n.º 2
0
 public function getErrorMessage()
 {
     $string = new \Midori\String($this->propertyName);
     return sprintf($this->message, $string->titleize(true));
 }