mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
This reverts commit 9a22c429a9.
This commit is contained in:
@@ -170,7 +170,4 @@ export class DacFxTestService implements mssql.IDacFxService {
|
|||||||
};
|
};
|
||||||
return Promise.resolve(streamingJobValidationResult);
|
return Promise.resolve(streamingJobValidationResult);
|
||||||
}
|
}
|
||||||
parseTSqlScript(filePath: string, databaseSchemaProvider: string): Thenable<mssql.ParseTSqlScriptResult> {
|
|
||||||
return Promise.resolve({ containsCreateTableStatement: true });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||||
"version": "4.1.0.9",
|
"version": "4.1.0.4",
|
||||||
"downloadFileNames": {
|
"downloadFileNames": {
|
||||||
"Windows_86": "win-x86-net6.0.zip",
|
"Windows_86": "win-x86-net6.0.zip",
|
||||||
"Windows_64": "win-x64-net6.0.zip",
|
"Windows_64": "win-x64-net6.0.zip",
|
||||||
|
|||||||
@@ -545,11 +545,6 @@ export interface ValidateStreamingJobParams {
|
|||||||
createStreamingJobTsql: string
|
createStreamingJobTsql: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ParseTSqlScriptParams {
|
|
||||||
filePath: string;
|
|
||||||
databaseSchemaProvider: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace ExportRequest {
|
export namespace ExportRequest {
|
||||||
export const type = new RequestType<ExportParams, mssql.DacFxResult, void, void>('dacfx/export');
|
export const type = new RequestType<ExportParams, mssql.DacFxResult, void, void>('dacfx/export');
|
||||||
}
|
}
|
||||||
@@ -582,10 +577,6 @@ export namespace ValidateStreamingJobRequest {
|
|||||||
export const type = new RequestType<ValidateStreamingJobParams, mssql.ValidateStreamingJobResult, void, void>('dacfx/validateStreamingJob');
|
export const type = new RequestType<ValidateStreamingJobParams, mssql.ValidateStreamingJobResult, void, void>('dacfx/validateStreamingJob');
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace ParseTSqlScriptRequest {
|
|
||||||
export const type = new RequestType<ParseTSqlScriptParams, mssql.ParseTSqlScriptResult, void, void>('dacfx/parseTSqlScript');
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------- </ DacFx > ------------------------------------
|
// ------------------------------- </ DacFx > ------------------------------------
|
||||||
|
|
||||||
// ------------------------------- <CMS> ----------------------------------------
|
// ------------------------------- <CMS> ----------------------------------------
|
||||||
|
|||||||
@@ -130,15 +130,4 @@ export class DacFxService implements mssql.IDacFxService {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async parseTSqlScript(filePath: string, databaseSchemaProvider: string): Promise<mssql.ParseTSqlScriptResult> {
|
|
||||||
const params: contracts.ParseTSqlScriptParams = { filePath, databaseSchemaProvider };
|
|
||||||
try {
|
|
||||||
const result = await this.client.sendRequest(contracts.ParseTSqlScriptRequest.type, params);
|
|
||||||
return result;
|
|
||||||
} catch (e) {
|
|
||||||
this.client.logFailedRequest(contracts.ParseTSqlScriptRequest.type, e);
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
5
extensions/mssql/src/mssql.d.ts
vendored
5
extensions/mssql/src/mssql.d.ts
vendored
@@ -391,7 +391,6 @@ declare module 'mssql' {
|
|||||||
generateDeployPlan(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<GenerateDeployPlanResult>;
|
generateDeployPlan(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<GenerateDeployPlanResult>;
|
||||||
getOptionsFromProfile(profilePath: string): Thenable<DacFxOptionsResult>;
|
getOptionsFromProfile(profilePath: string): Thenable<DacFxOptionsResult>;
|
||||||
validateStreamingJob(packageFilePath: string, createStreamingJobTsql: string): Thenable<ValidateStreamingJobResult>;
|
validateStreamingJob(packageFilePath: string, createStreamingJobTsql: string): Thenable<ValidateStreamingJobResult>;
|
||||||
parseTSqlScript(filePath: string, databaseSchemaProvider: string): Thenable<ParseTSqlScriptResult>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DacFxResult extends azdata.ResultStatus {
|
export interface DacFxResult extends azdata.ResultStatus {
|
||||||
@@ -409,10 +408,6 @@ declare module 'mssql' {
|
|||||||
export interface ValidateStreamingJobResult extends azdata.ResultStatus {
|
export interface ValidateStreamingJobResult extends azdata.ResultStatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ParseTSqlScriptResult {
|
|
||||||
containsCreateTableStatement: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ExportParams {
|
export interface ExportParams {
|
||||||
databaseName: string;
|
databaseName: string;
|
||||||
packageFilePath: string;
|
packageFilePath: string;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import * as utils from '../common/utils';
|
|||||||
import * as xmlFormat from 'xml-formatter';
|
import * as xmlFormat from 'xml-formatter';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||||
import * as mssql from 'mssql';
|
|
||||||
|
|
||||||
import { Uri, window } from 'vscode';
|
import { Uri, window } from 'vscode';
|
||||||
import { EntryType, IDatabaseReferenceProjectEntry, IProjectEntry, ISqlProject, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
import { EntryType, IDatabaseReferenceProjectEntry, IProjectEntry, ISqlProject, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||||
@@ -248,19 +247,14 @@ export class Project implements ISqlProject {
|
|||||||
const fileEntries: FileProjectEntry[] = [];
|
const fileEntries: FileProjectEntry[] = [];
|
||||||
for (let f of Array.from(filesSet.values())) {
|
for (let f of Array.from(filesSet.values())) {
|
||||||
const typeEntry = entriesWithType.find(e => e.relativePath === f);
|
const typeEntry = entriesWithType.find(e => e.relativePath === f);
|
||||||
let containsCreateTableStatement = false;
|
let containsCreateTableStatement;
|
||||||
|
|
||||||
// read file to check if it has a "Create Table" statement
|
// read file to check if it has a "Create Table" statement
|
||||||
const fullPath = path.join(utils.getPlatformSafeFileEntryPath(this.projectFolderPath), utils.getPlatformSafeFileEntryPath(f));
|
const fullPath = path.join(utils.getPlatformSafeFileEntryPath(this.projectFolderPath), utils.getPlatformSafeFileEntryPath(f));
|
||||||
|
|
||||||
if (utils.getAzdataApi()) {
|
if (await utils.exists(fullPath)) {
|
||||||
const dacFxService = await utils.getDacFxService() as mssql.IDacFxService;
|
const fileContents = await fs.readFile(fullPath);
|
||||||
try {
|
containsCreateTableStatement = fileContents.toString().toLowerCase().includes('create table');
|
||||||
const result = await dacFxService.parseTSqlScript(fullPath, this.getProjectTargetVersion());
|
|
||||||
containsCreateTableStatement = result.containsCreateTableStatement;
|
|
||||||
} catch (e) {
|
|
||||||
console.error(utils.getErrorMessage(e));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fileEntries.push(this.createFileProjectEntry(f, EntryType.File, typeEntry ? typeEntry.typeAttribute : undefined, containsCreateTableStatement));
|
fileEntries.push(this.createFileProjectEntry(f, EntryType.File, typeEntry ? typeEntry.typeAttribute : undefined, containsCreateTableStatement));
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ export class MockDacFxService implements mssql.IDacFxService {
|
|||||||
public generateDeployPlan(_: string, __: string, ___: string, ____: azdata.TaskExecutionMode): Thenable<mssql.GenerateDeployPlanResult> { return Promise.resolve(mockDacFxResult); }
|
public generateDeployPlan(_: string, __: string, ___: string, ____: azdata.TaskExecutionMode): Thenable<mssql.GenerateDeployPlanResult> { return Promise.resolve(mockDacFxResult); }
|
||||||
public getOptionsFromProfile(_: string): Thenable<mssql.DacFxOptionsResult> { return Promise.resolve(mockDacFxOptionsResult); }
|
public getOptionsFromProfile(_: string): Thenable<mssql.DacFxOptionsResult> { return Promise.resolve(mockDacFxOptionsResult); }
|
||||||
public validateStreamingJob(_: string, __: string): Thenable<mssql.ValidateStreamingJobResult> { return Promise.resolve(mockDacFxResult); }
|
public validateStreamingJob(_: string, __: string): Thenable<mssql.ValidateStreamingJobResult> { return Promise.resolve(mockDacFxResult); }
|
||||||
public parseTSqlScript(_: string, __: string): Thenable<mssql.ParseTSqlScriptResult> { return Promise.resolve({ containsCreateTableStatement: true }); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createContext(): TestContext {
|
export function createContext(): TestContext {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as constants from '../common/constants';
|
import * as constants from '../common/constants';
|
||||||
import * as templates from '../templates/templates';
|
|
||||||
|
|
||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import should = require('should');
|
import should = require('should');
|
||||||
@@ -35,10 +34,6 @@ export async function createTestSqlProjFile(contents: string, folderPath?: strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function createTestProject(contents: string, folderPath?: string): Promise<Project> {
|
export async function createTestProject(contents: string, folderPath?: string): Promise<Project> {
|
||||||
const macroDict: Record<string, string> = {
|
|
||||||
'PROJECT_DSP': constants.defaultDSP
|
|
||||||
};
|
|
||||||
contents = templates.macroExpansion(contents, macroDict);
|
|
||||||
return await Project.openProject(await createTestSqlProjFile(contents, folderPath));
|
return await Project.openProject(await createTestSqlProjFile(contents, folderPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user