]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Updates to the extension loading logic to support full coverage testing. (CVS 6659)
authordrh <drh@noemail.net>
Wed, 20 May 2009 02:40:45 +0000 (02:40 +0000)
committerdrh <drh@noemail.net>
Wed, 20 May 2009 02:40:45 +0000 (02:40 +0000)
FossilOrigin-Name: 929cfbc66f6e2ea6b44417305d0f4ae36567c9bf

manifest
manifest.uuid
src/callback.c
src/loadext.c
src/main.c
src/sqliteInt.h

index f18e30309fe317762a85867c23e2cd1c8771d864..1b05642d43a4bdf74520f724c27b64b7e8d7e84b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Changes\sto\sselect.c\sto\sfacilitate\sfull\scoverage\stesting.\s(CVS\s6658)
-D 2009-05-19T19:04:58
+C Updates\sto\sthe\sextension\sloading\slogic\sto\ssupport\sfull\scoverage\stesting.\s(CVS\s6659)
+D 2009-05-20T02:40:46
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -110,7 +110,7 @@ F src/btree.c 7c4b02afea7efb561361f20408414fec68df898c
 F src/btree.h 58d876d3ed944a8f4f1fd0e67024b385243fc9dd
 F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
 F src/build.c 2b4cef0dccea8d5ceb34d30b69121590ad2d5314
-F src/callback.c bf295cfdc065b56cc49a5f6452126dc4ffe0ff5b
+F src/callback.c 57359fa93de47c341b6b8ee504a88ff276397686
 F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
 F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
 F src/delete.c a0a0932eea77471ab243337026abbce444024c43
@@ -124,8 +124,8 @@ F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
 F src/insert.c 050536ea91c6cf74d87a2386b5da241141943c94
 F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
 F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0
-F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc
-F src/main.c 09fbadd5ea3d4f9052d37925a1427f9cb0ee75dc
+F src/loadext.c a281f9890ce4f8f2b68967a124322c6ae98f1245
+F src/main.c 7b7335c6260f08d9e534df68c0993c0a8c9abb49
 F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19
 F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
 F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
@@ -162,7 +162,7 @@ F src/select.c 88e654ab5b183e4fdb084680b66b5bfa6f214dc5
 F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
 F src/sqlite.h.in 0c459a45c1047be24c6a58646e8be4d001a3a28a
 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
-F src/sqliteInt.h 68b1b7aebcbed22d302251a56e85fa1339407db3
+F src/sqliteInt.h b4cc76a99bc82894703528376067c743eb27184c
 F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
 F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d
@@ -729,7 +729,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 1b0ee9d188c000a2331caae2e9c8b89b0bcbc0b0
-R d15b16c16d25d0a15fe74d1aa7c5ea6b
+P f678ed34faab88f4e126e553119773386c7c84fa
+R a4ff1e249cdc6a153d70111a90dd62bc
 U drh
-Z cdf595d21d0d1c681184a9d7037bb48e
+Z e9babf13c984228aedcd2756c0b1fd97
index 55a4fcc39989b9b1242000710f427a7875ce6780..5d39f554114d5bd46c738401495bf5e8e675969c 100644 (file)
@@ -1 +1 @@
-f678ed34faab88f4e126e553119773386c7c84fa
\ No newline at end of file
+929cfbc66f6e2ea6b44417305d0f4ae36567c9bf
\ No newline at end of file
index 3f75760ac46a7b06c32d16a229da30370742e962..9890155e4878fe8423e62e62822aadbef86c6ad4 100644 (file)
@@ -13,7 +13,7 @@
 ** This file contains functions used to access the internal hash tables
 ** of user defined functions and collation sequences.
 **
-** $Id: callback.c,v 1.40 2009/05/11 20:53:29 drh Exp $
+** $Id: callback.c,v 1.41 2009/05/20 02:40:46 drh Exp $
 */
 
 #include "sqliteInt.h"
