Welcome Guest, Not a member yet? Register   Sign In
CI 1.7 Output->enable_profiler(TRUE); "Database driver is not currently loaded"
#1

[eluser]Jon Parker[/eluser]
Hi guys - First post for anything like this so I apologize in advance if it's just me being stupid but I've tried a few things and still can't seem to fix things so I'm guessing it could be a bug


I have the following controller:
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Home extends Controller {

    function Home() {
        parent::Controller();
        $data['this_page'] = 'home';
    }

    function index()
    {
        $data['this_page'] = 'home';
        $this->load->view('template',$data);
    }
    
    function test()
    {
        $this->load->database();
        
        $this->db->from('cats');
        $query = $this->db->get();
        
        printr($query->result());
        
        $this->output->enable_profiler(TRUE);
    }

}
(printr() is my own function not a typo)

When I run the test function, i get the list of categories as expected output to the browser with some of the profiler information, but in the database box, it just says: "Database driver is not currently loaded"

Now I'm guessing that the driver is loaded otherwise I wouldn't be able to run a query?

This is happening with the 1.7.0 download and the SVN trunk files.

I've tested with 1.5.4 and up but 1.6.2 is the last version it works with

I'm running PHP 4.4.7 and using mySQL version 5.4.45 (if this makes any difference?)

Cheers

Jon Smile
#2

[eluser]fafworx[/eluser]
hi jon,

have the same problem with profiling in 1.7.
maybe an internal bug...
will check the bugreports for that.
#3

[eluser]Jon Parker[/eluser]
Just to let you know, I tried with PHP 5 today and it all worked fine

Cheers

Jon Smile
#4

[eluser]ChrisMiller[/eluser]
I have the same problem with PHP4, the profiler worked fine in the last version but when I upgraded the system its giving the same message as you.
#5

[eluser]Unknown[/eluser]
I get the very same error message after upgrading to CI 1.7 - but tracked the problem down to where in the -Profiler.php- library the currently connected databases are checked (in function _compile_queries).

If the $dbs array is empty (counter evaluates to 0) CI concludes that there are no existing database connections!
That this can happen when a connection is already established (in a perfectly running system) is -of course- an error and should be fixed by the CI developers ...

q.
#6

[eluser]Maglok[/eluser]
Sorry for bumping this, but I am running into this bug.

On the bug tracker someone posted a reply:

Code:
Bugfix:
Open \system\libraries\Profiler.php
Find line 110 and replace this:
if ( is_subclass_of(get_class($CI_object), ‘CI_DB’) )
with this:
if ( strtoupper(get_parent_class(get_class($CI_object))) == ‘CI_DB’ )

This does NOT work. Is there another workaround? I really want my profiler to get me to show my queries badly. Smile
#7

[eluser]jeephnx[/eluser]
[quote author="Maglok" date="1245761566"]Sorry for bumping this, but I am running into this bug.

On the bug tracker someone posted a reply:

Code:
Bugfix:
Open \system\libraries\Profiler.php
Find line 110 and replace this:
if ( is_subclass_of(get_class($CI_object), ‘CI_DB’) )
with this:
if ( strtoupper(get_parent_class(get_class($CI_object))) == ‘CI_DB’ )

This does NOT work. Is there another workaround? I really want my profiler to get me to show my queries badly. Smile[/quote]

Hi Maglok
I had the same problem and found that the bug fix is correct BUT you must ensure that the quotes around 'CI_DB' are normal single quotes - not the smart quotes the text editor has inserted.
#8

[eluser]jeephnx[/eluser]
found that 1.7.2 still has this problem, but works on my build by changing system/libraries/Profiler.php line 110


Code:
//if (is_object($CI_object) && is_subclass_of(get_class($CI_object), 'CI_DB') )
//change to this to get the queries showing in profiler 1.7.2
if (is_object($CI_object) && strtoupper(get_parent_class(get_class($CI_object))) == 'CI_DB' )




Theme © iAndrew 2016 - Forum software by © MyBB