问题描述
看起来 _compile_select
已被弃用,get_compiled_select
未添加到 2.1.0.有没有像这两个一样的其他功能?我也很好奇.是否有任何特殊原因不将 get_compiled_select()
添加到 Active Record 并删除 _compile_select
?
Looks like _compile_select
is deprecated and get_compiled_select
is not added to 2.1.0. Are there any other functions like those two? And also I am curious. Is there any particular reason to not adding get_compiled_select()
to Active Record and removing _compile_select
?
推荐答案
我已经将 get_compiled_select() 添加到 DB_active_rec.php 并且它似乎没有问题,但我不会删除 _compile_select() 因为它在许多其他方法.
I've added get_compiled_select() to DB_active_rec.php and it seems to work without problem, but i wouldn't remove _compile_select() since it's used in many other methods.
添加此方法的拉取请求在这里,还有一些其他有用的方法,例如:
The pull request for adding this method is here, with some other useful methods like:
- get_compiled_select()
- get_compiled_insert()
- get_compiled_update()
- get_compiled_delete()
https://github.com/EllisLab/CodeIgniter/pull/307
如果你只想要方法,就是这样:
if you want just the method, it's just this:
/**
* Get SELECT query string
*
* Compiles a SELECT query string and returns the sql.
*
* @access public
* @param string the table name to select from (optional)
* @param boolean TRUE: resets AR values; FALSE: leave AR vaules alone
* @return string
*/
public function get_compiled_select($table = '', $reset = TRUE)
{
if ($table != '')
{
$this->_track_aliases($table);
$this->from($table);
}
$select = $this->_compile_select();
if ($reset === TRUE)
{
$this->_reset_select();
}
return $select;
}
这篇关于是否有像 _compile_select 或 get_compiled_select() 这样的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!