Change database prefix (connection) on the fly

I want make model (database) or perhaps sqldriver which will do quries for old database of old site with advantages of Garden cha
How is better to do that?
Now I use this construction (in some model)
Any other solutions?
I cant do Put() chain queries...
How is better to do that?
Now I use this construction (in some model)
public function OldGetID(){
Gdn::Database()->DatabasePrefix = 'olddb.oldprefix_';
$Result = $this->SQL
->Select()
->From('old_table t1')
->Join('old_table2 t2')
->Get();
Gdn::Database()->DatabasePrefix = Gdn::Config('Database.DatabasePrefix');
return $Result;
}
Any other solutions?
I cant do Put() chain queries...
0
Comments