How to use the azdata.dataprotocol function in azdata

To help you get started, we’ve selected a few azdata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dzsquared / sqlops-firstresponderkit / src / updateCheck.ts View on Github external
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;
github dzsquared / query-editor-boost / src / connectHolder.ts View on Github external
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);
            }
        }

    }
github dzsquared / query-editor-boost / src / changeDatabase.ts View on Github external
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");
    }
};
github dzsquared / query-editor-boost / src / placescript.ts View on Github external
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);
        }
    }

azdata

The azdata NPM module provides Azure Data Studio extension authors tools to write extensions. It provides the azdata.d.ts node module (all accessible API for extensions) as well as commands for compiling and testing extensions.

MIT
Latest version published 6 years ago

Package Health Score

63 / 100
Full package analysis