Updates to the extension loading logic to support full coverage testing. (CVS 6659)

FossilOrigin-Name: 929cfbc66f6e2ea6b44417305d0f4ae36567c9bf
This commit is contained in:
drh 2009-05-20 02:40:45 +00:00
parent 43152cf85f
commit 7aaa878619
6 changed files with 29 additions and 24 deletions

View File

@ -1,5 +1,5 @@
C Changes\sto\sselect.c\sto\sfacilitate\sfull\scoverage\stesting.\s(CVS\s6658) C Updates\sto\sthe\sextension\sloading\slogic\sto\ssupport\sfull\scoverage\stesting.\s(CVS\s6659)
D 2009-05-19T19:04:58 D 2009-05-20T02:40:46
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -110,7 +110,7 @@ F src/btree.c 7c4b02afea7efb561361f20408414fec68df898c
F src/btree.h 58d876d3ed944a8f4f1fd0e67024b385243fc9dd F src/btree.h 58d876d3ed944a8f4f1fd0e67024b385243fc9dd
F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5 F src/btreeInt.h df64030d632f8c8ac217ed52e8b6b3eacacb33a5
F src/build.c 2b4cef0dccea8d5ceb34d30b69121590ad2d5314 F src/build.c 2b4cef0dccea8d5ceb34d30b69121590ad2d5314
F src/callback.c bf295cfdc065b56cc49a5f6452126dc4ffe0ff5b F src/callback.c 57359fa93de47c341b6b8ee504a88ff276397686
F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0 F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0
F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3 F src/date.c ab5f7137656652a48434d64f96bdcdc823bb23b3
F src/delete.c a0a0932eea77471ab243337026abbce444024c43 F src/delete.c a0a0932eea77471ab243337026abbce444024c43
@ -124,8 +124,8 @@ F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb
F src/insert.c 050536ea91c6cf74d87a2386b5da241141943c94 F src/insert.c 050536ea91c6cf74d87a2386b5da241141943c94
F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0 F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0
F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0 F src/legacy.c 9a56cf126ceee332b56061bf16bd0fb4ff9e26c0
F src/loadext.c 3f96631089fc4f3871a67f02f2e4fc7ea4d51edc F src/loadext.c a281f9890ce4f8f2b68967a124322c6ae98f1245
F src/main.c 09fbadd5ea3d4f9052d37925a1427f9cb0ee75dc F src/main.c 7b7335c6260f08d9e534df68c0993c0a8c9abb49
F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19 F src/malloc.c 7b3b6423f5b355e5d649b91e16ef252d610bcf19
F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c
F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270 F src/mem1.c e6d5c23941288df8191b8a98c28e3f57771e2270
@ -162,7 +162,7 @@ F src/select.c 88e654ab5b183e4fdb084680b66b5bfa6f214dc5
F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7 F src/shell.c 0a11f831603f17fea20ca97133c0f64e716af4a7
F src/sqlite.h.in 0c459a45c1047be24c6a58646e8be4d001a3a28a F src/sqlite.h.in 0c459a45c1047be24c6a58646e8be4d001a3a28a
F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17
F src/sqliteInt.h 68b1b7aebcbed22d302251a56e85fa1339407db3 F src/sqliteInt.h b4cc76a99bc82894703528376067c743eb27184c
F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d F src/sqliteLimit.h ffe93f5a0c4e7bd13e70cd7bf84cfb5c3465f45d
F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76
F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d
@ -729,7 +729,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
P 1b0ee9d188c000a2331caae2e9c8b89b0bcbc0b0 P f678ed34faab88f4e126e553119773386c7c84fa
R d15b16c16d25d0a15fe74d1aa7c5ea6b R a4ff1e249cdc6a153d70111a90dd62bc
U drh U drh
Z cdf595d21d0d1c681184a9d7037bb48e Z e9babf13c984228aedcd2756c0b1fd97

View File

@ -1 +1 @@
f678ed34faab88f4e126e553119773386c7c84fa 929cfbc66f6e2ea6b44417305d0f4ae36567c9bf

View File

