Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved comments and documentation of sqlite3_load_extension(). (CVS 3229) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0bcec95963603270ee053c83b1f6960b |
User & Date: | drh 2006-06-13 15:12:21.000 |
Context
2006-06-13
| ||
15:36 | Get the code to compile with -DSQLITE_OMIT_VIRTUALTABLE=1 (CVS 3230) (check-in: ea4bc5a0be user: drh tags: trunk) | |
15:12 | Improved comments and documentation of sqlite3_load_extension(). (CVS 3229) (check-in: 0bcec95963 user: drh tags: trunk) | |
15:00 | Add the tentative sqlite3_allocate_queryplan() API. (CVS 3228) (check-in: 7a3e97f76b user: danielk1977 tags: trunk) | |
Changes
Changes to src/loadext.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */ #include "sqlite3ext.h" #include "sqliteInt.h" #include <string.h> #include <ctype.h> #ifndef SQLITE_ENABLE_COLUMN_METADATA # define sqlite3_column_database_name 0 # define sqlite3_column_database_name16 0 # define sqlite3_column_table_name 0 # define sqlite3_column_table_name16 0 # define sqlite3_column_origin_name 0 # define sqlite3_column_origin_name16 0 # define sqlite3_table_column_metadata 0 #endif const sqlite3_api_routines sqlite3_api = { sqlite3_aggregate_context, sqlite3_aggregate_count, sqlite3_bind_blob, sqlite3_bind_double, sqlite3_bind_int, sqlite3_bind_int64, | > > > > > > > > > > > > > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */ #include "sqlite3ext.h" #include "sqliteInt.h" #include <string.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 # define sqlite3_column_database_name 0 # define sqlite3_column_database_name16 0 # define sqlite3_column_table_name 0 # define sqlite3_column_table_name16 0 # define sqlite3_column_origin_name 0 # define sqlite3_column_origin_name16 0 # define sqlite3_table_column_metadata 0 #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 = { sqlite3_aggregate_context, sqlite3_aggregate_count, sqlite3_bind_blob, sqlite3_bind_double, sqlite3_bind_int, sqlite3_bind_int64, |
︙ | ︙ | |||
136 137 138 139 140 141 142 143 144 | sqlite3_value_numeric_type, sqlite3_value_text, sqlite3_value_text16, sqlite3_value_text16be, sqlite3_value_text16le, sqlite3_value_type, sqlite3_vmprintf, }; | > > > > > > > > | > > | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | sqlite3_value_numeric_type, sqlite3_value_text, sqlite3_value_text16, sqlite3_value_text16be, sqlite3_value_text16le, sqlite3_value_type, 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. ************************************************************************* */ }; /* ** 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) |
︙ | ︙ | |||
264 265 266 267 268 269 270 | SQLITE_CLOSE_LIBRARY(handle); return SQLITE_ERROR; } ((SQLITE_LIBRARY_TYPE*)db->aExtension)[db->nExtension-1] = handle; return SQLITE_OK; #else if( pzErrMsg ){ | | < | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | SQLITE_CLOSE_LIBRARY(handle); return SQLITE_ERROR; } ((SQLITE_LIBRARY_TYPE*)db->aExtension)[db->nExtension-1] = handle; return SQLITE_OK; #else if( pzErrMsg ){ *pzErrMsg = sqlite3_mprintf("extension loading is disabled"); } return SQLITE_ERROR; #endif } /* ** Call this routine when the database connection is closing in order |
︙ | ︙ |
Changes to src/shell.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** ** $Id: shell.c,v 1.142 2006/06/13 15:12:21 drh Exp $ */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include <assert.h> #include "sqlite3.h" #include <ctype.h> |
︙ | ︙ | |||
759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | ".echo ON|OFF Turn command echo on or off\n" ".exit Exit this program\n" ".explain ON|OFF Turn output mode suitable for EXPLAIN on or off.\n" ".header(s) ON|OFF Turn display of headers on or off\n" ".help Show this message\n" ".import FILE TABLE Import data from FILE into TABLE\n" ".indices TABLE Show names of all indices on TABLE\n" ".load FILE ?ENTRY? Load an extension library\n" ".mode MODE ?TABLE? Set output mode where MODE is one of:\n" " csv Comma-separated values\n" " column Left-aligned columns. (See .width)\n" " html HTML <table> code\n" " insert SQL insert statements for TABLE\n" " line One value per line\n" " list Values delimited by .separator string\n" | > > | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | ".echo ON|OFF Turn command echo on or off\n" ".exit Exit this program\n" ".explain ON|OFF Turn output mode suitable for EXPLAIN on or off.\n" ".header(s) ON|OFF Turn display of headers on or off\n" ".help Show this message\n" ".import FILE TABLE Import data from FILE into 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" #endif ".mode MODE ?TABLE? Set output mode where MODE is one of:\n" " csv Comma-separated values\n" " column Left-aligned columns. (See .width)\n" " html HTML <table> code\n" " insert SQL insert statements for TABLE\n" " line One value per line\n" " list Values delimited by .separator string\n" |
︙ | ︙ | |||
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 | zShellStatic = 0; if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); sqlite3_free(zErrMsg); } }else if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){ const char *zFile, *zProc; char *zErrMsg = 0; int rc; zFile = azArg[1]; zProc = nArg>=3 ? azArg[2] : 0; open_db(p); rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg); if( rc!=SQLITE_OK ){ fprintf(stderr, "%s\n", zErrMsg); sqlite3_free(zErrMsg); } }else if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg>=2 ){ int n2 = strlen(azArg[1]); if( strncmp(azArg[1],"line",n2)==0 || strncmp(azArg[1],"lines",n2)==0 ){ p->mode = MODE_Line; | > > | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | zShellStatic = 0; if( zErrMsg ){ fprintf(stderr,"Error: %s\n", zErrMsg); sqlite3_free(zErrMsg); } }else #ifndef SQLITE_OMIT_LOAD_EXTENSION if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){ const char *zFile, *zProc; char *zErrMsg = 0; int rc; zFile = azArg[1]; zProc = nArg>=3 ? azArg[2] : 0; open_db(p); rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg); if( rc!=SQLITE_OK ){ fprintf(stderr, "%s\n", zErrMsg); sqlite3_free(zErrMsg); } }else #endif if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg>=2 ){ int n2 = strlen(azArg[1]); if( strncmp(azArg[1],"line",n2)==0 || strncmp(azArg[1],"lines",n2)==0 ){ p->mode = MODE_Line; |
︙ | ︙ |