aboutsummaryrefslogtreecommitdiff
path: root/editor-instance.js
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2018-02-20 21:44:28 +0000
committerJames Barnett <noreply@jamesbarnett.xyz>2018-02-20 21:44:28 +0000
commitb81c0f834f7f2285c40cfd57eb2943140025edad (patch)
tree2c45b5d844e2a8413f3189090e5f6373226f4fca /editor-instance.js
parent52f6783f63d2e2f52e06d14a97b5e00eab8ac1c0 (diff)
downloadsql-plus-plus-b81c0f834f7f2285c40cfd57eb2943140025edad.tar.xz
sql-plus-plus-b81c0f834f7f2285c40cfd57eb2943140025edad.zip
Dynamically create query executors - WIP
Diffstat (limited to 'editor-instance.js')
-rw-r--r--editor-instance.js29
1 files changed, 18 insertions, 11 deletions
diff --git a/editor-instance.js b/editor-instance.js
index cb26db7..008705f 100644
--- a/editor-instance.js
+++ b/editor-instance.js
@@ -11,7 +11,8 @@ require("codemirror/addon/hint/sql-hint.js");
const Split = require("split.js");
const editorInstanceId = require('uuid/v1')();
-console.log("instanceId=" + editorInstanceId);
+
+let queryExecutorId;
const editorContext = cm(document.getElementById("editor"), {
value: "select *\nfrom information_schema.tables\n/\nselect now()\n/\nselect *\nfrom foo",
@@ -27,7 +28,20 @@ editorContext.on("cursorActivity", (instance) => {
$("#cursor-coords").text("Ln " + (parseInt(coords.line) + 1) + ", Col " + (parseInt(coords.ch) + 1));
});
-ipcRenderer.send("queryExecutor.queryTableMetadata", _generateIpcPayload());
+const statementDelimiter = "/";
+
+let dataTable;
+let execStartTime;
+let execTimerInterval;
+let execElapsedTime;
+let queryMark;
+
+ipcRenderer.on("editorInstance.registerQueryExecutor", (event, payload) => {
+ queryExecutorId = payload;
+ console.log(queryExecutorId);
+ ipcRenderer.send("queryExecutor.queryTableMetadata", _generateIpcPayload());
+})
+
ipcRenderer.on("queryExecutor.queryTableMetadataComplete", (event, response) => {
console.log(response);
cm.commands.autocomplete = function (cmInstance) {
@@ -37,14 +51,6 @@ ipcRenderer.on("queryExecutor.queryTableMetadataComplete", (event, response) =>
}
});
-const statementDelimiter = "/";
-
-let dataTable;
-let execStartTime;
-let execTimerInterval;
-let execElapsedTime;
-let queryMark;
-
function runQuery() {
_setExecutionStatusIndicator("RUNNING");
@@ -132,7 +138,8 @@ function _clearQueryMarks() {
function _generateIpcPayload() {
return {
- editorInstanceId: editorInstanceId
+ editorInstanceId: editorInstanceId,
+ queryExecutorId: queryExecutorId
}
}