Fossil

Check-in [a25092b14c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Be sure to call mbcsToUtf8() when opening the global configuration database. Ticket [c7c36ef52edab]
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a25092b14ca85df3635bff9c54958ca91b17081c
User & Date: drh 2009-08-15 21:38:24.000
References
2009-08-15
21:41 Ticket [c7c36ef52e] recent fossil on non English variant of winXP fails to create new repo status still Open with 2 other changes artifact: 99b8395b94 user: drh
Context
2009-08-16
21:22
Cleanup of the "admin_sql" web page (formerly "admin/sql"). check-in: ef432c2014 user: drh tags: trunk
2009-08-15
21:38
Be sure to call mbcsToUtf8() when opening the global configuration database. Ticket [c7c36ef52edab] check-in: a25092b14c user: drh tags: trunk
17:45
Remove obsolete "todo" files. Remove the obsolete src/VERSION file and references to that file in the makefiles. check-in: 137bff8294 user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
627
628
629
630
631
632
633



634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659



660
661
662
663
664
665
666
*/
static sqlite3 *openDatabase(const char *zDbName){
  int rc;
  const char *zVfs;
  sqlite3 *db;

  zVfs = getenv("FOSSIL_VFS");



  rc = sqlite3_open_v2(
       zDbName, &db,
       SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
       zVfs
  );
  if( rc!=SQLITE_OK ){
    db_err(sqlite3_errmsg(db));
  }
  sqlite3_busy_timeout(db, 5000);
  return db;
}


/*
** 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.
*/
void db_open_or_attach(const char *zDbName, const char *zLabel){
#ifdef __MINGW32__
  zDbName = mbcsToUtf8(zDbName);
#endif
  if( !g.db ){
    g.db = openDatabase(zDbName);
    db_connection_init();
  }else{



    db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);
  }
}

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







>
>
>



















<
<
<




>
>
>







627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655



656
657
658
659
660
661
662
663
664
665
666
667
668
669
*/
static sqlite3 *openDatabase(const char *zDbName){
  int rc;
  const char *zVfs;
  sqlite3 *db;

  zVfs = getenv("FOSSIL_VFS");
#ifdef __MINGW32__
  zDbName = mbcsToUtf8(zDbName);
#endif
  rc = sqlite3_open_v2(
       zDbName, &db,
       SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE,
       zVfs
  );
  if( rc!=SQLITE_OK ){
    db_err(sqlite3_errmsg(db));
  }
  sqlite3_busy_timeout(db, 5000);
  return db;
}


/*
** 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.
*/
void db_open_or_attach(const char *zDbName, const char *zLabel){



  if( !g.db ){
    g.db = openDatabase(zDbName);
    db_connection_init();
  }else{
#ifdef __MINGW32__
    zDbName = mbcsToUtf8(zDbName);
#endif
    db_multi_exec("ATTACH DATABASE %Q AS %s", zDbName, zLabel);
  }
}

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