Example #1
0
 function commit()
 {
     $vars = DataObject::get_vars($this);
     unset($vars[$this->primary_key]);
     //Do not update the primary key!
     $object_vars = $this->key_values($vars);
     if ($this->update) {
         $result = $this->dao->myquery("UPDATE {$this->table} SET " . implode(",", $object_vars) . " WHERE " . $this->primary_key . "=" . $this->primary_id . ";");
     } else {
         $result = $this->dao->myquery("INSERT INTO {$this->table} SET " . implode(",", $object_vars) . ";");
         DataObject::determine_primary($this);
         $this->{$this->primary_key} = $this->dao->insert_id();
         $this->primary_id = $this->{$this->primary_key};
     }
     $this->update = true;
     return $result;
 }