aboutsummaryrefslogtreecommitdiff
path: root/src/loadext.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-08-02 20:44:48 +0000
committerdrh <drh@noemail.net>2013-08-02 20:44:48 +0000
commit7fb30bd0dd4057c203415b7d1d0fe0a15e25a8f7 (patch)
treedd7ab4cd95b8b32df8e8f92df1ed4234744c2da1 /src/loadext.c
parent6f855952d07e32967b84c790201da4b45d849722 (diff)
parente0c7efd9ae6706b5e39093bcf2256569032c2b91 (diff)
downloadsqlite-7fb30bd0dd4057c203415b7d1d0fe0a15e25a8f7.tar.gz
sqlite-7fb30bd0dd4057c203415b7d1d0fe0a15e25a8f7.zip
Merge in the latest trunk changes, including partial indexes, the MAX_PATH
fix in os_win.c, and the sqlite3_cancel_auto_extension() API. FossilOrigin-Name: 7e1acb390770d1bd189fac7a3a7f96106f96e3a4
Diffstat (limited to 'src/loadext.c')
-rw-r--r--src/loadext.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/loadext.c b/src/loadext.c
index cdcf6a93b..828e865b6 100644
--- a/src/loadext.c
+++ b/src/loadext.c
@@ -669,6 +669,35 @@ int sqlite3_auto_extension(void (*xInit)(void)){
}
/*
+** Cancel a prior call to sqlite3_auto_extension. Remove xInit from the
+** set of routines that is invoked for each new database connection, if it
+** is currently on the list. If xInit is not on the list, then this
+** routine is a no-op.
+**
+** Return 1 if xInit was found on the list and removed. Return 0 if xInit
+** was not on the list.
+*/
+int sqlite3_cancel_auto_extension(void (*xInit)(void)){
+#if SQLITE_THREADSAFE
+ sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
+#endif
+ int i;
+ int n = 0;
+ wsdAutoextInit;
+ sqlite3_mutex_enter(mutex);
+ for(i=wsdAutoext.nExt-1; i>=0; i--){
+ if( wsdAutoext.aExt[i]==xInit ){
+ wsdAutoext.nExt--;
+ wsdAutoext.aExt[i] = wsdAutoext.aExt[wsdAutoext.nExt];
+ n++;
+ break;
+ }
+ }
+ sqlite3_mutex_leave(mutex);
+ return n;
+}
+
+/*
** Reset the automatic extension loading mechanism.
*/
void sqlite3_reset_auto_extension(void){