diff --git a/BUILD.gn b/BUILD.gn index 094c4914c49634368d04ed4627488a9c1f2e1012..40f18e336082b5a254e7619c13328049f523a581 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -115,7 +115,6 @@ ohos_shared_library("sqlite") { "SQLITE_DIRECT_OVERFLOW_READ", "SQLITE_HAS_CODEC", "SQLITE_EXPORT_SYMBOLS", - "SQLITE_API=SQLITE_EXPORT", "SQLITE_SHARED_BLOCK_OPTIMIZATION", "SQLITE_CODEC_ATTACH_CHANGED", "SQLITE_ENABLE_DROPTABLE_CALLBACK", diff --git a/patch/0007-DatabaseDebugTool.patch b/patch/0007-DatabaseDebugTool.patch index 3e2ac23c49e586dd045c49457d27978289b32aa0..daddcc836f03b40dc55195a618e05556078b759e 100644 --- a/patch/0007-DatabaseDebugTool.patch +++ b/patch/0007-DatabaseDebugTool.patch @@ -1,5 +1,5 @@ diff --git a/src/shell.c b/src/shell.c -index 7fb190e..07fe381 100644 +index 7fb190e..c1948b1 100644 --- a/src/shell.c +++ b/src/shell.c @@ -119,6 +119,7 @@ typedef unsigned short int u16; @@ -10,26 +10,13 @@ index 7fb190e..07fe381 100644 typedef sqlite3_int64 i64; typedef sqlite3_uint64 u64; typedef unsigned char u8; -@@ -28874,6 +28875,8 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ - warnInmemoryDb = 0; +@@ -28875,6 +28876,9 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ } #endif -+ // The icu analyzer is enabled by default on the client tool. -+ sqlite3_config(SQLITE_CONFIG_ENABLE_ICU); ++// The icu analyzer is enabled by default on the client tool. ++ sqlite3_config(SQLITE_CONFIG_ENABLE_ICU); ++ /* Do an initial pass through the command-line argument to locate ** the name of the database file, the name of the initialization file, -diff --git a/src/sqlite3.c b/src/sqlite3.c -index 7fb290f..0024163 100644 ---- a/src/sqlite3.c -+++ b/src/sqlite3.c -@@ -20,6 +20,9 @@ - ** The content in this amalgamation comes from Fossil check-in - ** f1e31fd9961ac82535a5d0702b127d84de8c. - */ -+#ifndef SQLITE_EXPORT -+#define SQLITE_EXPORT -+#endif - #define SQLITE_CORE 1 - #define SQLITE_AMALGAMATION 1 - #ifndef SQLITE_PRIVATE + ** the size of the alternative malloc heap, options affecting commands diff --git a/patch/0010-EnableExtensionLoading-LoadCustomTokenizer.patch b/patch/0010-EnableExtensionLoading-LoadCustomTokenizer.patch new file mode 100644 index 0000000000000000000000000000000000000000..7e8b2187e63843903247af65adc1830525748c35 --- /dev/null +++ b/patch/0010-EnableExtensionLoading-LoadCustomTokenizer.patch @@ -0,0 +1,28 @@ +diff --git a/src/shell.c b/src/shell.c +index 7fb190e..3ded62a 100644 +--- a/src/shell.c ++++ b/src/shell.c +@@ -22189,6 +22189,23 @@ static void open_db(ShellState *p, int openFlags){ + } + sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0); + ++ // 添加启用扩展加载的配置项 ++ int enableLoadExtension = 1; ++ char *ErrMsg = 0; ++ int ret_icu; ++ ret_icu = sqlite3_db_config(p->db, SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, enableLoadExtension, &ErrMsg); ++ if (ret_icu != SQLITE_OK) { ++ fprintf(stderr, "Failed to configure database: %s\n", ErrMsg); ++ sqlite3_free(ErrMsg); ++ } ++ ++ // 加载自定义扩展 ++ ret_icu = sqlite3_load_extension(p->db, "libcustomtokenizer.z.so", NULL, &ErrMsg); ++ if (ret_icu != SQLITE_OK) { ++ fprintf(stderr, "Failed to load extension: %s\n", ErrMsg); ++ sqlite3_free(ErrMsg); ++ } ++ + /* Reflect the use or absence of --unsafe-testing invocation. */ + { + int testmode_on = ShellHasFlag(p,SHFLG_TestingMode); diff --git a/patch/0010-Bug-fixes-on-current-version.patch b/patch/0011-Bug-fixes-on-current-version.patch similarity index 100% rename from patch/0010-Bug-fixes-on-current-version.patch rename to patch/0011-Bug-fixes-on-current-version.patch