/ Check-in [5908aa4d]
Login

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

Overview
Comment:Enhance the sqlite3_load_extension() interface to permit extensions to return SQLITE_OK_LOAD_PERMANENTLY which will prevents unloading when the database connection closes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5908aa4dc59925c414b236b6fd3d3ecd7f3da435
User & Date: drh 2016-06-03 13:35:55
Context
2016-06-03
18:44
Add support for virtual tables using a WITHOUT ROWID schema. This merge also includes enhancements to the CSV extension, which is used for testing of the new WITHOUT ROWID virtual table mechanism. check-in: aa7e9d0c user: drh tags: trunk
13:35
Enhance the sqlite3_load_extension() interface to permit extensions to return SQLITE_OK_LOAD_PERMANENTLY which will prevents unloading when the database connection closes. check-in: 5908aa4d user: drh tags: trunk
2016-06-01
10:37
Fix an issue preventing RBU vacuum from working with virtual tables. check-in: 3bd85fa5 user: dan tags: trunk
2016-05-28
17:23
Enhance the sqlite3_load_extension() interface to permit extensions to return SQLITE_OK_LOAD_PERMANENTLY which will prevent the extensions from unloading when the database connection closes. Closed-Leaf check-in: d3f99a5e user: drh tags: load-permanently
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/misc/vfsstat.c.

   807    807     SQLITE_EXTENSION_INIT2(pApi);
   808    808     vstat_vfs.pVfs = sqlite3_vfs_find(0);
   809    809     vstat_vfs.base.szOsFile = sizeof(VStatFile) + vstat_vfs.pVfs->szOsFile;
   810    810     rc = sqlite3_vfs_register(&vstat_vfs.base, 1);
   811    811     if( rc==SQLITE_OK ){
   812    812       rc = sqlite3_auto_extension((void(*)(void))vstatRegister);
   813    813     }
          814  +  if( rc==SQLITE_OK ) rc = SQLITE_OK_LOAD_PERMANENTLY;
   814    815     return rc;
   815    816   }

Changes to src/loadext.c.

   442    442     int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);
   443    443     char *zErrmsg = 0;
   444    444     const char *zEntry;
   445    445     char *zAltEntry = 0;
   446    446     void **aHandle;
   447    447     u64 nMsg = 300 + sqlite3Strlen30(zFile);
   448    448     int ii;
          449  +  int rc;
   449    450   
   450    451     /* Shared library endings to try if zFile cannot be loaded as written */
   451    452     static const char *azEndings[] = {
   452    453   #if SQLITE_OS_WIN
   453    454        "dll"   
   454    455   #elif defined(__APPLE__)
   455    456        "dylib"
................................................................................
   544    545         }
   545    546       }
   546    547       sqlite3OsDlClose(pVfs, handle);
   547    548       sqlite3_free(zAltEntry);
   548    549       return SQLITE_ERROR;
   549    550     }
   550    551     sqlite3_free(zAltEntry);
   551         -  if( xInit(db, &zErrmsg, &sqlite3Apis) ){
          552  +  rc = xInit(db, &zErrmsg, &sqlite3Apis);
          553  +  if( rc ){
          554  +    if( rc==SQLITE_OK_LOAD_PERMANENTLY ) return SQLITE_OK;
   552    555       if( pzErrMsg ){
   553    556         *pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg);
   554    557       }
   555    558       sqlite3_free(zErrmsg);
   556    559       sqlite3OsDlClose(pVfs, handle);
   557    560       return SQLITE_ERROR;
   558    561     }

Changes to src/sqlite.h.in.

   502    502   #define SQLITE_CONSTRAINT_UNIQUE       (SQLITE_CONSTRAINT | (8<<8))
   503    503   #define SQLITE_CONSTRAINT_VTAB         (SQLITE_CONSTRAINT | (9<<8))
   504    504   #define SQLITE_CONSTRAINT_ROWID        (SQLITE_CONSTRAINT |(10<<8))
   505    505   #define SQLITE_NOTICE_RECOVER_WAL      (SQLITE_NOTICE | (1<<8))
   506    506   #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
   507    507   #define SQLITE_WARNING_AUTOINDEX       (SQLITE_WARNING | (1<<8))
   508    508   #define SQLITE_AUTH_USER               (SQLITE_AUTH | (1<<8))
          509  +#define SQLITE_OK_LOAD_PERMANENTLY     (SQLITE_OK | (1<<8))
   509    510   
   510    511   /*
   511    512   ** CAPI3REF: Flags For File Open Operations
   512    513   **
   513    514   ** These bit values are intended for use in the
   514    515   ** 3rd parameter to the [sqlite3_open_v2()] interface and
   515    516   ** in the 4th parameter to the [sqlite3_vfs.xOpen] method.