diff --git a/BUILD.gn b/BUILD.gn index 89d686990a667d188ea85c38224a6f03f69662ec..0c72d7b1fc1d727ddac0ed9fc4d5e7cb0c8b1465 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -112,6 +112,7 @@ 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", @@ -159,10 +160,7 @@ ohos_shared_library("sqlite") { ohos_executable("sqlite3") { include_dirs = [ "$sqlite_patched_dir/include" ] - sources = [ - "$sqlite_patched_dir/src/shell.c", - "$sqlite_patched_dir/src/sqlite3.c", - ] + sources = [ "$sqlite_patched_dir/src/shell.c" ] defines = [ "NDEBUG=1", @@ -193,10 +191,20 @@ ohos_executable("sqlite3") { cflags = [ "-Wno-error=implicit-function-declaration", + "-Wno-macro-redefined", "-Wno-implicit-fallthrough", ] - deps = [ "//third_party/sqlite/patch:apply_patch" ] + deps = [ + ":sqlite", + "//third_party/sqlite/patch:apply_patch", + ] + + public_configs = [ ":sqlite_config" ] + external_deps = [ "c_utils:utils" ] + configs = [ ":sqlite3_private_config" ] + part_name = "sqlite" + subsystem_name = "thirdparty" } if (is_mingw || is_mac) { diff --git a/bundle.json b/bundle.json index c6cf1043906942be16fcfd775a3afcaf70fe7aec..ac0ddba3d2d9aeed9fa0a0fc5f69e7887c905193 100644 --- a/bundle.json +++ b/bundle.json @@ -31,6 +31,7 @@ "build": { "sub_component": [ "//third_party/sqlite:sqlite", + "//third_party/sqlite:sqlite3", "//third_party/sqlite:sqliteicu" ], "inner_kits": [ @@ -46,6 +47,9 @@ }, { "name": "//third_party/sqlite:sqliteicu" + }, + { + "name": "//third_party/sqlite:sqlite3" } ], "test": [ diff --git a/patch/0007-DatabaseDebugTool.patch b/patch/0007-DatabaseDebugTool.patch new file mode 100644 index 0000000000000000000000000000000000000000..3e2ac23c49e586dd045c49457d27978289b32aa0 --- /dev/null +++ b/patch/0007-DatabaseDebugTool.patch @@ -0,0 +1,35 @@ +diff --git a/src/shell.c b/src/shell.c +index 7fb190e..07fe381 100644 +--- a/src/shell.c ++++ b/src/shell.c +@@ -119,6 +119,7 @@ typedef unsigned short int u16; + #include + #include + #include "sqlite3.h" ++#include "sqlite3sym.h" + 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; + } + #endif ++ // 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 diff --git a/patch/0007-Bugfix-on-current-version.patch b/patch/0008-Bugfix-on-current-version.patch similarity index 100% rename from patch/0007-Bugfix-on-current-version.patch rename to patch/0008-Bugfix-on-current-version.patch