SQLite

Check-in [ec8ff892ac]
Login

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

Overview
Comment:Simplification to the error handling to extension loading in sqlite3_open().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ec8ff892ac9c6a8f81bcf69f1933f4bb69faa743
User & Date: drh 2017-02-04 20:15:51.171
References
2017-02-07
03:44
Back out [ec8ff892ac] which is causing missed OOM errors on some tests. (check-in: 0611770d6a user: drh tags: trunk)
Context
2017-02-07
03:44
Back out [ec8ff892ac] which is causing missed OOM errors on some tests. (check-in: 0611770d6a user: drh tags: trunk)
2017-02-06
01:19
Remove incorrect testcase() macros from R-Tree. (check-in: 853a58a75e user: drh tags: trunk)
2017-02-04
20:15
Simplification to the error handling to extension loading in sqlite3_open(). (check-in: ec8ff892ac user: drh tags: trunk)
17:33
Allow sqlite3session_apply() to apply changesets to tables that have been extended using ALTER TABLE ADD COLUMN. (check-in: b20ff81ff9 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995


2996
2997
2998
2999
3000
3001
3002
3003
3004
3005

  /* Load automatic extensions - extensions that have been registered
  ** using the sqlite3_automatic_extension() API.
  */
  if( rc==SQLITE_OK ){
    sqlite3AutoLoadExtensions(db);
    rc = sqlite3_errcode(db);
    if( rc!=SQLITE_OK ){
      goto opendb_out;
    }
  }



#ifdef SQLITE_ENABLE_FTS1
  if( !db->mallocFailed ){
    extern int sqlite3Fts1Init(sqlite3*);
    rc = sqlite3Fts1Init(db);
  }
#endif

#ifdef SQLITE_ENABLE_FTS2
  if( !db->mallocFailed && rc==SQLITE_OK ){







<
<
|
|
>
>


|







2985
2986
2987
2988
2989
2990
2991


2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005

  /* Load automatic extensions - extensions that have been registered
  ** using the sqlite3_automatic_extension() API.
  */
  if( rc==SQLITE_OK ){
    sqlite3AutoLoadExtensions(db);
    rc = sqlite3_errcode(db);


  }

  testcase( rc!=SQLITE_OK && rc!=SQLITE_NOMEM );
  testcase( rc!=SQLITE_OK && !db->mallocFailed );

#ifdef SQLITE_ENABLE_FTS1
  if( !db->mallocFailed && rc==SQLITE_OK ){
    extern int sqlite3Fts1Init(sqlite3*);
    rc = sqlite3Fts1Init(db);
  }
#endif

#ifdef SQLITE_ENABLE_FTS2
  if( !db->mallocFailed && rc==SQLITE_OK ){
3034
3035
3036
3037
3038
3039
3040

3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057

3058
3059
3060
3061
3062
3063
3064

#ifdef SQLITE_ENABLE_JSON1
  if( !db->mallocFailed && rc==SQLITE_OK){
    rc = sqlite3Json1Init(db);
  }
#endif


  /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking
  ** mode.  -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking
  ** mode.  Doing nothing at all also makes NORMAL the default.
  */
#ifdef SQLITE_DEFAULT_LOCKING_MODE
  db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;
  sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
                          SQLITE_DEFAULT_LOCKING_MODE);
#endif

  if( rc ) sqlite3Error(db, rc);

  /* Enable the lookaside-malloc subsystem */
  setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,
                        sqlite3GlobalConfig.nLookaside);

  sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT);


opendb_out:
  if( db ){
    assert( db->mutex!=0 || isThreadsafe==0
           || sqlite3GlobalConfig.bFullMutex==0 );
    sqlite3_mutex_leave(db->mutex);
  }







>
|
|
|
|

|
|
|


<
<
|
|
|

|
>







3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051


3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064

#ifdef SQLITE_ENABLE_JSON1
  if( !db->mallocFailed && rc==SQLITE_OK){
    rc = sqlite3Json1Init(db);
  }
#endif

  if( rc==SQLITE_OK ){
    /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking
    ** mode.  -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking
    ** mode.  Doing nothing at all also makes NORMAL the default.
    */
#ifdef SQLITE_DEFAULT_LOCKING_MODE
    db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;
    sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
                            SQLITE_DEFAULT_LOCKING_MODE);
#endif



    /* Enable the lookaside-malloc subsystem */
    setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside,
                          sqlite3GlobalConfig.nLookaside);

    sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT);
  }

opendb_out:
  if( db ){
    assert( db->mutex!=0 || isThreadsafe==0
           || sqlite3GlobalConfig.bFullMutex==0 );
    sqlite3_mutex_leave(db->mutex);
  }