Change database prefix (connection) on the fly
  • SS
    Posts: 454
    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...
  • SS
    Posts: 454
    Bump.
  • SS
    Posts: 454
    Maybe @Todd helps?

Howdy, Stranger!

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

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

In this Discussion

  • S March 2010

Who's Online 4

Raizeercatlipaintballer82422