1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Improved comments and documentation of sqlite3_load_extension(). (CVS 3229)

FossilOrigin-Name: 0bcec95963603270ee053c83b1f6960b2029d378
This commit is contained in:
drh
2006-06-13 15:12:21 +00:00
parent be8a7835ea
commit 70df4fe6c2
4 changed files with 48 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
C Add\sthe\stentative\ssqlite3_allocate_queryplan()\sAPI.\s(CVS\s3228) C Improved\scomments\sand\sdocumentation\sof\ssqlite3_load_extension().\s(CVS\s3229)
D 2006-06-13T15:00:55 D 2006-06-13T15:12:21
F Makefile.in 56fd6261e83f60724e6dcd764e06ab68cbd53909 F Makefile.in 56fd6261e83f60724e6dcd764e06ab68cbd53909
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -48,7 +48,7 @@ F src/hash.c 449f3d6620193aa557f5d86cbc5cc6b87702b185
F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564 F src/hash.h 1b3f7e2609141fd571f62199fc38687d262e9564
F src/insert.c 2c3eeb4bcde13c1006824ef14953c2fdad31cf36 F src/insert.c 2c3eeb4bcde13c1006824ef14953c2fdad31cf36
F src/legacy.c fa15d505dd4e45044177ee4d1c6aeaf8c836d390 F src/legacy.c fa15d505dd4e45044177ee4d1c6aeaf8c836d390
F src/loadext.c d0fadf55c55144334a879a32e346c0204658e882 F src/loadext.c 0215a9c83b7f720aba30f06f183fe6fb3c56a009
F src/main.c f4397bf95216496e49db2153789788f4b1207b91 F src/main.c f4397bf95216496e49db2153789788f4b1207b91
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235 F src/os.c 59f05de8c5777c34876607114a2fbe55ae578235
@@ -71,7 +71,7 @@ F src/printf.c 7029e5f7344a478394a02c52837ff296ee1ab240
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
F src/select.c 38eda11d950ed5e631ea9054f84a4a8b9e9b39d8 F src/select.c 38eda11d950ed5e631ea9054f84a4a8b9e9b39d8
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 55bf6335dae7146f7a300039f5d6bb35010f1996 F src/shell.c ad73192b30a338a58fe81183d4a5d5a1d4e51d36
F src/sqlite.h.in 92cbeeacf040bffe109057d3af2db9dc63db8a67 F src/sqlite.h.in 92cbeeacf040bffe109057d3af2db9dc63db8a67
F src/sqlite3ext.h 127bd394c8eea481f2ac9b754bf399dbfc818b75 F src/sqlite3ext.h 127bd394c8eea481f2ac9b754bf399dbfc818b75
F src/sqliteInt.h 91cc3603fe2e1be18d52490a2fa65ed9640fb338 F src/sqliteInt.h 91cc3603fe2e1be18d52490a2fa65ed9640fb338
@@ -363,7 +363,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 0f4657ea69314e49bc7c9faf9a653ef072f5082d P 7a3e97f76b1f4f97a04f7c5a9daa400402b2ff25
R b1fdb74ba8eeb04baf985a2eb223a6b1 R 99814ab55d5388c50dbc5b5d45b55362
U danielk1977 U drh
Z f48f6df0484e720f46ed17f757e9f5ce Z 9e34725cf1a9f7698b5b20c0e7a693ad

View File

@@ -1 +1 @@
7a3e97f76b1f4f97a04f7c5a9daa400402b2ff25 0bcec95963603270ee053c83b1f6960b2029d378

View File

