Fossil

Check-in [0c1f876e]
Login

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

Overview
Comment:Fix the db_database_slot() routine so that it works ever if the g.db database has been closed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | omit-db_name
Files: files | file ages | folders
SHA1: 0c1f876e78e8f86b3beb803d434d920c3e0af3a2
User & Date: drh 2016-08-19 16:36:47
Context
2016-08-20
18:16
Fix compilation errors when the JSON feature is enabled. check-in: e2f4f1f8 user: mistachkin tags: omit-db_name
2016-08-19
16:36
Fix the db_database_slot() routine so that it works ever if the g.db database has been closed. check-in: 0c1f876e user: drh tags: omit-db_name
16:25
Handle the "-u" option on "fossil all sync". check-in: 5031cb08 user: drh tags: omit-db_name
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/db.c.

985
986
987
988
989
990
991

992
993
994
995
996
997
998
** are slots 2 and higher.
**
** Return -1 if zLabel does not match any open database.
*/
int db_database_slot(const char *zLabel){
  int iSlot = -1;
  Stmt q;

  db_prepare(&q, "PRAGMA database_list");
  while( db_step(&q)==SQLITE_ROW ){
    if( fossil_strcmp(db_column_text(&q,1),zLabel)==0 ){
      iSlot = db_column_int(&q, 0);
      break;
    }
  }







>







985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
** are slots 2 and higher.
**
** Return -1 if zLabel does not match any open database.
*/
int db_database_slot(const char *zLabel){
  int iSlot = -1;
  Stmt q;
  if( g.db==0 ) return -1;
  db_prepare(&q, "PRAGMA database_list");
  while( db_step(&q)==SQLITE_ROW ){
    if( fossil_strcmp(db_column_text(&q,1),zLabel)==0 ){
      iSlot = db_column_int(&q, 0);
      break;
    }
  }