Let me tell you a story.
I use Active Records in my models, so I can retrieve some data. Nice.
I use Rapyd, which really rocks. I just discovered the _pre_process and _post_process, so I play with it a bit. Very nice.
But when I use my Active-Record-data-retrieving inside the Rapyd processes, the $this->db receives all the Active Record settings (my model ones AND Rapyd ones), so it breaks.
I couldn’t find something like this on the forums.
What do people here think about an optional identifier, like a simple string, that would allow kinds of distinct accesses to $this->db?
After looking at DB_active_rec.php, I had some ideas. If nobody stops me, that’s what I may try in few days:
1) change those vars to be arrays of what they where before
(only four lines to change in the code, but the arrays will not contain the same stuff).
var $ar_select = array();
var $ar_distinct = FALSE;
var $ar_from = array();
var $ar_join = array();
var $ar_where = array();
var $ar_like = array();
var $ar_groupby = array();
var $ar_having = array();
var $ar_limit = FALSE;
var $ar_offset = FALSE;
var $ar_order = FALSE;
var $ar_orderby = array();
var $ar_set = array();
2) add
var $ar_identifier = 'default_id';
3) add a basic setter
function set_identifier( $identifier )
4) change every AR function to affect the param sent right in front of the right identifier.
Then we will be able to do this:
$this->db->set_identifier('my_first_query');
$this->db->from('blabla');
$this->db->where('blibli');
$this->db->set_identifier('my_second_query');
$this->db->from('tatata');
$this->db->where('tititi');
$this->db->set_identifier('my_first_query');
$first_query = $this->db->get();
$this->db->set_identifier('my_second_query');
$second_query = $this->db->get();
Any comments?
