sync up our in tree sqlite with the 3.3.13 official release. Commit to follow to finish this process on the windows build.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4351 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2007-02-22 22:09:42 +00:00
parent 64133ab31a
commit 5791353cec
118 changed files with 15152 additions and 1229 deletions

View File

@@ -75,6 +75,20 @@
# define sqlite3_declare_vtab 0
#endif
#ifdef SQLITE_OMIT_SHARED_CACHE
# define sqlite3_enable_shared_cache 0
#endif
#ifdef SQLITE_OMIT_TRACE
# define sqlite3_profile 0
# define sqlite3_trace 0
#endif
#ifdef SQLITE_OMIT_GET_TABLE
# define sqlite3_free_table 0
# define sqlite3_get_table 0
#endif
/*
** The following structure contains pointers to all SQLite API routines.
** A pointer to this structure is passed into extensions when they are
@@ -154,7 +168,7 @@ const sqlite3_api_routines sqlite3_apis = {
sqlite3_get_autocommit,
sqlite3_get_auxdata,
sqlite3_get_table,
sqlite3_global_recover,
0, /* Was sqlite3_global_recover(), but that function is deprecated */
sqlite3_interrupt,
sqlite3_last_insert_rowid,
sqlite3_libversion,
@@ -217,28 +231,6 @@ const sqlite3_api_routines sqlite3_apis = {
sqlite3_overload_function,
};
/*
** The windows implementation of shared-library loaders
*/
#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || defined(__BORLANDC__)
# include <windows.h>
# define SQLITE_LIBRARY_TYPE HANDLE
# define SQLITE_OPEN_LIBRARY(A) LoadLibrary(A)
# define SQLITE_FIND_SYMBOL(A,B) GetProcAddress(A,B)
# define SQLITE_CLOSE_LIBRARY(A) FreeLibrary(A)
#endif /* windows */
/*
** The unix implementation of shared-library loaders
*/
#if defined(HAVE_DLOPEN) && !defined(SQLITE_LIBRARY_TYPE)
# include <dlfcn.h>
# define SQLITE_LIBRARY_TYPE void*
# define SQLITE_OPEN_LIBRARY(A) dlopen(A, RTLD_NOW | RTLD_GLOBAL)
# define SQLITE_FIND_SYMBOL(A,B) dlsym(A,B)
# define SQLITE_CLOSE_LIBRARY(A) dlclose(A)
#endif
/*
** Attempt to load an SQLite extension library contained in the file
** zFile. The entry point is zProc. zProc may be 0 in which case a
@@ -257,11 +249,10 @@ int sqlite3_load_extension(
const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */
char **pzErrMsg /* Put error message here if not 0 */
){
#ifdef SQLITE_LIBRARY_TYPE
SQLITE_LIBRARY_TYPE handle;
void *handle;
int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);
char *zErrmsg = 0;
SQLITE_LIBRARY_TYPE *aHandle;
void **aHandle;
/* Ticket #1863. To avoid a creating security problems for older
** applications that relink against newer versions of SQLite, the
@@ -280,7 +271,7 @@ int sqlite3_load_extension(
zProc = "sqlite3_extension_init";
}
handle = SQLITE_OPEN_LIBRARY(zFile);
handle = sqlite3OsDlopen(zFile);
if( handle==0 ){
if( pzErrMsg ){
*pzErrMsg = sqlite3_mprintf("unable to open shared library [%s]", zFile);
@@ -288,20 +279,20 @@ int sqlite3_load_extension(
return SQLITE_ERROR;
}
xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))
SQLITE_FIND_SYMBOL(handle, zProc);
sqlite3OsDlsym(handle, zProc);
if( xInit==0 ){
if( pzErrMsg ){
*pzErrMsg = sqlite3_mprintf("no entry point [%s] in shared library [%s]",
zProc, zFile);
}
SQLITE_CLOSE_LIBRARY(handle);
sqlite3OsDlclose(handle);
return SQLITE_ERROR;
}else if( xInit(db, &zErrmsg, &sqlite3_apis) ){
if( pzErrMsg ){
*pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg);
}
sqlite3_free(zErrmsg);
SQLITE_CLOSE_LIBRARY(handle);
sqlite3OsDlclose(handle);
return SQLITE_ERROR;
}
@@ -317,14 +308,8 @@ int sqlite3_load_extension(
sqliteFree(db->aExtension);
db->aExtension = aHandle;
((SQLITE_LIBRARY_TYPE*)db->aExtension)[db->nExtension-1] = handle;
db->aExtension[db->nExtension-1] = handle;
return SQLITE_OK;
#else
if( pzErrMsg ){
*pzErrMsg = sqlite3_mprintf("extension loading is disabled");
}
return SQLITE_ERROR;
#endif
}
/*
@@ -332,13 +317,11 @@ int sqlite3_load_extension(
** to clean up loaded extensions
*/
void sqlite3CloseExtensions(sqlite3 *db){
#ifdef SQLITE_LIBRARY_TYPE
int i;
for(i=0; i<db->nExtension; i++){
SQLITE_CLOSE_LIBRARY(((SQLITE_LIBRARY_TYPE*)db->aExtension)[i]);
sqlite3OsDlclose(db->aExtension[i]);
}
sqliteFree(db->aExtension);
#endif
}
/*