![]() |
switching database for use with $this->load->dbutil(); - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: switching database for use with $this->load->dbutil(); (/showthread.php?tid=12157) |
switching database for use with $this->load->dbutil(); - El Forum - 10-08-2008 [eluser]matt2012[/eluser] im trying to backup a database but the dbutil seems to use the default group how do I get it to use another database group. Code: $this->load->database($group, TRUE); Its working in that im getting a database downloaded but not using $group rather 'default_group'; switching database for use with $this->load->dbutil(); - El Forum - 10-08-2008 [eluser]Randy Casburn[/eluser] [quote author="matt2012" date="1223500736"]im trying to backup a database but the dbutil seems to use the default group how do I get it to use another database group. Code: $this->load->database($group, TRUE); Its working in that im getting a database downloaded but not using $group rather 'default_group';[/quote] Right, try... Code: $myDbHandle = $this->load->database($group, TRUE); Randy switching database for use with $this->load->dbutil(); - El Forum - 10-08-2008 [eluser]matt2012[/eluser] Code: $db1 = $this->load->database($group, TRUE); I get Code: Message: Undefined property: Backup::$db1 switching database for use with $this->load->dbutil(); - El Forum - 10-08-2008 [eluser]Randy Casburn[/eluser] Right...that's because I was wrong. Sorry. Bad news. I looked at the code for the DB utils class and it reads your database.php default_group setting out of the config file and completely ignores any loaded databases. Therefore, you cannot backup any database that is not currently set as the default_group in the database.php config file. The relevant code is on line 40 of DB_utils.php which makes reference to $CI->db that is set between lines 32 & 47 of DB.php. I recommend you create your own work around or recommend a change to the core. They will take this up if it makes a difference to the community. I will tell you from experience that multiple database issues don't get a lot of visibility. I'm not sure why. Most likely few of us are actually stressing that test I suppose. Sorry for the bad news. Randy |