mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
Handle no azdata API in sql db proj extension gracefully (#15873)
* Update db proj ext to handle not having azdata API available * Fixes * Fix compile
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import type * as azdataType from 'azdata';
|
||||
import { DataSource } from './dataSources';
|
||||
import * as constants from '../../common/constants';
|
||||
|
||||
@@ -87,8 +87,8 @@ export class SqlConnectionDataSource extends DataSource {
|
||||
return new SqlConnectionDataSource(json.name, (json.data as unknown as SqlConnectionDataSourceJson).connectionString);
|
||||
}
|
||||
|
||||
public getConnectionProfile(): azdata.IConnectionProfile {
|
||||
const connProfile: azdata.IConnectionProfile = {
|
||||
public getConnectionProfile(): azdataType.IConnectionProfile {
|
||||
const connProfile: azdataType.IConnectionProfile = {
|
||||
serverName: this.server,
|
||||
databaseName: this.database,
|
||||
connectionName: this.name,
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as xmldom from 'xmldom';
|
||||
import * as constants from '../../common/constants';
|
||||
import * as utils from '../../common/utils';
|
||||
@@ -67,13 +66,13 @@ async function readConnectionString(xmlDoc: any): Promise<{ connectionId: string
|
||||
|
||||
try {
|
||||
if (dataSource.integratedSecurity) {
|
||||
const connection = await azdata.connection.connect(connectionProfile, false, false);
|
||||
const connection = await utils.getAzdataApi()!.connection.connect(connectionProfile, false, false);
|
||||
connId = connection.connectionId;
|
||||
server = dataSource.server;
|
||||
username = constants.defaultUser;
|
||||
}
|
||||
else {
|
||||
const connection = await azdata.connection.openConnectionDialog(undefined, connectionProfile);
|
||||
const connection = await utils.getAzdataApi()!.connection.openConnectionDialog(undefined, connectionProfile);
|
||||
connId = connection.connectionId;
|
||||
server = connection.options['server'];
|
||||
username = connection.options['user'];
|
||||
|
||||
Reference in New Issue
Block a user