diff --git a/frog-runner.jar b/frog-runner.jar index 862fab5..4ed481d 100644 Binary files a/frog-runner.jar and b/frog-runner.jar differ diff --git a/src/extension.ts b/src/extension.ts index 1bc445d..3893fde 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -34,6 +34,8 @@ export function activate(context: vscode.ExtensionContext) { let text = editor.document.getText(selection); + console.log(text); + var myOutputChannel = vscode.window.createOutputChannel('SQL Query Results'); if (!dbSession) { @@ -44,16 +46,24 @@ export function activate(context: vscode.ExtensionContext) { dbSession.stdout.on('data', (data) => { outputBuffer += data.toString(); + try { let json = JSON.parse(outputBuffer); - for (let row of json["rows"]) { - myOutputChannel.append("--- ROW ---\n"); - for (let column of row["columns"]) { - myOutputChannel.append(column['name'] + " " + column['value'] + "\n"); + let cd = json['columnDefinitions'] + + if (!json['rows']) { + myOutputChannel.append(JSON.stringify(json, null ,2)); + } else { + for (let row of json["rows"]) { + myOutputChannel.append("--- ROW ---\n"); + for (let [index, value] of row["columns"].entries()) { + myOutputChannel.append(cd[index]['name'] + " " + value['value'] + "\n"); + } } } + myOutputChannel.append("-- DATUM HIER -------------------------------\n"); outputBuffer = ""; } catch (e) {} }); @@ -69,7 +79,7 @@ export function activate(context: vscode.ExtensionContext) { return; } - myOutputChannel.append("Executing: '" + text + "'\n"); + myOutputChannel.append("-- DATUM HIER -------------------------------\nExecuting: '" + text + "'\n"); dbSession.stdin.write(text + "\n--- END ---\n"); });