Skip to content

Commit dcaa8fc

Browse files
committed
refactor: disable MySQL support for Node.js engine because of conflicts
1 parent 58465fe commit dcaa8fc

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

src/legacy/legacyapi/db/Session.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "legacyapi/db/Session.h"
22

33
#include "lse/Entry.h"
4+
#ifndef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS
45
#include "legacyapi/db/impl/mysql/Session.h"
6+
#endif
57
#include "legacyapi/db/impl/sqlite/Session.h"
68
#include "ll/api/io/LoggerRegistry.h"
79
#include "ll/api/utils/StringUtils.h"
@@ -108,10 +110,18 @@ SharedPointer<Session> Session::_Create(DBType type, const ConnParams& params) {
108110
session = params.empty() ? new SQLiteSession() : new SQLiteSession(params);
109111
break;
110112
case DBType::MySQL:
113+
#ifdef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS
114+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger().error(
115+
"Session::_Create: MySQL is disabled in NodeJS backend because its OpenSSL has conflicts with libnode"
116+
);
117+
#else
111118
session = params.empty() ? new MySQLSession() : new MySQLSession(params);
119+
#endif
112120
break;
113121
default:
114-
throw std::runtime_error("Session::_Create: Unknown/Unsupported database type");
122+
lse::LegacyScriptEngine::getInstance().getSelf().getLogger().error(
123+
"Session::_Create: Unknown/Unsupported database type"
124+
);
115125
}
116126
if (session) {
117127
auto result = SharedPointer<Session>(session);

xmake.lua

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,21 @@ add_requires(
2222
"nlohmann_json",
2323
"simpleini",
2424
"sqlite3 3.43.0+200",
25-
"toml++",
26-
"mariadb-connector-c 3.3.9"
25+
"toml++"
2726
)
27+
2828
add_requires("cpp-httplib 0.14.3", {configs = {ssl = true, zlib = true}})
2929

3030
if is_config("backend", "lua") then
31+
add_requires("mariadb-connector-c 3.3.9")
3132
add_requires("scriptx main", {configs={backend="Lua"}})
3233

3334
elseif is_config("backend", "quickjs") then
35+
add_requires("mariadb-connector-c 3.3.9")
3436
add_requires("scriptx main", {configs={backend="QuickJs"}})
3537

3638
elseif is_config("backend", "python") then
39+
add_requires("mariadb-connector-c 3.3.9")
3740
add_requires("scriptx main", {configs={backend="Python"}})
3841

3942
elseif is_config("backend", "nodejs") then
@@ -86,6 +89,13 @@ target("legacy-script-engine")
8689
set_kind("shared")
8790
set_languages("cxx20")
8891
set_symbols("debug")
92+
add_files(
93+
"src/**.cpp"
94+
)
95+
add_includedirs(
96+
"src",
97+
"src/legacy"
98+
)
8999

90100
if is_config("backend", "lua") then
91101
add_defines(
@@ -136,18 +146,11 @@ target("legacy-script-engine")
136146
add_defines(
137147
"LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS"
138148
)
149+
remove_files("src/legacy/legacyapi/db/impl/mysql/*.cpp")
139150
set_basename("legacy-script-engine-nodejs")
140151
after_build(function(target)
141152
local langPath = path.join(os.projectdir(), "src/lang")
142153
local outputPath = path.join(os.projectdir(), "bin/" .. target:name() .. "/lang")
143154
os.cp(langPath, outputPath)
144155
end)
145-
end
146-
147-
add_files(
148-
"src/**.cpp"
149-
)
150-
add_includedirs(
151-
"src",
152-
"src/legacy"
153-
)
156+
end

0 commit comments

Comments
 (0)