Better output
This commit is contained in:
@@ -11,6 +11,7 @@ var dbSession = null;
|
|||||||
// your extension is activated the very first time the command is executed
|
// your extension is activated the very first time the command is executed
|
||||||
export function activate(context: vscode.ExtensionContext) {
|
export function activate(context: vscode.ExtensionContext) {
|
||||||
const connectionProvider = new ConnectionProvider();
|
const connectionProvider = new ConnectionProvider();
|
||||||
|
let myOutputChannel = vscode.window.createOutputChannel('SQL Query Results');
|
||||||
|
|
||||||
vscode.window.registerTreeDataProvider('connections', connectionProvider);
|
vscode.window.registerTreeDataProvider('connections', connectionProvider);
|
||||||
|
|
||||||
@@ -34,10 +35,6 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
|
|
||||||
let text = editor.document.getText(selection);
|
let text = editor.document.getText(selection);
|
||||||
|
|
||||||
console.log(text);
|
|
||||||
|
|
||||||
let myOutputChannel = vscode.window.createOutputChannel('SQL Query Results');
|
|
||||||
|
|
||||||
if (!dbSession) {
|
if (!dbSession) {
|
||||||
let extPath = vscode.extensions.getExtension("todie.frog").extensionPath;
|
let extPath = vscode.extensions.getExtension("todie.frog").extensionPath;
|
||||||
dbSession = spawn("java", ['-jar', extPath + '/frog-runner.jar', '172.19.23.18', '1521', 'aax2sm', 'aax2sm', 'aax2sm']);
|
dbSession = spawn("java", ['-jar', extPath + '/frog-runner.jar', '172.19.23.18', '1521', 'aax2sm', 'aax2sm', 'aax2sm']);
|
||||||
@@ -53,7 +50,11 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
let cd = json['columnDefinitions']
|
let cd = json['columnDefinitions']
|
||||||
|
|
||||||
if (!json['rows']) {
|
if (!json['rows']) {
|
||||||
|
if (!json['userErrors']) {
|
||||||
|
myOutputChannel.append("SQL executed successfully.\n");
|
||||||
|
} else {
|
||||||
myOutputChannel.append(JSON.stringify(json, null ,2));
|
myOutputChannel.append(JSON.stringify(json, null ,2));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let row of json["rows"]) {
|
for (let row of json["rows"]) {
|
||||||
myOutputChannel.append("--- ROW ---\n");
|
myOutputChannel.append("--- ROW ---\n");
|
||||||
@@ -63,7 +64,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
myOutputChannel.append("-- DATUM HIER -------------------------------\n");
|
myOutputChannel.append("-- " + new Date() + " -------------------------------\n");
|
||||||
outputBuffer = "";
|
outputBuffer = "";
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
});
|
});
|
||||||
@@ -72,6 +73,11 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
myOutputChannel.show();
|
myOutputChannel.show();
|
||||||
myOutputChannel.append(data.toString());
|
myOutputChannel.append(data.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dbSession.on('close', (code) => {
|
||||||
|
console.log(`child process exited with code ${code}`);
|
||||||
|
dbSession = null;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!text) {
|
if (!text) {
|
||||||
@@ -79,7 +85,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
myOutputChannel.append("-- DATUM HIER -------------------------------\nExecuting: '" + text + "'\n");
|
myOutputChannel.append("-- " + new Date() + " -------------------------------\n"); //Executing: '" + text + "'\n");
|
||||||
dbSession.stdin.write(text + "\n--- END ---\n");
|
dbSession.stdin.write(text + "\n--- END ---\n");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user