diff --git a/BUILD.gn b/BUILD.gn index 3b03c3791046de8e2318c198c969cf877be217e9..e5af3608ccf5ae07a833a8fd3b5b4b3d4e2e8057 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 b733d959f77b1571557362debe2efd21b3b2745b..b2b3d2c807d8deec543415e31768e49bcc9f70c3 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 e63a497d1452b9d7efd9a9c6f0740bdcc320bbb1..7dfdc58574d6fa57d323711e11e802744d4eea3a 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 a951b2701958f58356f45d149251243a32d88fc0..f052d8c81790e2255a5f2d7784bb01b57f6abfb8 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;