From 821360477ac7e9a95f8a9fd8fd6e46c89050b18d Mon Sep 17 00:00:00 2001 From: qianyong325 Date: Thu, 8 May 2025 16:12:09 +0800 Subject: [PATCH] =?UTF-8?q?sqlite=E6=B5=8B=E8=AF=95=20Signed-off-by:=20qia?= =?UTF-8?q?nyong325=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BUILD.gn | 18 +++++++++++++----- bundle.json | 4 ++++ src/shell.c | 5 +++++ src/sqlite3.c | 3 +++ 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 3b03c37..c34bc83 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", @@ -158,10 +159,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", @@ -192,10 +190,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 b733d95..9d0f67e 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/src/shell.c b/src/shell.c index a951b27..1d6c404 100644 --- a/src/shell.c +++ b/src/shell.c @@ -118,12 +118,15 @@ 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; #if SQLITE_USER_AUTHENTICATION # include "sqlite3userauth.h" #endif + + #include #include @@ -25976,6 +25979,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 2fb86bc..6985b68 100644 --- a/src/sqlite3.c +++ b/src/sqlite3.c @@ -17,6 +17,9 @@ ** language. The code for the "sqlite3" command-line shell is also in a ** separate file. This file contains only code for the core SQLite library. */ +#ifndef SQLITE_EXPORT +#define SQLITE_EXPORT +#endif #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 #ifndef SQLITE_PRIVATE -- Gitee