示例#1
0
 /**
  * Insert a new row into the table
  * 
  * Takes care of automatically incrementing the revision number
  *
  * @param KDatabaseRowInterface $row
  */
 public function insert(KDatabaseRowInterface $row)
 {
     $query = $this->getDatabase()->getQuery()->where('table', '=', $row->table)->where('row', '=', $row->row)->order('revision', 'desc')->limit(1);
     $latest = $this->select($query, KDatabase::FETCH_ROW);
     if (!$latest->isNew()) {
         $row->revision = $latest->revision + 1;
     }
     return parent::insert($row);
 }
示例#2
0
 /**
  * Table insert method
  *
  * @param  object	A KDatabaseRow object
  * @return boolean  TRUE if successfull, otherwise false
  */
 public function insert(KDatabaseRowAbstract $row)
 {
     $query = $this->_database->getQuery();
     $query->where('tbl.name', '=', $row->name, 'or');
     if ($this->count($query)) {
         $asset = $this->select($query, KDatabase::FETCH_ROW);
         $data = array_merge($asset->getData(), array_filter($row->getData()));
         return parent::update($asset->setData($data));
     }
     return parent::insert($row);
 }
 /**
  * Table insert method
  *
  * @param  object	A KDatabaseRow object
  * @return boolean  TRUE if successfull, otherwise false
  */
 public function insert(KDatabaseRowAbstract $row)
 {
     $query = $this->_database->getQuery();
     $query->where('tbl.joomla_gid', '=', $row->id);
     if ($this->count($query)) {
         $asset = $this->select($query, KDatabase::FETCH_ROW);
         $this->delete($asset);
         //			$asset->ninjaboard_gid = $row->ninjaboard_gid;
         return parent::insert($row);
     }
     return parent::insert($row);
 }
示例#4
0
 /**
  * Table insert method
  *
  * @param  object	A KDatabaseRow object
  * @return boolean  TRUE if successfull, otherwise false
  */
 public function insert(KDatabaseRowInterface $row)
 {
     $this->_setLevel($row);
     //This is because we need behavior.nestable to set the right path, before we set the path_sort
     //row->getModified() returns a blank array after parent::update have run
     $modified = $row->getModified();
     //Make sure that the row is appended, not prepended to the list
     if (!in_array('ordering', $modified)) {
         $row->ordering = $this->count(array()) + 1;
         $modified[] = 'ordering';
     }
     $result = parent::insert($row);
     $this->_setSort($row, $modified);
     return $result;
 }