see*_*man 4 activerecord codeigniter
实际上我在stackoverflow本身看到了一些建议,但没有得到这个问题的确切解决方案,请不要认为这是重复.
我使用memcache为我的codeigniter网站和活动记录来构建查询.我正在使用
this->db->return_query_string();
Run Code Online (Sandbox Code Playgroud)
在执行之前从活动记录中获取查询.现在我想刷新活动记录而不执行相同的查询.
也来自各种参考文献
$this->db->start_cache();
$this->db->stop_cache();
$this->db->flush_cache()
Run Code Online (Sandbox Code Playgroud)
可能做的工作是这是确切的结果吗?如果是这样,我怎么能得到缓存执行的缓存查询
您可以根据需要使用这两个功能
public function _compile_select($select_override = FALSE)
public function _reset_select()
Run Code Online (Sandbox Code Playgroud)
要使用它们,您必须删除公共或私人关键字.
转到system/database/DB_active_rec.php从这些函数中删除public或protected关键字
用法示例
$this->db->select('trans_id');
$this->db->from('myTable');
$this->db->where('code','B');
$subQuery = $this->db->_compile_select();
$this->db->_reset_select();
Run Code Online (Sandbox Code Playgroud)
$ subQuery包含查询字符串,_reset_select重置活动记录,因此您可以编写新查询.
| 归档时间: |
|
| 查看次数: |
6549 次 |
| 最近记录: |