2012-02-10 11 views
10

Sembra che _compile_select non sia stato aggiunto e get_compiled_select non sia stato aggiunto a 2.1.0. Ci sono altre funzioni come queste? E anche io sono curioso. C'è qualche ragione particolare per non aggiungere get_compiled_select() ad Active Record e rimuovere _compile_select?Esiste una funzione come _compile_select o get_compiled_select()?

risposta

13

Ho aggiunto get_compiled_select() a DB_active_rec.php e sembra funzionare senza problemi, ma non rimuovere _compile_select() poiché è utilizzato in molti altri metodi.

La richiesta di pull per l'aggiunta di questo metodo è qui, con alcuni altri metodi utili come:

  • get_compiled_select()
  • get_compiled_insert()
  • get_compiled_update()
  • get_compiled_delete()

https://github.com/EllisLab/CodeIgniter/pull/307

se si desidera solo il metodo, è proprio questo:

/** 
* 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; 
} 
Problemi correlati