本文整理汇总了PHP中w2p_Database_Query::insertObject方法的典型用法代码示例。如果您正苦于以下问题:PHP w2p_Database_Query::insertObject方法的具体用法?PHP w2p_Database_Query::insertObject怎么用?PHP w2p_Database_Query::insertObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类w2p_Database_Query
的用法示例。
在下文中一共展示了w2p_Database_Query::insertObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* @todo refactor
*/
public function store()
{
$q = $this->_getQuery();
if ($msg = $this->delete()) {
return 'CPreference::store-delete failed ' . $msg;
}
$q = new w2p_Database_Query();
if (!$q->insertObject('user_preferences', $this)) {
return 'CPreference::store failed ' . db_error();
} else {
return null;
}
}
示例2: store
public function store()
{
$msg = $this->check();
if ($msg) {
return 'CPreference::store-check failed ' . $msg;
}
if ($msg = $this->delete()) {
return 'CPreference::store-delete failed ' . $msg;
}
$q = new w2p_Database_Query();
if (!($ret = $q->insertObject('user_preferences', $this))) {
$q->clear();
return 'CPreference::store failed ' . db_error();
} else {
$q->clear();
return null;
}
}
示例3: store
/**
* Inserts a new row if id is zero or updates an existing row in the database table
*
* Can be overloaded/supplemented by the child class
* @return null|string null if successful otherwise returns and error message
*/
public function store($updateNulls = false)
{
global $AppUI;
$this->w2PTrimAll();
$msg = $this->check();
if (is_array($msg) && count($msg) || !is_array($msg) && strlen($msg)) {
return get_class($this) . '::store-check failed ' . $msg;
}
$k = $this->_tbl_key;
if ($this->{$k}) {
$store_type = 'update';
$q = new w2p_Database_Query();
$ret = $q->updateObject($this->_tbl, $this, $this->_tbl_key, $updateNulls);
$q->clear();
} else {
$store_type = 'add';
$q = new w2p_Database_Query();
$ret = $q->insertObject($this->_tbl, $this, $this->_tbl_key);
$q->clear();
}
if ($ret) {
// only record history if an update or insert actually occurs.
addHistory($this->_tbl, $this->{$k}, $store_type, $AppUI->_('ACTION') . ': ' . $store_type . ' ' . $AppUI->_('TABLE') . ': ' . $this->_tbl . ' ' . $AppUI->_('ID') . ': ' . $this->{$k});
}
return !$ret ? get_class($this) . '::store failed ' . db_error() : null;
}
示例4: insertObject
public function insertObject($table, &$object, $keyName = null, $verbose = false)
{
parent::insertObject($table, $object, $keyName, $verbose);
$object->{$keyName} = 1;
}