From 71bc3d2e21858fd0765704088a9e482ac5b0f6a8 Mon Sep 17 00:00:00 2001 From: qianyong325 Date: Thu, 8 May 2025 16:12:09 +0800 Subject: [PATCH] =?UTF-8?q?sqlite3-=E6=B5=8B=E8=AF=95=20Signed-off-by:=20q?= =?UTF-8?q?ianyong325=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BUILD.gn | 18 +++++++++++++----- bundle.json | 1 + include/sqlite3sym.h | 1 + src/shell.c | 1 + 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 3b03c37..e5af360 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -112,6 +112,8 @@ ohos_shared_library("sqlite") { "SQLITE_DIRECT_OVERFLOW_READ", "SQLITE_HAS_CODEC", "SQLITE_EXPORT_SYMBOLS", + "SQLITE_API=SQLITE_EXPORT", + "SQLITE_ENABLE_LOAD_EXTENSION", "SQLITE_SHARED_BLOCK_OPTIMIZATION", "SQLITE_CODEC_ATTACH_CHANGED", "SQLITE_ENABLE_DROPTABLE_CALLBACK", @@ -158,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", @@ -195,7 +194,16 @@ ohos_executable("sqlite3") { "-Wno-implicit-fallthrough", ] - deps = [ "//third_party/sqlite/patch:apply_patch" ] + deps = [ + ":sqlite", + "//third_party/sqlite/patch:apply_patch", + ] + + public_configs = [ ":sqlite_config" ] + public_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 b733d95..b2b3d2c 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": [ diff --git a/include/sqlite3sym.h b/include/sqlite3sym.h index e63a497..7dfdc58 100644 --- a/include/sqlite3sym.h +++ b/include/sqlite3sym.h @@ -32,6 +32,7 @@ struct sqlite3_api_routines_hw { }; extern const struct sqlite3_api_routines_hw *sqlite3_export_hw_symbols; +/* 通过符号表实现模块间调用 */ #define sqlite3_initialize sqlite3_export_hw_symbols->initialize #define sqlite3_config sqlite3_export_hw_symbols->config #define sqlite3_key sqlite3_export_hw_symbols->key diff --git a/src/shell.c b/src/shell.c index a951b27..f052d8c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -118,6 +118,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; -- Gitee