• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
active_group, dbforge, adding tables to secondary database

#1
[eluser]abstraktron[/eluser]
Hi,

I have an issue with using multiple databases. I am trying to add tables to my second database, but since my primary db is my active_group, dbforge is adding the tables to my primary database instead.

How do I change active_group during execution? or, Is there an easier way to have dbforge act upon my second database?

Thanks in advance!

A.

#2
[eluser]abstraktron[/eluser]
This is how I approached it.

Code:
//create a db connection
$dbc = $this->load->database($config, true);
            
//save main db instance
$db = $this->db;

//change active database to new connection
$this->db = $dbc;
        
//do the deed
$this->mylib->myfunction();
            
//return the main db instance to previous state
$this->db = $db;

It works but feels like a hack, is there a better way to do this?

A.

#3
[eluser]abstraktron[/eluser]
Hi, Again,

My development has taken me further down the line and I'm realizing that dbforge is missing some rather important things (ie, what storge engine to create the table in). My question above regarding the second database and hot swapping the db object is still a question that I would like someones opinion on, but perhaps someone could also tell me what would be the best way to extend dbforge.

Thanks in advance.

-A


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.