src/Web2All/Table/SaveObjectTrait.php
public function updateDB()
  {
    // first check if keys are available
    if (!$this->isValid()) {
      return false;
    }
    
    if(count($this->key_properties)==0){
      // cannot update without keys
      return false;
    }
    // build where part
    $where_part='';
    foreach ($this->key_properties as $key) {
      if ($where_part) {
        $where_part.=' AND ';
      }
      if ($this->{$key} instanceof Web2All_Table_SQLOperation) {
        // please note, you really shouldn't use Web2All_Table_SQLOperation objects for key values.
        trigger_error('Web2All_Table_SaveObjectTrait->updateDB(): using Web2All_Table_SQLOperation object for key value '.$key,E_USER_NOTICE);
        $where_part.=$this->obj_to_db_trans[$key].'='.$this->{$key}->toSQLString();

      }else if ($this->{$key} instanceof Web2All_Table_SQLOperationList) {
        throw new Exception("Web2All_Table_SaveObjectTrait: can't update with a Web2All_Table_SQLOperationList in the where part for key value ".$key);
        
      }else{
        $where_part.=$this->obj_to_db_trans[$key].'='.$this->db->Quote($this->{$key});
      }
    }
    
    $update_fields=Array();
    foreach ($this->obj_to_db_trans as $obj_prop => $db_field) {
      
      if( isset($this->{$obj_prop}) && !in_array($obj_prop,$this->key_properties) ){
        $update_fields[$db_field]=$this->{$obj_prop};
      }
      
    }
    
    // nothing to update
    if (count($update_fields)==0) {
      return false;
    }
    
    // build set part
    $set_part='';
    foreach ($update_fields as $update_field => $update_value) {
      if ($set_part) {
        $set_part.=', ';
      }
      if ($update_value instanceof Web2All_Table_SQLOperation) {
        // if there are placeholder values, replace the placeholders with the quoted values
        $set_part.=$update_field.'='.$this->substituteSQLOperationPlaceholders($update_value);

      }else if ($update_value instanceof Web2All_Table_SQLOperationList) {
        throw new Exception("Web2All_Table_SaveObjectTrait: can't update a Web2All_Table_SQLOperationListfor field ".$update_field);
      
      }else{
        $set_part.=$update_field.'='.$this->db->Quote($update_value);
      }
    }
    
    $this->db->Execute('UPDATE '.$this->quote($this->tablename).' SET '.$set_part.' WHERE '.$where_part.' ');
    
    return true;
  }
public function updateDB()
  {
    // first check if keys are available
    if (!$this->isValid()) {
      return false;
    }
    
    if(count($this->key_properties)==0){
      // cannot update without keys
      return false;
    }
    // build where part
    $where_part='';
    foreach ($this->key_properties as $key) {
      if ($where_part) {
        $where_part.=' AND ';
      }
      if ($this->{$key} instanceof Web2All_Table_SQLOperation) {
        // please note, you really shouldn't use Web2All_Table_SQLOperation objects for key values.
        trigger_error('Web2All_Table_SaveObjectTrait->updateDB(): using Web2All_Table_SQLOperation object for key value '.$key,E_USER_NOTICE);
        $where_part.=$this->obj_to_db_trans[$key].'='.$this->{$key}->toSQLString();

      }else if ($this->{$key} instanceof Web2All_Table_SQLOperationList) {
        throw new Exception("Web2All_Table_SaveObjectTrait: can't update with a Web2All_Table_SQLOperationList in the where part for key value ".$key);
        
      }else{
        $where_part.=$this->obj_to_db_trans[$key].'='.$this->db->Quote($this->{$key});
      }
    }
    
    $update_fields=Array();
    foreach ($this->obj_to_db_trans as $obj_prop => $db_field) {
      
      if( isset($this->{$obj_prop}) && !in_array($obj_prop,$this->key_properties) ){
        $update_fields[$db_field]=$this->{$obj_prop};
      }
      
    }
    
    // nothing to update
    if (count($update_fields)==0) {
      return false;
    }
    
    // build set part
    $set_part='';
    foreach ($update_fields as $update_field => $update_value) {
      if ($set_part) {
        $set_part.=', ';
      }
      if ($update_value instanceof Web2All_Table_SQLOperation) {
        // if there are placeholder values, replace the placeholders with the quoted values
        $set_part.=$update_field.'='.$this->substituteSQLOperationPlaceholders($update_value);

      }else if ($update_value instanceof Web2All_Table_SQLOperationList) {
        throw new Exception("Web2All_Table_SaveObjectTrait: can't update a Web2All_Table_SQLOperationListfor field ".$update_field);
      
      }else{
        $set_part.=$update_field.'='.$this->db->Quote($update_value);
      }
    }
    
    $this->db->Execute('UPDATE '.$this->quote($this->tablename).' SET '.$set_part.' WHERE '.$where_part.' ');
    
    return true;
  }
Update the current item (in DB)

@return boolean