|
|
|
@ -11,6 +11,7 @@ var dbSession = null;
|
|
|
|
|
// your extension is activated the very first time the command is executed
|
|
|
|
|
export function activate(context: vscode.ExtensionContext) {
|
|
|
|
|
const connectionProvider = new ConnectionProvider();
|
|
|
|
|
let myOutputChannel = vscode.window.createOutputChannel('SQL Query Results');
|
|
|
|
|
|
|
|
|
|
vscode.window.registerTreeDataProvider('connections', connectionProvider);
|
|
|
|
|
|
|
|
|
@ -34,10 +35,6 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
|
|
|
|
|
|
|
let text = editor.document.getText(selection);
|
|
|
|
|
|
|
|
|
|
console.log(text);
|
|
|
|
|
|
|
|
|
|
let myOutputChannel = vscode.window.createOutputChannel('SQL Query Results');
|
|
|
|
|
|
|
|
|
|
if (!dbSession) {
|
|
|
|
|
let extPath = vscode.extensions.getExtension("todie.frog").extensionPath;
|
|
|
|
|
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']
|
|
|
|
|
|
|
|
|
|
if (!json['rows']) {
|
|
|
|
|
if (!json['userErrors']) {
|
|
|
|
|
myOutputChannel.append("SQL executed successfully.\n");
|
|
|
|
|
} else {
|
|
|
|
|
myOutputChannel.append(JSON.stringify(json, null ,2));
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for (let row of json["rows"]) {
|
|
|
|
|
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 = "";
|
|
|
|
|
} catch (e) {}
|
|
|
|
|
});
|
|
|
|
@ -72,6 +73,11 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
|
|
myOutputChannel.show();
|
|
|
|
|
myOutputChannel.append(data.toString());
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
dbSession.on('close', (code) => {
|
|
|
|
|
console.log(`child process exited with code ${code}`);
|
|
|
|
|
dbSession = null;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!text) {
|
|
|
|
@ -79,7 +85,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
myOutputChannel.append("-- DATUM HIER -------------------------------\nExecuting: '" + text + "'\n");
|
|
|
|
|
myOutputChannel.append("-- " + new Date() + " -------------------------------\n"); //Executing: '" + text + "'\n");
|
|
|
|
|
dbSession.stdin.write(text + "\n--- END ---\n");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|