mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -05:00
resend previous PR with test fixes (#19912)
* Revert "Revert "use reliable way to detect createtable statements (#19897)" (#19906)"
This reverts commit c211fb981c.
* fix tests
* fix test cases
This commit is contained in:
@@ -545,6 +545,11 @@ export interface ValidateStreamingJobParams {
|
||||
createStreamingJobTsql: string
|
||||
}
|
||||
|
||||
export interface ParseTSqlScriptParams {
|
||||
filePath: string;
|
||||
databaseSchemaProvider: string;
|
||||
}
|
||||
|
||||
export namespace ExportRequest {
|
||||
export const type = new RequestType<ExportParams, mssql.DacFxResult, void, void>('dacfx/export');
|
||||
}
|
||||
@@ -577,6 +582,10 @@ export namespace ValidateStreamingJobRequest {
|
||||
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 > ------------------------------------
|
||||
|
||||
// ------------------------------- <CMS> ----------------------------------------
|
||||
|
||||
@@ -130,4 +130,15 @@ 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,6 +391,7 @@ declare module 'mssql' {
|
||||
generateDeployPlan(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable<GenerateDeployPlanResult>;
|
||||
getOptionsFromProfile(profilePath: string): Thenable<DacFxOptionsResult>;
|
||||
validateStreamingJob(packageFilePath: string, createStreamingJobTsql: string): Thenable<ValidateStreamingJobResult>;
|
||||
parseTSqlScript(filePath: string, databaseSchemaProvider: string): Thenable<ParseTSqlScriptResult>;
|
||||
}
|
||||
|
||||
export interface DacFxResult extends azdata.ResultStatus {
|
||||
@@ -408,6 +409,10 @@ declare module 'mssql' {
|
||||
export interface ValidateStreamingJobResult extends azdata.ResultStatus {
|
||||
}
|
||||
|
||||
export interface ParseTSqlScriptResult {
|
||||
containsCreateTableStatement: boolean;
|
||||
}
|
||||
|
||||
export interface ExportParams {
|
||||
databaseName: string;
|
||||
packageFilePath: string;
|
||||
|
||||
Reference in New Issue
Block a user