@ -13,7 +13,7 @@
** This file contains functions used to access the internal hash tables ** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences. ** 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" #include "sqliteInt.h"
@ -294,6 +294,7 @@ void sqlite3FuncDefInsert(
int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a); int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a);
pOther = functionSearch(pHash, h, pDef->zName, nName); pOther = functionSearch(pHash, h, pDef->zName, nName);
if( pOther ){ if( pOther ){
assert( pOther!=pDef && pOther->pNext!=pDef );
pDef->pNext = pOther->pNext; pDef->pNext = pOther->pNext;
pOther->pNext = pDef; pOther->pNext = pDef;
}else{ }else{

View File

@ -12,7 +12,7 @@
** This file contains code used to dynamically load extensions into ** This file contains code used to dynamically load extensions into
** the SQLite library. ** 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 #ifndef SQLITE_CORE
@ -355,6 +355,8 @@ static int sqlite3LoadExtension(
char *zErrmsg = 0; char *zErrmsg = 0;
void **aHandle; void **aHandle;
if( pzErrMsg ) *pzErrMsg = 0;
/* Ticket #1863. To avoid a creating security problems for older /* Ticket #1863. To avoid a creating security problems for older
** applications that relink against newer versions of SQLite, the ** applications that relink against newer versions of SQLite, the
** ability to run load_extension is turned off by default. One ** ability to run load_extension is turned off by default. One
@ -429,6 +431,7 @@ int sqlite3_load_extension(
int rc; int rc;
sqlite3_mutex_enter(db->mutex); sqlite3_mutex_enter(db->mutex);
rc = sqlite3LoadExtension(db, zFile, zProc, pzErrMsg); rc = sqlite3LoadExtension(db, zFile, zProc, pzErrMsg);
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex); sqlite3_mutex_leave(db->mutex);
return rc; return rc;
} }
@ -565,20 +568,21 @@ void sqlite3_reset_auto_extension(void){
/* /*
** Load all automatic extensions. ** 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 i;
int go = 1; int go = 1;
int rc = SQLITE_OK;
int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*); int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);
wsdAutoextInit; wsdAutoextInit;
if( wsdAutoext.nExt==0 ){ if( wsdAutoext.nExt==0 ){
/* Common case: early out without every having to acquire a mutex */ /* Common case: early out without every having to acquire a mutex */
return SQLITE_OK; return;
} }
for(i=0; go; i++){ for(i=0; go; i++){
char *zErrmsg = 0; char *zErrmsg;
#if SQLITE_THREADSAFE #if SQLITE_THREADSAFE
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
#endif #endif
@ -591,13 +595,12 @@ int sqlite3AutoLoadExtensions(sqlite3 *db){
wsdAutoext.aExt[i]; wsdAutoext.aExt[i];
} }
sqlite3_mutex_leave(mutex); sqlite3_mutex_leave(mutex);
zErrmsg = 0;
if( xInit && xInit(db, &zErrmsg, &sqlite3Apis) ){ if( xInit && xInit(db, &zErrmsg, &sqlite3Apis) ){
sqlite3Error(db, SQLITE_ERROR, sqlite3Error(db, SQLITE_ERROR,
"automatic extension loading failed: %s", zErrmsg); "automatic extension loading failed: %s", zErrmsg);
go = 0; go = 0;
rc = SQLITE_ERROR;
sqlite3_free(zErrmsg);
} }
sqlite3_free(zErrmsg);
} }
return rc;
} }

View File

@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be ** other files are for internal use by SQLite and should not be
** accessed by users of the library. ** 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" #include "sqliteInt.h"
@ -1664,8 +1664,9 @@ static int openDatabase(
/* Load automatic extensions - extensions that have been registered /* Load automatic extensions - extensions that have been registered
** using the sqlite3_automatic_extension() API. ** using the sqlite3_automatic_extension() API.
*/ */
(void)sqlite3AutoLoadExtensions(db); sqlite3AutoLoadExtensions(db);
if( sqlite3_errcode(db)!=SQLITE_OK ){ rc = sqlite3_errcode(db);
if( rc!=SQLITE_OK ){
goto opendb_out; goto opendb_out;
} }

View File

@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** Internal interface definitions for SQLite. ** 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_ #ifndef _SQLITEINT_H_
#define _SQLITEINT_H_ #define _SQLITEINT_H_
@ -2733,7 +2733,7 @@ void sqlite3Parser(void*, int, Token, Parse*);
int sqlite3ParserStackPeak(void*); int sqlite3ParserStackPeak(void*);
#endif #endif
int sqlite3AutoLoadExtensions(sqlite3*); void sqlite3AutoLoadExtensions(sqlite3*);
#ifndef SQLITE_OMIT_LOAD_EXTENSION #ifndef SQLITE_OMIT_LOAD_EXTENSION
void sqlite3CloseExtensions(sqlite3*); void sqlite3CloseExtensions(sqlite3*);
#else #else