@dbcube/core 3.0.5 → 3.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -884,22 +884,30 @@ var QueryEngine = class {
|
|
|
884
884
|
reject(new Error("TCP request timeout"));
|
|
885
885
|
}, this.timeout);
|
|
886
886
|
client.connect(this.tcpPort, "127.0.0.1", () => {
|
|
887
|
+
const dmlIndex = args.findIndex((arg) => arg === "--dml");
|
|
888
|
+
const dmlJson = dmlIndex !== -1 ? args[dmlIndex + 1] : null;
|
|
889
|
+
if (!dmlJson) {
|
|
890
|
+
client.destroy();
|
|
891
|
+
reject(new Error("No DML found in arguments"));
|
|
892
|
+
return;
|
|
893
|
+
}
|
|
887
894
|
const command = {
|
|
888
895
|
action: "execute",
|
|
889
|
-
|
|
896
|
+
dml: dmlJson
|
|
890
897
|
};
|
|
891
|
-
client.write(JSON.stringify(command)
|
|
898
|
+
client.write(JSON.stringify(command));
|
|
892
899
|
});
|
|
893
900
|
client.on("data", (data) => {
|
|
894
901
|
responseBuffer += data.toString();
|
|
895
|
-
|
|
902
|
+
const match = responseBuffer.match(/PROCESS_RESPONSE:(\{.*\})/);
|
|
903
|
+
if (match) {
|
|
896
904
|
clearTimeout(timeout);
|
|
897
905
|
client.destroy();
|
|
898
906
|
try {
|
|
899
|
-
const response = JSON.parse(
|
|
907
|
+
const response = JSON.parse(match[1]);
|
|
900
908
|
resolve5({
|
|
901
|
-
status: response.status
|
|
902
|
-
message: response.message
|
|
909
|
+
status: response.status,
|
|
910
|
+
message: response.message,
|
|
903
911
|
data: response.data
|
|
904
912
|
});
|
|
905
913
|
} catch (error) {
|