示例#1
0
文件: DB.php 项目: wiserweb/OpenVBX
 protected function _set($key, $data, $group, $tenant_id, $expires = null)
 {
     if (empty($expires)) {
         $expires = $this->default_expires;
     }
     $data = $this->_serialize(array('data' => $data, 'expires' => time() + intval($expires)));
     $this->_delete($key, $group, $tenant_id);
     $r = $this->_db->insert($this->_table, array($this->_table . '.key' => $key, $this->_table . '.group' => $group, $this->_table . '.value' => $data, $this->_table . '.tenant_id' => $tenant_id));
     return $this->_db->affected_rows() > 0;
 }
示例#2
0
 public function update()
 {
     $this->_set_row();
     $this->db->update($this->_forged_join());
     $this->_clear_forged_join();
     if ($this->_record_is_changed()) {
         return $this->db->affected_rows() > 0;
     }
     return true;
 }
示例#3
0
 /**
  * 删除数据
  * @param array|string $where 条件
  * @param int $limit 删除数量限制,默认不限制
  * @return int $delete_count 删除的记录数
  */
 public function delete($where, $limit = NULL)
 {
     if (!is_null($limit) && is_numeric($limit)) {
         $this->where($where);
         if (is_numeric($limit)) {
             $this->db->limit($limit);
         }
         $this->db->delete($this->_name);
         return $this->db->affected_rows();
     }
     $this->db->delete($this->_name, $where);
     return $this->db->affected_rows();
 }