本文整理汇总了PHP中DataManager::update方法的典型用法代码示例。如果您正苦于以下问题:PHP DataManager::update方法的具体用法?PHP DataManager::update怎么用?PHP DataManager::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager::update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controller_create
public function controller_create($args)
{
$vars["success"] = null;
$vars["varname"] = "newdemo";
$tablename = "demos";
$objkey = "demoname";
if (!empty($args["category"]) || !empty($args["newcategory"])) {
$vars["varname"] = "newcategory";
$tablename = "demo_categories";
$objkey = "category";
}
if (!empty($args[$vars["varname"]])) {
$newobj = $args[$vars["varname"]];
$newobjid = $newobj[$objkey];
if (!empty($newobj[$objkey]) && !empty($newobj["title"])) {
$vars["success"] = DataManager::insert("db.demos.{$newobjid}", $tablename, $newobj);
if (!$vars["success"]) {
// insert failed, try an update
$vars["success"] = DataManager::update("db.demos.{$newobjid}", $tablename, $newobj, array($objkey => $newobjid));
}
}
$vars["demo"] = $newobj;
} else {
if (!empty($args["category"])) {
$vars["varname"] = "newcategory";
$demos = DataManager::fetch("db.demos.{$args['category']}", "demo_categories", array($objkey => $args["category"]));
$vars["demo"] = $demos[0];
} else {
if (!empty($args["demoname"])) {
$demos = DataManager::fetch("db.demos.{$args['demoname']}", "demos", array("demoname" => $args["demoname"]));
$vars["demo"] = $demos[0];
}
}
}
return $this->GetComponentResponse("./create.tpl", $vars);
}
示例2: update
/**
* Update table
*
* $updates is associative array where key is field name and value is new
* value
*
* @param array $updates
* @param string $conditions
* @return boolean
* @throws DBQueryError
*/
function update($updates, $conditions = null)
{
return DataManager::update($updates, $conditions, TABLE_PREFIX . 'incoming_mailboxes');
}
示例3: write
/**
* mysql session write handler.
* Persist the entire portion of $_SESSION["persist"] to DB.
* Refresh memcache with $_SESSION.
*
* @param string session id
* @param string data to write
*/
public function write($id, $data)
{
Profiler::StartTimer("SessionManager::write", 1);
// Save user, and all associated lists, settings, etc.
Profiler::StartTimer("SessionManager::write - save user");
$user = User::singleton();
$user->save();
Profiler::StopTimer("SessionManager::write - save user");
$pdata = $_SESSION["persist"];
strip_nulls($pdata);
// compare the persist data before and after for changes
$pdata_serialize = serialize($pdata);
//Logger::Warn($pdata_serialize);
//$data = $this->cache_obj->get($id);
$data = DataManager::fetch("memcache.session#{$id}", $id);
$pdata_before = $data["persist"];
$pdata_before_serialize = serialize($pdata_before);
// update the memcache with the entire $_SESSION
//$session_serialize = serialize($_SESSION);
//$this->cache_obj->set($id, $_SESSION, 0);
$data = DataManager::update("memcache.session#{$id}", $id, $_SESSION);
if (empty($pdata) || is_null($pdata)) {
$new_crc = 0;
} else {
$new_crc = strlen($pdata_serialize) . crc32($pdata_serialize);
}
if ($this->crc != $new_crc) {
// if the user does not have a record already, create one first
// NOTE from James - removed '&& (! $pdata["user"]["userid"]' from below, didn't seem to make sense...
if ($this->has_db_record == false) {
$this->create_new_persist_record();
// need to set the session cache again with we set the has_db_record param
//$session_serialize = serialize($_SESSION);
//$this->cache_obj->set($id, $_SESSION, 0, $this->session_cache_expire);
DataManager::update("memcache.session#{$id}", $id, $_SESSION);
} else {
$result = $this->data->QueryUpdate($this->sessionsource . "#{$this->fluid}", $this->sessiontable, array($this->fluid => array("data" => $pdata_serialize)), array("fl_uid" => $this->fluid));
Logger::Info("Updating userdata.usersession record for {$this->fluid}");
}
}
Profiler::StopTimer("SessionManager::write");
}