Fossil

Check-in [e275546215]
Login

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

Overview
Comment:Refactor db_close() so that it can make use of db_close_config().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | dbCloseConfig
Files: files | file ages | folders
SHA1: e2755462150dbbaf2f621fb5dcf8d34fc653fc72
User & Date: mistachkin 2014-06-14 21:52:51.409
Context
2014-06-15
00:41
Merge updates from trunk. check-in: 9f3dd72d93 user: mistachkin tags: dbCloseConfig
2014-06-14
21:52
Refactor db_close() so that it can make use of db_close_config(). check-in: e275546215 user: mistachkin tags: dbCloseConfig
21:49
Several minor code style fixes involving spacing. check-in: c7f5541b7d user: mistachkin tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/db.c.
793
794
795
796
797
798
799

800
801
802
803
804

805
806
807
808
809
810
811
*/
void db_close_config(){
  if( g.useAttach ){
    db_detach("configdb");
    g.useAttach = 0;
    g.zConfigDbName = 0;
  }else if( g.dbConfig ){

    sqlite3_close(g.dbConfig);
    g.dbConfig = 0;
    g.zConfigDbType = 0;
    g.zConfigDbName = 0;
  }else if( g.db && fossil_strcmp(g.zMainDbType, "configdb")==0 ){

    sqlite3_close(g.db);
    g.db = 0;
    g.zMainDbType = 0;
    g.zConfigDbName = 0;
  }
}








>





>







793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
*/
void db_close_config(){
  if( g.useAttach ){
    db_detach("configdb");
    g.useAttach = 0;
    g.zConfigDbName = 0;
  }else if( g.dbConfig ){
    sqlite3_wal_checkpoint(g.dbConfig, 0);
    sqlite3_close(g.dbConfig);
    g.dbConfig = 0;
    g.zConfigDbType = 0;
    g.zConfigDbName = 0;
  }else if( g.db && fossil_strcmp(g.zMainDbType, "configdb")==0 ){
    sqlite3_wal_checkpoint(g.db, 0);
    sqlite3_close(g.db);
    g.db = 0;
    g.zMainDbType = 0;
    g.zConfigDbName = 0;
  }
}

1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242



1243
1244

1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
  db_end_transaction(1);
  pStmt = 0;
  if( reportErrors ){
    while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
      fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
    }
  }
  g.repositoryOpen = 0;
  g.localOpen = 0;
  g.zConfigDbName = NULL;
  sqlite3_wal_checkpoint(g.db, 0);
  sqlite3_close(g.db);
  g.db = 0;
  g.zMainDbType = 0;



  if( g.dbConfig ){
    sqlite3_close(g.dbConfig);

    g.dbConfig = 0;
    g.zConfigDbType = 0;
  }
}


/*
** Create a new empty repository database with the given name.
**
** Only the schema is initialized.  The required VAR tables entries







|
|
<
|
|
|
|
>
>
>
|
<
>
|
|
<







1231
1232
1233
1234
1235
1236
1237
1238
1239

1240
1241
1242
1243
1244
1245
1246
1247

1248
1249
1250

1251
1252
1253
1254
1255
1256
1257
  db_end_transaction(1);
  pStmt = 0;
  if( reportErrors ){
    while( (pStmt = sqlite3_next_stmt(g.db, pStmt))!=0 ){
      fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
    }
  }
  db_close_config();
  if( g.db ){

    sqlite3_wal_checkpoint(g.db, 0);
    sqlite3_close(g.db);
    g.db = 0;
    g.zMainDbType = 0;
  }
  g.repositoryOpen = 0;
  g.localOpen = 0;
  assert( g.dbConfig==0 );

  assert( g.useAttach==0 );
  assert( g.zConfigDbName==0 );
  assert( g.zConfigDbType==0 );

}


/*
** Create a new empty repository database with the given name.
**
** Only the schema is initialized.  The required VAR tables entries