@@ -294,6 +294,7 @@ void sqlite3FuncDefInsert(
   int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a);
   pOther = functionSearch(pHash, h, pDef->zName, nName);
   if( pOther ){
+    assert( pOther!=pDef && pOther->pNext!=pDef );
     pDef->pNext = pOther->pNext;
     pOther->pNext = pDef;
   }else{
index 0a1d1550ca660b4d7d09f52619bab04d55f83952..0c1b5dd6acc614d48717e5ab64db242ef9baed92 100644 (file)
@@ -12,7 +12,7 @@
 ** This file contains code used to dynamically load extensions into
 ** the SQLite library.
 **
-** $Id: loadext.c,v 1.58 2009/01/20 16:53:40 danielk1977 Exp $
+** $Id: loadext.c,v 1.59 2009/05/20 02:40:46 drh Exp $
 */
 
 #ifndef SQLITE_CORE
@@ -355,6 +355,8 @@ static int sqlite3LoadExtension(
   char *zErrmsg = 0;
   void **aHandle;
 
+  if( pzErrMsg ) *pzErrMsg = 0;
+
   /* Ticket #1863.  To avoid a creating security problems for older
   ** applications that relink against newer versions of SQLite, the
   ** ability to run load_extension is turned off by default.  One
@@ -429,6 +431,7 @@ int sqlite3_load_extension(
   int rc;
   sqlite3_mutex_enter(db->mutex);
   rc = sqlite3LoadExtension(db, zFile, zProc, pzErrMsg);
+  rc = sqlite3ApiExit(db, rc);
   sqlite3_mutex_leave(db->mutex);
   return rc;
 }
@@ -565,20 +568,21 @@ void sqlite3_reset_auto_extension(void){
 
 /*
 ** Load all automatic extensions.
+**
+** If anything goes wrong, set an error in the database connection.
 */
-int sqlite3AutoLoadExtensions(sqlite3 *db){
+void sqlite3AutoLoadExtensions(sqlite3 *db){
   int i;
   int go = 1;
-  int rc = SQLITE_OK;
   int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);
 
   wsdAutoextInit;
   if( wsdAutoext.nExt==0 ){
     /* Common case: early out without every having to acquire a mutex */
-    return SQLITE_OK;
+    return;
   }
   for(i=0; go; i++){
-    char *zErrmsg = 0;
+    char *zErrmsg;
 #if SQLITE_THREADSAFE
     sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
 #endif
@@ -591,13 +595,12 @@ int sqlite3AutoLoadExtensions(sqlite3 *db){
               wsdAutoext.aExt[i];
     }
     sqlite3_mutex_leave(mutex);
+    zErrmsg = 0;
     if( xInit && xInit(db, &zErrmsg, &sqlite3Apis) ){
       sqlite3Error(db, SQLITE_ERROR,
             "automatic extension loading failed: %s", zErrmsg);
       go = 0;
-      rc = SQLITE_ERROR;
-      sqlite3_free(zErrmsg);
     }
+    sqlite3_free(zErrmsg);
   }
-  return rc;
 }
index eeb46cdcaf8dd5e9992fa550908b43345b120374..68f76d7c7777a9d6e6c0abafc4f436d8bdf29378 100644 (file)
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.552 2009/05/12 13:35:12 drh Exp $
+** $Id: main.c,v 1.553 2009/05/20 02:40:46 drh Exp $
 */
 #include "sqliteInt.h"
 
@@ -1664,8 +1664,9 @@ static int openDatabase(
   /* Load automatic extensions - extensions that have been registered
   ** using the sqlite3_automatic_extension() API.
   */
-  (void)sqlite3AutoLoadExtensions(db);
-  if( sqlite3_errcode(db)!=SQLITE_OK ){
+  sqlite3AutoLoadExtensions(db);
+  rc = sqlite3_errcode(db);
+  if( rc!=SQLITE_OK ){
     goto opendb_out;
   }
 
index e141c928c39814261fd875ff35e802c0ef4e1487..da3f092863b9a5e7b39c1d309677242727c6788c 100644 (file)
@@ -11,7 +11,7 @@
 *************************************************************************
 ** Internal interface definitions for SQLite.
 **
-** @(#) $Id: sqliteInt.h,v 1.874 2009/05/19 14:21:29 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.875 2009/05/20 02:40:46 drh Exp $
 */
 #ifndef _SQLITEINT_H_
 #define _SQLITEINT_H_
@@ -2733,7 +2733,7 @@ void sqlite3Parser(void*, int, Token, Parse*);
   int sqlite3ParserStackPeak(void*);
 #endif
 
-int sqlite3AutoLoadExtensions(sqlite3*);
+void sqlite3AutoLoadExtensions(sqlite3*);
 #ifndef SQLITE_OMIT_LOAD_EXTENSION
   void sqlite3CloseExtensions(sqlite3*);
 #else