More features.
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user