Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

  • S March 2010

Who's Online 19

G_MToddericgillettelucperegrinesandinox00 +12 guests

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)

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...

Comments

Sign In or Register to comment.