当前位置: 首页>>代码示例>>PHP>>正文


PHP DataManager::update方法代码示例

本文整理汇总了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);
 }
开发者ID:jbaicoianu,项目名称:elation,代码行数:36,代码来源:demos.php

示例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');
 }
开发者ID:NaszvadiG,项目名称:activecollab_loc,代码行数:15,代码来源:BaseIncomingMailboxes.class.php

示例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");
 }
开发者ID:ameyer430,项目名称:elation,代码行数:50,代码来源:sessionmanager_class.php


注:本文中的DataManager::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。