Fossil

Diff
Login

Differences From Artifact [8516ed0b94]:

To Artifact [4ecf8d2904]:


616
617
618
619
620
621
622
623

624
625
626
627
628
629
630
631
632
633
634
635
636
637
616
617
618
619
620
621
622

623
624
625
626
627
628
629

630
631
632
633
634
635
636







-
+






-







** zDbName is the name of a database file.  If no other database
** file is open, then open this one.  If another database file is
** already open, then attach zDbName using the name zLabel.
*/
static void db_open_or_attach(const char *zDbName, const char *zLabel){
  if( !g.db ){
    g.db = openDatabase(zDbName);
    g.zRepoDb = "main";
    g.zMainDbType = zLabel;
    db_connection_init();
  }else{
#if defined(_WIN32)
    zDbName = sqlite3_win32_mbcs_to_utf8(zDbName);
#endif
    db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);
    g.zRepoDb = mprintf("%s", zLabel);
  }
}

/*
** Open the user database in "~/.fossil".  Create the database anew if
** it does not already exist.
**