mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Simplify the initialization of built-in extensions.
FossilOrigin-Name: 729f2397358d0382e255ba0058bf70bc9ed410b7621a67466da13de437d3ba5c
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Ensure\sthat\sthe\smaster-journal\sname\sis\sin\sa\sform\ssuitable\sto\sbe\spassed\ninto\ssqlite3_uri_parameter().
|
C Simplify\sthe\sinitialization\sof\sbuilt-in\sextensions.
|
||||||
D 2020-05-04T11:47:38.857
|
D 2020-05-04T17:15:21.662
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@@ -497,7 +497,7 @@ F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
|
|||||||
F src/insert.c 8e4211d04eb460c0694d486c6ba1c068d468c6f653c3f237869a802ad82854de
|
F src/insert.c 8e4211d04eb460c0694d486c6ba1c068d468c6f653c3f237869a802ad82854de
|
||||||
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
|
||||||
F src/loadext.c 421310045bd78afefb772294a99e50f37d87ae578786a6169074e6291e30d969
|
F src/loadext.c 421310045bd78afefb772294a99e50f37d87ae578786a6169074e6291e30d969
|
||||||
F src/main.c 7e07ff5ec447451d28398d528fda25c272f86cce67bc59a9846ee5bdfb23e1d9
|
F src/main.c 2dd7fc7b3f71b23b185496cd282072ba5888dc8ed8ecb9309ddd0d1efdf66d5c
|
||||||
F src/malloc.c a3e13b001f988ecec6bdb90c0ea8912c8c786e623724d7098da623d8d01d19b1
|
F src/malloc.c a3e13b001f988ecec6bdb90c0ea8912c8c786e623724d7098da623d8d01d19b1
|
||||||
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
|
||||||
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de
|
||||||
@@ -1863,7 +1863,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P efdecb13091316aeac2722f58577cb0314e008e857f2816a2a222bac0a83e9e1
|
P d1ba026d882f070b351280028e2fa88a3cca59b46d4683302e24c6677e0951b9
|
||||||
R 6897970c2b5b2cca1a8fed26518d5a6e
|
R 7709315ebf43ae93c1f9067b218a4e7c
|
||||||
U drh
|
U drh
|
||||||
Z ec3fad1620b6ab238b8dc4b9fa847a46
|
Z 0528b7b773900b4185d8554d4c89985c
|
||||||
|
@@ -1 +1 @@
|
|||||||
d1ba026d882f070b351280028e2fa88a3cca59b46d4683302e24c6677e0951b9
|
729f2397358d0382e255ba0058bf70bc9ed410b7621a67466da13de437d3ba5c
|
141
src/main.c
141
src/main.c
@@ -25,15 +25,78 @@
|
|||||||
#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
|
#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
|
||||||
# include "sqliteicu.h"
|
# include "sqliteicu.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This is an extension initializer that is a no-op and always
|
||||||
|
** succeeds, except that it fails if the fault-simulation is set
|
||||||
|
** to 500.
|
||||||
|
*/
|
||||||
|
static int sqlite3TestExtInit(sqlite3 *db){
|
||||||
|
(void)db;
|
||||||
|
return sqlite3FaultSim(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Forward declarations of external module initializer functions
|
||||||
|
** for modules that need them.
|
||||||
|
*/
|
||||||
|
#ifdef SQLITE_ENABLE_FTS1
|
||||||
|
int sqlite3Fts1Init(sqlite3*);
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_FTS2
|
||||||
|
int sqlite3Fts2Init(sqlite3*);
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_FTS5
|
||||||
|
int sqlite3Fts5Init(sqlite3*);
|
||||||
|
#endif
|
||||||
#ifdef SQLITE_ENABLE_JSON1
|
#ifdef SQLITE_ENABLE_JSON1
|
||||||
int sqlite3Json1Init(sqlite3*);
|
int sqlite3Json1Init(sqlite3*);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SQLITE_ENABLE_STMTVTAB
|
#ifdef SQLITE_ENABLE_STMTVTAB
|
||||||
int sqlite3StmtVtabInit(sqlite3*);
|
int sqlite3StmtVtabInit(sqlite3*);
|
||||||
#endif
|
#endif
|
||||||
#ifdef SQLITE_ENABLE_FTS5
|
|
||||||
int sqlite3Fts5Init(sqlite3*);
|
/*
|
||||||
|
** An array of pointers to extension initializer functions for
|
||||||
|
** built-in extensions.
|
||||||
|
*/
|
||||||
|
static int (*const sqlite3BuiltinExtensions[])(sqlite3*) = {
|
||||||
|
#ifdef SQLITE_ENABLE_FTS1
|
||||||
|
sqlite3Fts1Init,
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_FTS2
|
||||||
|
sqlite3Fts2Init,
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_FTS3
|
||||||
|
sqlite3Fts3Init,
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_FTS5
|
||||||
|
sqlite3Fts5Init,
|
||||||
|
#endif
|
||||||
|
#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
|
||||||
|
sqlite3IcuInit,
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_RTREE
|
||||||
|
sqlite3RtreeInit,
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_DBPAGE_VTAB
|
||||||
|
sqlite3DbpageRegister,
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_DBSTAT_VTAB
|
||||||
|
sqlite3DbstatRegister,
|
||||||
|
#endif
|
||||||
|
sqlite3TestExtInit,
|
||||||
|
#ifdef SQLITE_ENABLE_JSON1
|
||||||
|
sqlite3Json1Init,
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_STMTVTAB
|
||||||
|
sqlite3StmtVtabInit,
|
||||||
|
#endif
|
||||||
|
#ifdef SQLITE_ENABLE_BYTECODE_VTAB
|
||||||
|
sqlite3VdbeBytecodeVtabInit,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
#ifndef SQLITE_AMALGAMATION
|
#ifndef SQLITE_AMALGAMATION
|
||||||
/* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant
|
/* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant
|
||||||
@@ -3042,6 +3105,7 @@ static int openDatabase(
|
|||||||
int isThreadsafe; /* True for threadsafe connections */
|
int isThreadsafe; /* True for threadsafe connections */
|
||||||
char *zOpen = 0; /* Filename argument to pass to BtreeOpen() */
|
char *zOpen = 0; /* Filename argument to pass to BtreeOpen() */
|
||||||
char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
|
char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */
|
||||||
|
int i; /* Loop counter */
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_API_ARMOR
|
#ifdef SQLITE_ENABLE_API_ARMOR
|
||||||
if( ppDb==0 ) return SQLITE_MISUSE_BKPT;
|
if( ppDb==0 ) return SQLITE_MISUSE_BKPT;
|
||||||
@@ -3282,14 +3346,11 @@ static int openDatabase(
|
|||||||
sqlite3RegisterPerConnectionBuiltinFunctions(db);
|
sqlite3RegisterPerConnectionBuiltinFunctions(db);
|
||||||
rc = sqlite3_errcode(db);
|
rc = sqlite3_errcode(db);
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_FTS5
|
|
||||||
/* Register any built-in FTS5 module before loading the automatic
|
/* Load compiled-in extensions */
|
||||||
** extensions. This allows automatic extensions to register FTS5
|
for(i=0; rc==SQLITE_OK && i<ArraySize(sqlite3BuiltinExtensions); i++){
|
||||||
** tokenizers and auxiliary functions. */
|
rc = sqlite3BuiltinExtensions[i](db);
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK ){
|
|
||||||
rc = sqlite3Fts5Init(db);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 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.
|
||||||
@@ -3302,68 +3363,6 @@ static int openDatabase(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_FTS1
|
|
||||||
if( !db->mallocFailed ){
|
|
||||||
extern int sqlite3Fts1Init(sqlite3*);
|
|
||||||
rc = sqlite3Fts1Init(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_FTS2
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK ){
|
|
||||||
extern int sqlite3Fts2Init(sqlite3*);
|
|
||||||
rc = sqlite3Fts2Init(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_FTS3 /* automatically defined by SQLITE_ENABLE_FTS4 */
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK ){
|
|
||||||
rc = sqlite3Fts3Init(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(SQLITE_ENABLE_ICU) || defined(SQLITE_ENABLE_ICU_COLLATIONS)
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK ){
|
|
||||||
rc = sqlite3IcuInit(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_RTREE
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK){
|
|
||||||
rc = sqlite3RtreeInit(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_DBPAGE_VTAB
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK){
|
|
||||||
rc = sqlite3DbpageRegister(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_DBSTAT_VTAB
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK){
|
|
||||||
rc = sqlite3DbstatRegister(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_JSON1
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK){
|
|
||||||
rc = sqlite3Json1Init(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_STMTVTAB
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK){
|
|
||||||
rc = sqlite3StmtVtabInit(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_BYTECODE_VTAB
|
|
||||||
if( !db->mallocFailed && rc==SQLITE_OK){
|
|
||||||
rc = sqlite3VdbeBytecodeVtabInit(db);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_ENABLE_INTERNAL_FUNCTIONS
|
#ifdef SQLITE_ENABLE_INTERNAL_FUNCTIONS
|
||||||
/* Testing use only!!! The -DSQLITE_ENABLE_INTERNAL_FUNCTIONS=1 compile-time
|
/* Testing use only!!! The -DSQLITE_ENABLE_INTERNAL_FUNCTIONS=1 compile-time
|
||||||
** option gives access to internal functions by default.
|
** option gives access to internal functions by default.
|
||||||
|
Reference in New Issue
Block a user