@@ -20,6 +20,11 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
/*
** Some API routines are omitted when various features are
** excluded from a build of SQLite. Substitute a NULL pointer
** for any missing APIs.
*/
#ifndef SQLITE_ENABLE_COLUMN_METADATA #ifndef SQLITE_ENABLE_COLUMN_METADATA
# define sqlite3_column_database_name 0 # define sqlite3_column_database_name 0
# define sqlite3_column_database_name16 0 # define sqlite3_column_database_name16 0
@@ -30,6 +35,21 @@
# define sqlite3_table_column_metadata 0 # define sqlite3_table_column_metadata 0
#endif #endif
/*
** The following structure contains pointers to all SQLite API routines.
** A pointer to this structure is passed into extensions when they are
** loaded so that the extension can make calls back into the SQLite
** library.
**
** When adding new APIs, add them to the bottom of this structure
** in order to preserve backwards compatibility.
**
** Extensions that use newer APIs should first call the
** sqlite3_libversion_number() to make sure that the API they
** intend to use is supported by the library. Extensions should
** also check to make sure that the pointer to the function is
** not NULL before calling it.
*/
const sqlite3_api_routines sqlite3_api = { const sqlite3_api_routines sqlite3_api = {
sqlite3_aggregate_context, sqlite3_aggregate_context,
sqlite3_aggregate_count, sqlite3_aggregate_count,
@@ -140,10 +160,20 @@ const sqlite3_api_routines sqlite3_api = {
sqlite3_value_text16le, sqlite3_value_text16le,
sqlite3_value_type, sqlite3_value_type,
sqlite3_vmprintf, sqlite3_vmprintf,
/*
** The original API set ends here. All extensions can call any
** of the APIs above provided that the pointer is not NULL. But
** before calling APIs that follow, extension should check the
** sqlite3_libversion_number() to make sure they are dealing with
** a library that is new enough to support that API.
*************************************************************************
*/
}; };
/*
#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || defined(__BORLANDC__) ** The windows implementation of shared-library loaders
*/
#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || defined(__BORLANDC__)
# include <windows.h> # include <windows.h>
# define SQLITE_LIBRARY_TYPE HANDLE # define SQLITE_LIBRARY_TYPE HANDLE
# define SQLITE_OPEN_LIBRARY(A) LoadLibrary(A) # define SQLITE_OPEN_LIBRARY(A) LoadLibrary(A)
@@ -152,7 +182,7 @@ const sqlite3_api_routines sqlite3_api = {
#endif /* windows */ #endif /* windows */
/* /*
** Non-windows implementation of shared-library loaders ** The unix implementation of shared-library loaders
*/ */
#if defined(HAVE_DLOPEN) && !defined(SQLITE_LIBRARY_TYPE) #if defined(HAVE_DLOPEN) && !defined(SQLITE_LIBRARY_TYPE)
# include <dlfcn.h> # include <dlfcn.h>
@@ -268,8 +298,7 @@ int sqlite3_load_extension(
return SQLITE_OK; return SQLITE_OK;
#else #else
if( pzErrMsg ){ if( pzErrMsg ){
*pzErrMsg = sqlite3_mprintf( *pzErrMsg = sqlite3_mprintf("extension loading is disabled");
"shared library loading not enabled for this build");
} }
return SQLITE_ERROR; return SQLITE_ERROR;
#endif #endif

View File

@@ -12,7 +12,7 @@
** This file contains code to implement the "sqlite" command line ** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases. ** utility for accessing SQLite databases.
** **
** $Id: shell.c,v 1.141 2006/06/12 12:57:46 drh Exp $ ** $Id: shell.c,v 1.142 2006/06/13 15:12:21 drh Exp $
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -763,7 +763,9 @@ static char zHelp[] =
".help Show this message\n" ".help Show this message\n"
".import FILE TABLE Import data from FILE into TABLE\n" ".import FILE TABLE Import data from FILE into TABLE\n"
".indices TABLE Show names of all indices on TABLE\n" ".indices TABLE Show names of all indices on TABLE\n"
#ifndef SQLITE_OMIT_LOAD_EXTENSION
".load FILE ?ENTRY? Load an extension library\n" ".load FILE ?ENTRY? Load an extension library\n"
#endif
".mode MODE ?TABLE? Set output mode where MODE is one of:\n" ".mode MODE ?TABLE? Set output mode where MODE is one of:\n"
" csv Comma-separated values\n" " csv Comma-separated values\n"
" column Left-aligned columns. (See .width)\n" " column Left-aligned columns. (See .width)\n"
@@ -1150,6 +1152,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
} }
}else }else
#ifndef SQLITE_OMIT_LOAD_EXTENSION
if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){ if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){
const char *zFile, *zProc; const char *zFile, *zProc;
char *zErrMsg = 0; char *zErrMsg = 0;
@@ -1163,6 +1166,7 @@ static int do_meta_command(char *zLine, struct callback_data *p){
sqlite3_free(zErrMsg); sqlite3_free(zErrMsg);
} }
}else }else
#endif
if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg>=2 ){ if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg>=2 ){
int n2 = strlen(azArg[1]); int n2 = strlen(azArg[1]);