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?
            Asked
            
        
        
            Active
            
        
            Viewed 1.9k times
        
    13
            
            
        
        Colin Brock
        
- 21,267
 - 9
 - 46
 - 61
 
        mirza
        
- 5,685
 - 10
 - 43
 - 73
 
1 Answers
19
            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;
}
        DaneoShiga
        
- 1,007
 - 8
 - 16