Beispiel #1
0
 /**
  * Updates rows in table
  *
  * @var string $sql_table
  * @var array $params
  * @var string $where
  * @var bool $commit
  *
  * @return boolean
  * @access private
  */
 function sql_update_list($sql_table, $params, $where, $from = false, $commit = true)
 {
     $this->_sql_table = $sql_table;
     $this->_set_data_flags();
     foreach ($params as $k => $v) {
         if (!key_exists($k, $this->_data_flags)) {
             unset($params[$k]);
         }
     }
     if (empty($params)) {
         return false;
     }
     if ($from) {
         $sql = $this->prepare_update($params, $where, $from);
     } else {
         $sql = $this->prepare_update($params, $where);
     }
     //if (defined ('VIVVO_DEBUG_MODE')) echo "<hr/>$sql<hr/>\n";
     $sm = vivvo_lite_site::get_instance();
     $sm->debug_push("sql:", $sql->query);
     if ($commit == true || !vivvo_lite_site::get_instance()->get_db()->supports('transactions')) {
         $hook = 'db_' . $this->_sql_table . '_update_list';
         if (vivvo_hooks_manager::call($hook . '_pre', array(&$this)) !== false) {
             $res = $sql->execute($params);
             if (PEAR::isError($res)) {
                 $sm->debug_push("sql:", $res->getMessage(), 1);
                 return false;
             }
             vivvo_hooks_manager::call($hook . '_post', array(&$this));
         } elseif (!vivvo_hooks_manager::get_status()) {
             return false;
         }
     } else {
         $this->stack[] = $sql;
     }
     /**
      * call on_update method
      *
      * {@link vivvo_post_object::on_update}
      */
     if ($this->data_object instanceof vivvo_post_object) {
         $this->data_object->on_update($this);
     }
     $this->metod = 'modify';
     return true;
 }