Welcome Guest, Not a member yet? Register   Sign In
[Oracle + Active Record] Reset queries
#1

[eluser]Unknown[/eluser]
Hallo,
I'm working on CI 1.5.4, *nix server, Oracle db.
I'm having a strange bug with Active Record.
Let's say I have a model called myNewModel with this 2 methods:

Code:
function getFirstArray(){
    
    $myFirstArray = array();
    $this->db->select('*');
    $this->db->from('firstTable');
    $this->db->orderby("myOrderField", "desc");
    $query = $this->db->get();
    $myFirstArray = $query->result_array();
    $query->free_result();
        
    return $myFirstArray;
    
}

function getSecondArray(){
    
    $mySecondArray = array();
    $this->db->select('*');
    $this->db->from('secondTable');
    $this->db->orderby("myOtherOrderField", "desc");
    $query = $this->db->get();
    $mySecondArray = $query->result_array();
    $query->free_result();
        
    return $mySecondArray;
    
}

First method gets a long list of stuff (articles i.e.).
Second method gets a list of 3 items (category i.e.).

When I call from my controller:

Code:
$myFirstArray = $this->myNewModel->getFirstArray();
$mySecondArray= $this->myNewModel->getSecondArray();

to pass data to the view, $myFirstArray is filled up with lots of records, and $mySecondArray has the same contents.
It seems like if CI has executed first query again (query executed and freeed in method getFirstArray() ) without resetting queries object, ignoring my second query ( in method getSecondArray() ).

I printed $this->db to screen from within the second method, and the object CI_DB_oci8_driver->queries has 2 queries in it.

I have $db["cache_on"] set to FALSE, anyway I tried to force cache delete and cache off before preparing select with active record, nothing to do... :-(

Somebody had my same problem?
I had a look in the forum search but didn't find anything...

thanks in advance to everybody
Alex


Messages In This Thread
[Oracle + Active Record] Reset queries - by El Forum - 08-07-2007, 07:00 AM
[Oracle + Active Record] Reset queries - by El Forum - 08-26-2007, 11:59 PM
[Oracle + Active Record] Reset queries - by El Forum - 10-25-2007, 03:28 PM
[Oracle + Active Record] Reset queries - by El Forum - 10-25-2007, 03:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB