Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set @versionno = '1/1/1900'
ELSE
BEGIN
BEGIN TRY
exec sp_blitz @VERSIONCHECKMODE = 1, @VERSION = @VERSION OUTPUT, @versiondate = @versionno output;
END TRY
BEGIN CATCH
exec sp_blitz @help = 1, @versiondate = @versionno output
END CATCH
END
select convert(varchar(10),@versionno,112) as versionno`;
if (connectId) {
let connectionUri = await sqlops.connection.getUriForConnection(connectId);
let queryProvider = sqlops.dataprotocol.getProvider(context.connectionProfile.providerName, sqlops.DataProviderType.QueryProvider);
let results = await queryProvider.runQueryAndReturn(connectionUri, query);
let cell = results.rows[0][0];
let currentVersion = cell.displayValue;
//get live most recent version from github
var options = {
uri: baseUrl,
headers: {
'Authorization': apitoken,
'User-Agent': 'Request-Promise'
},
json: true,
simple: false
};
var scriptText = await request.get(options);
let recentVersion = scriptText.tag_name;
export async function utilizeConnection(doc: vscode.TextDocument, actualConnectionInfo: actualConnectionInfo) {
if ( actualConnectionInfo.connectHoldId ) {
if (actualConnectionInfo.dbName !== '') {
let dProvider = await azdata.dataprotocol.getProvider(actualConnectionInfo.providerId, azdata.DataProviderType.ConnectionProvider);
let connectionUri = await azdata.connection.getUriForConnection(actualConnectionInfo.connectHoldId);
await dProvider.changeDatabase(connectionUri,actualConnectionInfo.dbName);
await azdata.queryeditor.connect(doc.uri.toString(), actualConnectionInfo.connectHoldId);
}
}
}
export async function changeDatabase(databaseList, connection) {
let connectionUri = await azdata.connection.getUriForConnection(connection.connectionId);
let dProvider = await azdata.dataprotocol.getProvider(connection.providerId, azdata.DataProviderType.ConnectionProvider);
if (dProvider.providerId == "MSSQL") {
let selectedDatabase = await vscode.window.showQuickPick(databaseList,
{ placeHolder: 'Select Database', "ignoreFocusOut": true}
);
let useThisDB = selectedDatabase;
await dProvider.changeDatabase(connectionUri,useThisDB);
await azdata.queryeditor.connect(vscode.window.activeTextEditor.document.uri.toString(), connection.connectionId);
} else {
vscode.window.showErrorMessage("Sorry, use database is only supported for MS SQL");
}
};
let charAt: number = workbenchConfig.get('DefaultQueryCharacter');
if (lineAt >= 0 && charAt >= 0) {
let newPosition: vscode.Position = new vscode.Position(lineAt, charAt);
let newSelection = new vscode.Selection(newPosition, newPosition);
editor.selection = newSelection;
}
if ((context || connection) && this.connectionId) {
if (this.dbName !== '') {
var providerName:string;
if (context) {
providerName = context.connectionProfile.providerName;
} else if (connection) {
providerName = connection.providerId;
}
let dProvider = await sqlops.dataprotocol.getProvider(providerName, sqlops.DataProviderType.ConnectionProvider);
let connectionUri = await sqlops.connection.getUriForConnection(this.connectionId);
await dProvider.changeDatabase(connectionUri,this.dbName);
}
await sqlops.queryeditor.connect(doc.uri.toString(), this.connectionId);
}
} catch (err) {
vscode.window.showErrorMessage(err);
}
}