本文整理汇总了PHP中KDatabaseTableDefault::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP KDatabaseTableDefault::insert方法的具体用法?PHP KDatabaseTableDefault::insert怎么用?PHP KDatabaseTableDefault::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDatabaseTableDefault
的用法示例。
在下文中一共展示了KDatabaseTableDefault::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insert
/**
* 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: insert
/**
* 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);
}
示例3: insert
/**
* 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: insert
/**
* 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;
}