Refactoring

This commit is contained in:
Thorsten Muerell
2017-11-02 14:52:26 +01:00
parent 14db6108f2
commit 53b6d35265
2 changed files with 7 additions and 5 deletions

View File

@@ -34,10 +34,11 @@ export class SessionManager {
public set currentConnection(c : ConnectionNode) {
this.statusBarItem.text = c.name;
if (this.dbSession) this.closeSession();
this._currentConnection = c;
}
public get currentConnection() : ConnectionNode {
return this.currentConnection;
return this._currentConnection;
}
public isSessionActive() : boolean {
@@ -51,10 +52,10 @@ export class SessionManager {
this.dbSession = null;
}
public check() {
public check() : boolean {
if (!this.currentConnection) {
vscode.window.showWarningMessage('No connection selected');
return;
return false;
}
let extPath = vscode.extensions.getExtension("todie.frog").extensionPath;
@@ -129,10 +130,11 @@ export class SessionManager {
this.dbSession = null;
});
return true;
}
public execute(text : string, rowLimit : number) {
this.check();
if (!this.check()) return;
this.outputChannel.append("-- " + new Date() + " -------------------------------\n"); //Executing: '" + text + "'\n");
let input = { "sql": text, "rowLimit": rowLimit };