Fossil

Check-in [a12d7122]
Login

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

Overview
Comment:Slightly improve clarity of the db_database_slot() function.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | omit-db_name
Files: files | file ages | folders
SHA1: a12d712203e055c6b9864c2c80e509efd91f437a
User & Date: mistachkin 2016-08-22 02:22:59
Context
2016-08-22
20:12
Remove the db_name() function. In its place, the SQLITE_DBCONFIG_MAINDBNAME feature of SQLite is used to ensure that the three attached databases are always exactly named "repository", "configdb" and "localdb", regardless of which is opened first or the order in which they are attached. Update to the latest 3.15 alpha of SQLite which is now required for correct operation, since SQLITE_DBCONFIG_MAINDBNAME is required. check-in: 06aec611 user: drh tags: trunk
02:22
Slightly improve clarity of the db_database_slot() function. Closed-Leaf check-in: a12d7122 user: mistachkin tags: omit-db_name
2016-08-21
02:17
Fix the code in db_open_config() that checks the current 'attachment mode' for the configuration database against the requested one. check-in: 569f4b0e user: mistachkin 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
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;
    }
  }







|







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 iSlot;
  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;
    }
  }