Welcome Guest, Not a member yet? Register   Sign In
troubleshooting queries
#5

[eluser]xwero[/eluser]
As i understand mrthopers question correctly he doesn't want to execute the queries so enabling the profiler is no option.

Maybe an easier solution would be having a variable in the AR library that can be set before building the sql statement because the only difference with the view_ methods and the regular methods is the return of the compiled statement and the execution of the statement
Code:
var $view_sql = false;
function get($table = '', $limit = null, $offset = null)
    {
        if ($table != '')
        {
            $this->from($table);
        }
        
        if ( ! is_null($limit))
        {
            $this->limit($limit, $offset);
        }
            
        $sql = $this->_compile_select();

        if($this->view_sql)
                {
                   return $sql;
                 }
                 $result = $this->query($sql);
         $this->_reset_select();
         return $result;
                
    }
In the models you could do
Code:
$this->db->view_sql = true;
$this->db->where('a','b');
echo $this->db->get();


Messages In This Thread
troubleshooting queries - by El Forum - 01-29-2008, 09:36 AM
troubleshooting queries - by El Forum - 01-29-2008, 09:55 AM
troubleshooting queries - by El Forum - 01-30-2008, 04:40 AM
troubleshooting queries - by El Forum - 01-30-2008, 07:00 AM
troubleshooting queries - by El Forum - 01-30-2008, 07:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB