Welcome Guest, Not a member yet? Register   Sign In
ActiveRecord Debugging Library
#11

[eluser]Phil Sturgeon[/eluser]
Updated the code im using in the first post. I am getting this error:

Quote:A PHP Error was encountered

Severity: Warning

Message: Missing argument 1 for CI_DB_driver::CI_DB_driver(), called in /Users/phil/Sites/pyrocms/application/libraries/Loader.php on line 1065 and defined

Filename: database/DB_driver.php

Line Number: 81

Need to find a way to extend the activerecord class properly as CI_DB_driver is not being loaded with the correct params provided to it by DB() in /system/database/DB.php.

Ideas?
#12

[eluser]Natebot[/eluser]
well, you can get a little further with the following:

In your controller, pass the database config settings to the library:
Code:
// a helper instead of a require line would be nice...
require(APPPATH.'config/database'.EXT);
$this->load->library('db_debug', $db[$active_group] );

In your library definition expect the parameters in a constructor
Code:
function DB_debug($params)
{
        parent::CI_DB_active_record($params);      
}

But that creates another DB connection right?

This will at least get the run() method to work but I'm getting the following for query():
Quote:Fatal error: Call to undefined method DB_debug::_escape_identifiers() in /system/database/DB_driver.php on line 1323

I'm curious how
Code:
$this->db->select('something');
$this->db_debug->get('table');
should work. Are they actually accessing the same $sql property value?

As an aside might you might wish DB_debug to extend CI_DB because it is a wrapper that extends the active record class or the base DB_driver class depending on the configuration settings.
#13

[eluser]Phil Sturgeon[/eluser]
Yea that was the idea. I could get another db connection running (or a seperate AR instance for $this->db_debug) but I want it to extend the library to share its properties.

It's raining today and im broke so once I have finished my REST and Caching library improvements I will try replacing the DB() function with a library that should allow extention of the existing AR class.




Theme © iAndrew 2016 - Forum software by © MyBB