src/Web2All/Table/SaveObjectCachedTrait.php
public function insertIntoDB($nocache=false)
  {
    $query='INSERT INTO '.$this->quote($this->tablename).' (';
    $values=array();
    $fields=array();
    foreach ($this->obj_to_db_trans as $obj_prop => $db_field) {
      
      if(isset($this->{$obj_prop})){
        if ($this->{$obj_prop} instanceof Web2All_Table_SQLOperation) {
          // if there are placeholder values, replace the placeholders with the quoted values
          
          $values[]=$this->substituteSQLOperationPlaceholders($this->{$obj_prop});
        
        }else if ($this->{$obj_prop} instanceof Web2All_Table_SQLOperationList) {
          throw new Exception("Web2All_Table_SaveObjectCachedTrait: can't insert a Web2All_Table_SQLOperationList for key value ".$obj_prop);
          
        }else{
          $values[]=$this->db->Quote($this->{$obj_prop});
        }
        
        $fields[]=$this->quote($db_field);
      }
    }
    $query.=implode(',',$fields).') VALUES ';
    if(count($fields)>0){
      $this->caching_db->doInsertQueryCached($query,$values);
    }
    if($nocache){
      $this->caching_db->flushInsertQuery($query);
    }
  }
public function insertIntoDB($nocache=false)
  {
    $query='INSERT INTO '.$this->quote($this->tablename).' (';
    $values=array();
    $fields=array();
    foreach ($this->obj_to_db_trans as $obj_prop => $db_field) {
      
      if(isset($this->{$obj_prop})){
        if ($this->{$obj_prop} instanceof Web2All_Table_SQLOperation) {
          // if there are placeholder values, replace the placeholders with the quoted values
          
          $values[]=$this->substituteSQLOperationPlaceholders($this->{$obj_prop});
        
        }else if ($this->{$obj_prop} instanceof Web2All_Table_SQLOperationList) {
          throw new Exception("Web2All_Table_SaveObjectCachedTrait: can't insert a Web2All_Table_SQLOperationList for key value ".$obj_prop);
          
        }else{
          $values[]=$this->db->Quote($this->{$obj_prop});
        }
        
        $fields[]=$this->quote($db_field);
      }
    }
    $query.=implode(',',$fields).') VALUES ';
    if(count($fields)>0){
      $this->caching_db->doInsertQueryCached($query,$values);
    }
    if($nocache){
      $this->caching_db->flushInsertQuery($query);
    }
  }
public function insertIntoDB ( $ nocache = false ) { $ query = 'INSERT INTO ' . $ this -> quote ( $ this -> tablename ) . ' (' ; $ values = array ( ) ; $ fields = array ( ) ; foreach ( $ this -> obj_to_db_trans as $ obj_prop => $ db_field ) { if ( isset ( $ this -> { $ obj_prop } ) ) { if ( $ this -> { $ obj_prop } instanceof Web2All_Table_SQLOperation ) { // if there are placeholder values, replace the placeholders with the quoted values
 $ values [ ] = $ this -> substituteSQLOperationPlaceholders ( $ this -> { $ obj_prop } ) ; } else if ( $ this -> { $ obj_prop } instanceof Web2All_Table_SQLOperationList ) { throw new Exception ( "Web2All_Table_SaveObjectCachedTrait: can't insert a Web2All_Table_SQLOperationList for key value " . $ obj_prop ) ; } else { $ values [ ] = $ this -> db -> Quote ( $ this -> { $ obj_prop } ) ; } $ fields [ ] = $ this -> quote ( $ db_field ) ; } } $ query .= implode ( ',' , $ fields ) . ') VALUES ' ; if ( count ( $ fields ) > 0 ) { $ this -> caching_db -> doInsertQueryCached ( $ query , $ values ) ; } if ( $ nocache ) { $ this -> caching_db -> flushInsertQuery ( $ query ) ; } }
Insert this object into the DB

Inserts are cached and only flushed at object destruction,
unless the nocache param is true, or if a manual flush is done.
The caching is the default setting, but is only recommended if you
use this object to insert multiple records after each other. When
using caching, do not use $this->getDB()->Insert_ID().

@param boolean $nocache  [optional defaults to caching inserts]
Insert this object into the DB