Merge master

This commit is contained in:
Kevin Cunnane
2018-11-04 15:15:27 -08:00
41 changed files with 655 additions and 327 deletions

View File

@@ -2,7 +2,7 @@
"name": "agent",
"displayName": "SQL Server Agent",
"description": "Manage and troubleshoot SQL Server Agent jobs",
"version": "0.34.0",
"version": "0.35.0",
"publisher": "Microsoft",
"preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt",

View File

@@ -9,6 +9,7 @@ import * as vscode from 'vscode';
import * as sqlops from 'sqlops';
import { AgentUtils } from '../agentUtils';
import { IAgentDialogData, AgentDialogMode } from '../interfaces';
import { JobData } from './jobData';
const localize = nls.loadMessageBundle();
@@ -45,8 +46,19 @@ export class AlertData implements IAgentDialogData {
wmiEventNamespace: string;
wmiEventQuery: string;
constructor(ownerUri:string, alertInfo: sqlops.AgentAlertInfo) {
private viaJobDialog: boolean;
private jobModel: JobData;
constructor(
ownerUri:string,
alertInfo: sqlops.AgentAlertInfo,
jobModel?: JobData,
viaJobDialog: boolean = false
) {
this.ownerUri = ownerUri;
this.viaJobDialog = viaJobDialog;
this.jobModel = jobModel;
this.jobName = this.jobName ? this.jobName : this.jobModel.name;
if (alertInfo) {
this.dialogMode = AgentDialogMode.EDIT;
@@ -60,7 +72,6 @@ export class AlertData implements IAgentDialogData {
this.includeEventDescription = alertInfo.includeEventDescription.toString();
this.isEnabled = alertInfo.isEnabled;
this.jobId = alertInfo.jobId;
this.jobName = alertInfo.jobName;
this.lastOccurrenceDate = alertInfo.lastOccurrenceDate;
this.lastResponseDate = alertInfo.lastResponseDate;
this.messageId = alertInfo.messageId;
@@ -82,10 +93,18 @@ export class AlertData implements IAgentDialogData {
public async save() {
let agentService = await AgentUtils.getAgentService();
let result = this.dialogMode === AgentDialogMode.CREATE
? await agentService.createAlert(this.ownerUri, this.toAgentAlertInfo())
: await agentService.updateAlert(this.ownerUri, this.originalName, this.toAgentAlertInfo());
let result: any;
// if it's called via the job dialog, add it to the
// job model
if (this.viaJobDialog) {
if (this.jobModel) {
Promise.resolve(this);
return;
}
} else {
// has to be a create alert
result = await agentService.createAlert(this.ownerUri, this.toAgentAlertInfo());
}
if (!result || !result.success) {
vscode.window.showErrorMessage(
localize('alertData.saveErrorMessage', "Alert update failed '{0}'", result.errorMessage ? result.errorMessage : 'Unknown'));

View File

@@ -44,6 +44,7 @@ export class JobData implements IAgentDialogData {
public jobSteps: sqlops.AgentJobStepInfo[];
public jobSchedules: sqlops.AgentJobScheduleInfo[];
public alerts: sqlops.AgentAlertInfo[];
public jobId: string;
constructor(
ownerUri: string,
@@ -62,6 +63,7 @@ export class JobData implements IAgentDialogData {
this.jobSteps = jobInfo.JobSteps;
this.jobSchedules = jobInfo.JobSchedules;
this.alerts = jobInfo.Alerts;
this.jobId = jobInfo.jobId;
}
}
@@ -115,7 +117,6 @@ export class JobData implements IAgentDialogData {
let result = this.dialogMode === AgentDialogMode.CREATE
? await this._agentService.createJob(this.ownerUri, jobInfo)
: await this._agentService.updateJob(this.ownerUri, this.originalName, jobInfo);
if (!result || !result.success) {
vscode.window.showErrorMessage(
localize('jobData.saveErrorMessage', "Job update failed '{0}'", result.errorMessage ? result.errorMessage : 'Unknown'));
@@ -135,18 +136,6 @@ export class JobData implements IAgentDialogData {
};
}
public addJobSchedule(schedule: sqlops.AgentJobScheduleInfo) {
if (this.jobSchedules) {
let existingSchedule = this.jobSchedules.find(item => item.name === schedule.name);
if (!existingSchedule) {
this.jobSchedules.push(schedule);
}
} else {
this.jobSchedules = [];
this.jobSchedules.push(schedule);
}
}
public toAgentJobInfo(): sqlops.AgentJobInfo {
return {
name: this.name,
@@ -177,7 +166,7 @@ export class JobData implements IAgentDialogData {
categoryType: 1, // LocalJob, hard-coding the value, corresponds to the target tab in SSMS
lastRun: '',
nextRun: '',
jobId: ''
jobId: this.jobId
};
}
}

View File

@@ -46,11 +46,13 @@ export class JobStepData implements IAgentDialogData {
public retryInterval: number;
public proxyName: string;
private jobModel: JobData;
private viaJobDialog: boolean;
constructor(ownerUri:string, jobModel?: JobData) {
constructor(ownerUri:string, jobModel?: JobData, viaJobDialog: boolean = false) {
this.ownerUri = ownerUri;
this.jobName = jobModel.name;
this.jobModel = jobModel;
this.viaJobDialog = viaJobDialog;
}
public async initialize() {
@@ -59,18 +61,16 @@ export class JobStepData implements IAgentDialogData {
public async save() {
let agentService = await AgentUtils.getAgentService();
let result: any;
if (this.dialogMode === AgentDialogMode.CREATE) {
if (this.jobModel && this.jobModel.dialogMode === AgentDialogMode.CREATE) {
// create job -> create step
// if it's called via the job dialog, add it to the
// job model
if (this.viaJobDialog) {
if (this.jobModel) {
Promise.resolve(this);
return;
} else {
// edit job -> create step
result = await agentService.createJobStep(this.ownerUri, JobStepData.convertToAgentJobStepInfo(this));
}
} else if (this.jobModel && this.jobModel.dialogMode === AgentDialogMode.EDIT) {
// edit job -> edit step
result = await agentService.updateJobStep(this.ownerUri, this.stepName, JobStepData.convertToAgentJobStepInfo(this));
} else {
// has to be a create step
result = await agentService.createJobStep(this.ownerUri, JobStepData.convertToAgentJobStepInfo(this));
}
if (!result || !result.success) {
vscode.window.showErrorMessage(

View File

@@ -29,8 +29,6 @@ export class PickScheduleData implements IAgentDialogData {
}
public async save() {
let agentService = await AgentUtils.getAgentService();
this.selectedSchedule.jobName = this.jobName;
let result = await agentService.createJobSchedule(this.ownerUri, this.selectedSchedule);
}
}

View File

@@ -12,6 +12,7 @@ import { AgentUtils } from '../agentUtils';
import { AlertData } from '../data/alertData';
import { OperatorDialog } from './operatorDialog';
import { JobDialog } from './jobDialog';
import { JobData } from '../data/jobData';
const localize = nls.loadMessageBundle();
@@ -148,14 +149,23 @@ export class AlertDialog extends AgentDialog<AlertData> {
private delayMinutesTextBox: sqlops.InputBoxComponent;
private delaySecondsTextBox: sqlops.InputBoxComponent;
private jobs: string[];
private databases: string[];
private jobModel: JobData;
public jobId: string;
public jobName: string;
constructor(ownerUri: string, alertInfo: sqlops.AgentAlertInfo = undefined, jobs: string[]) {
constructor(
ownerUri: string,
jobModel: JobData,
alertInfo: sqlops.AgentAlertInfo = undefined,
viaJobDialog: boolean = false
) {
super(ownerUri,
new AlertData(ownerUri, alertInfo),
new AlertData(ownerUri, alertInfo, jobModel, viaJobDialog),
alertInfo ? AlertDialog.EditDialogTitle : AlertDialog.CreateDialogTitle);
this.jobs = jobs;
this.jobModel = jobModel;
this.jobId = this.jobId ? this.jobId : this.jobModel.jobId;
this.jobName = this.jobName ? this.jobName : this.jobModel.name;
}
protected async initializeDialog(dialog: sqlops.window.modelviewdialog.Dialog) {
@@ -512,7 +522,8 @@ export class AlertDialog extends AgentDialog<AlertData> {
protected updateModel() {
this.model.name = this.nameTextBox.value;
this.model.isEnabled = this.enabledCheckBox.checked;
this.model.jobId = this.jobId;
this.model.jobName = this.jobName;
this.model.alertType = this.getDropdownValue(this.typeDropDown);
let databaseName = this.getDropdownValue(this.databaseDropDown);
this.model.databaseName = (databaseName !== AlertDialog.AllDatabases) ? databaseName : undefined;

View File

@@ -11,6 +11,7 @@ import { PickScheduleDialog } from './pickScheduleDialog';
import { AlertDialog } from './alertDialog';
import { AgentDialog } from './agentDialog';
import { AgentUtils } from '../agentUtils';
import { JobStepData } from '../data/jobStepData';
const localize = nls.loadMessageBundle();
@@ -110,11 +111,19 @@ export class JobDialog extends AgentDialog<JobData> {
private newAlertButton: sqlops.ButtonComponent;
private isEdit: boolean = false;
// Job objects
private steps: sqlops.AgentJobStepInfo[];
private schedules: sqlops.AgentJobScheduleInfo[];
private alerts: sqlops.AgentAlertInfo[] = [];
constructor(ownerUri: string, jobInfo: sqlops.AgentJobInfo = undefined) {
super(
ownerUri,
new JobData(ownerUri, jobInfo),
jobInfo ? JobDialog.EditDialogTitle : JobDialog.CreateDialogTitle);
this.steps = this.model.jobSteps ? this.model.jobSteps : [];
this.schedules = this.model.jobSchedules ? this.model.jobSchedules : [];
this.alerts = this.model.alerts ? this.model.alerts : [];
this.isEdit = jobInfo ? true : false;
}
@@ -198,12 +207,7 @@ export class JobDialog extends AgentDialog<JobData> {
private initializeStepsTab() {
this.stepsTab.registerContent(async view => {
let previewTag = view.modelBuilder.text()
.withProperties({
value: 'Feature Preview'
}).component();
let steps = this.model.jobSteps ? this.model.jobSteps : [];
let data = this.convertStepsToData(steps);
let data = this.steps ? this.convertStepsToData(this.steps) : [];
this.stepsTable = view.modelBuilder.table()
.withProperties({
columns: [
@@ -237,13 +241,11 @@ export class JobDialog extends AgentDialog<JobData> {
width: 80
}).component();
let stepDialog = new JobStepDialog(this.model.ownerUri, '' , this.model);
let stepDialog = new JobStepDialog(this.model.ownerUri, '' , this.model, null, true);
stepDialog.onSuccess((step) => {
if (!this.model.jobSteps) {
this.model.jobSteps = [];
}
this.model.jobSteps.push(step);
this.stepsTable.data = this.convertStepsToData(this.model.jobSteps);
let stepInfo = JobStepData.convertToAgentJobStepInfo(step);
this.steps.push(stepInfo);
this.stepsTable.data = this.convertStepsToData(this.steps);
});
this.newStepButton.onDidClick((e)=>{
if (this.nameTextBox.value && this.nameTextBox.value.length > 0) {
@@ -277,7 +279,7 @@ export class JobDialog extends AgentDialog<JobData> {
this.deleteStepButton.enabled = true;
this.editStepButton.enabled = true;
this.editStepButton.onDidClick(() => {
let stepDialog = new JobStepDialog(this.model.ownerUri, '' , this.model, stepData);
let stepDialog = new JobStepDialog(this.model.ownerUri, '' , this.model, stepData, true);
stepDialog.openDialog();
});
@@ -287,7 +289,6 @@ export class JobDialog extends AgentDialog<JobData> {
agentService.deleteJobStep(this.ownerUri, stepData).then((result) => {
if (result && result.success) {
delete steps[rowNumber];
this.model.jobSteps = steps;
let data = this.convertStepsToData(steps);
this.stepsTable.data = data;
}
@@ -299,10 +300,6 @@ export class JobDialog extends AgentDialog<JobData> {
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: previewTag,
title: ''
},
{
component: this.stepsTable,
title: this.JobStepsTopLabelString,
actions: [this.moveStepUpButton, this.moveStepDownButton, this.newStepButton, this.editStepButton, this.deleteStepButton]
@@ -313,10 +310,6 @@ export class JobDialog extends AgentDialog<JobData> {
private initializeAlertsTab() {
this.alertsTab.registerContent(async view => {
let previewTag = view.modelBuilder.text()
.withProperties({
value: 'Feature Preview'
}).component();
let alerts = this.model.alerts ? this.model.alerts : [];
let data = this.convertAlertsToData(alerts);
this.alertsTable = view.modelBuilder.table()
@@ -327,7 +320,7 @@ export class JobDialog extends AgentDialog<JobData> {
this.AlertTypeLabelString
],
data: data,
height: 430,
height: 750,
width: 400
}).component();
@@ -336,18 +329,24 @@ export class JobDialog extends AgentDialog<JobData> {
width: 80
}).component();
this.newAlertButton.onDidClick((e)=>{
let alertDialog = new AlertDialog(this.model.ownerUri, null, []);
alertDialog.onSuccess((dialogModel) => {
});
alertDialog.openDialog();
let alertDialog = new AlertDialog(this.model.ownerUri, this.model, null, true);
alertDialog.onSuccess((alert) => {
let alertInfo = alert.toAgentAlertInfo();
this.alerts.push(alertInfo);
this.alertsTable.data = this.convertAlertsToData(this.alerts);
});
this.newAlertButton.onDidClick(()=>{
if (this.nameTextBox.value && this.nameTextBox.value.length > 0) {
alertDialog.jobId = this.model.jobId;
alertDialog.jobName = this.model.name ? this.model.name : this.nameTextBox.value;
alertDialog.openDialog();
} else {
this.dialog.message = { text: this.BlankJobNameErrorText };
}
});
let formModel = view.modelBuilder.formContainer()
.withFormItems([{
component: previewTag,
title: ''
}, {
component: this.alertsTable,
title: this.AlertsTopLabelString,
actions: [this.newAlertButton]
@@ -380,8 +379,11 @@ export class JobDialog extends AgentDialog<JobData> {
pickScheduleDialog.onSuccess((dialogModel) => {
let selectedSchedule = dialogModel.selectedSchedule;
if (selectedSchedule) {
selectedSchedule.jobName = this.model.name;
this.model.addJobSchedule(selectedSchedule);
let existingSchedule = this.schedules.find(item => item.name === selectedSchedule.name);
if (!existingSchedule) {
selectedSchedule.jobName = this.model.name ? this.model.name : this.nameTextBox.value;
this.schedules.push(selectedSchedule);
}
this.populateScheduleTable();
}
});
@@ -402,8 +404,7 @@ export class JobDialog extends AgentDialog<JobData> {
}
private populateScheduleTable() {
let schedules = this.model.jobSchedules ? this.model.jobSchedules : [];
let data = this.convertSchedulesToData(schedules);
let data = this.convertSchedulesToData(this.schedules);
if (data.length > 0) {
this.schedulesTable.data = data;
this.schedulesTable.height = 750;
@@ -566,5 +567,17 @@ export class JobDialog extends AgentDialog<JobData> {
this.model.pageLevel = this.getActualConditionValue(this.pagerCheckBox, this.pagerConditionDropdown);
this.model.eventLogLevel = this.getActualConditionValue(this.eventLogCheckBox, this.eventLogConditionDropdown);
this.model.deleteLevel = this.getActualConditionValue(this.deleteJobCheckBox, this.deleteJobConditionDropdown);
if (!this.model.jobSteps) {
this.model.jobSteps = [];
}
this.model.jobSteps = this.steps;
if (!this.model.jobSchedules) {
this.model.jobSchedules = [];
}
this.model.jobSchedules = this.schedules;
if (!this.model.alerts) {
this.model.alerts = [];
}
this.model.alerts = this.alerts;
}
}

View File

@@ -118,9 +118,10 @@ export class JobStepDialog extends AgentDialog<JobStepData> {
server: string,
jobModel: JobData,
jobStepInfo?: sqlops.AgentJobStepInfo,
viaJobDialog: boolean = false
) {
super(ownerUri,
jobStepInfo ? JobStepData.convertToJobStepData(jobStepInfo, jobModel) : new JobStepData(ownerUri, jobModel),
jobStepInfo ? JobStepData.convertToJobStepData(jobStepInfo, jobModel) : new JobStepData(ownerUri, jobModel, viaJobDialog),
jobStepInfo ? JobStepDialog.EditDialogTitle : JobStepDialog.NewDialogTitle);
this.stepId = jobStepInfo ?
jobStepInfo.id : jobModel.jobSteps ?

View File

@@ -14,6 +14,7 @@ import { ProxyDialog } from './dialogs/proxyDialog';
import { JobStepDialog } from './dialogs/jobStepDialog';
import { PickScheduleDialog } from './dialogs/pickScheduleDialog';
import { JobData } from './data/jobData';
import { AgentUtils } from './agentUtils';
const localize = nls.loadMessageBundle();
@@ -41,17 +42,23 @@ export class MainController {
let dialog = new JobDialog(ownerUri, jobInfo);
dialog.openDialog();
});
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, server: string, jobData: JobData, jobStepInfo: sqlops.AgentJobStepInfo) => {
let dialog = new JobStepDialog(ownerUri, server, jobData, jobStepInfo);
dialog.openDialog();
vscode.commands.registerCommand('agent.openNewStepDialog', (ownerUri: string, server: string, jobInfo: sqlops.AgentJobInfo, jobStepInfo: sqlops.AgentJobStepInfo) => {
AgentUtils.getAgentService().then((agentService) => {
let jobData: JobData = new JobData(ownerUri, jobInfo, agentService);
let dialog = new JobStepDialog(ownerUri, server, jobData, jobStepInfo, false);
dialog.openDialog();
});
});
vscode.commands.registerCommand('agent.openPickScheduleDialog', (ownerUri: string, jobName: string) => {
let dialog = new PickScheduleDialog(ownerUri, jobName);
dialog.showDialog();
});
vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, alertInfo: sqlops.AgentAlertInfo, jobs: string[]) => {
let dialog = new AlertDialog(ownerUri, alertInfo, jobs);
dialog.openDialog();
vscode.commands.registerCommand('agent.openAlertDialog', (ownerUri: string, jobInfo: sqlops.AgentJobInfo, alertInfo: sqlops.AgentAlertInfo) => {
AgentUtils.getAgentService().then((agentService) => {
let jobData: JobData = new JobData(ownerUri, jobInfo, agentService);
let dialog = new AlertDialog(ownerUri, jobData, alertInfo, false);
dialog.openDialog();
});
});
vscode.commands.registerCommand('agent.openOperatorDialog', (ownerUri: string, operatorInfo: sqlops.AgentOperatorInfo) => {
let dialog = new OperatorDialog(ownerUri, operatorInfo);

View File

@@ -2,7 +2,7 @@
"name": "import",
"displayName": "SQL Server Import",
"description": "SQL Server Import for Azure Data Studio supports importing CSV or JSON files into SQL Server.",
"version": "0.3.0",
"version": "0.4.0",
"publisher": "Microsoft",
"preview": true,
"engines": {
@@ -42,33 +42,6 @@
"mac": "ctrl+i"
}
],
"dashboard.tabs": [
{
"id": "flat-file-import",
"title": "Flat File Import",
"description": "The flat file importer.",
"container": {
"flat-file-import-container": {}
}
}
],
"dashboard.containers": [
{
"id": "flat-file-import-container",
"container": {
"widgets-container": [
{
"name": "Tasks",
"widget": {
"tasks-widget": [
"flatFileImport.start"
]
}
}
]
}
}
],
"menus": {
"objectExplorer/item/context": [
{

View File

@@ -31,7 +31,7 @@ export class FlatFileWizard {
public async start(p: any, ...args: any[]) {
let model = <ImportDataModel>{};
let profile = <sqlops.IConnectionProfile>p.connectionProfile;
let profile = p ? <sqlops.IConnectionProfile>p.connectionProfile : null;
if (profile) {
model.serverId = profile.id;
model.database = profile.databaseName;

View File

@@ -42,18 +42,18 @@
"Create a new Table": {
"prefix": "sqlCreateTable",
"body": [
"-- Create a new table called '[${1:TableName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'",
"-- Create a new table called '[${1:TableName}]' in schema '[${2:dbo}]'",
"-- Drop the table if it already exists",
"IF OBJECT_ID('[${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]', 'U') IS NOT NULL",
"DROP TABLE [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]",
"IF OBJECT_ID('[${2:dbo}].[${1:TableName}]', 'U') IS NOT NULL",
"DROP TABLE [${2:dbo}].[${1:TableName}]",
"GO",
"-- Create the table in the specified database and schema",
"CREATE TABLE [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]",
"-- Create the table in the specified schema",
"CREATE TABLE [${2:dbo}].[${1:TableName}]",
"(",
"\t[${4:ColumnName}]Id INT NOT NULL PRIMARY KEY, -- Primary Key column",
"\t[${5:ColumnName1}] [NVARCHAR](50) NOT NULL,",
"\t[${6:ColumnName2}] [NVARCHAR](50) NOT NULL",
"\t-- Specify more columns here",
"\t[${3:Id}] INT NOT NULL PRIMARY KEY, -- Primary Key column",
"\t[${4:ColumnName2}] ${5:NVARCHAR(50)} NOT NULL,",
"\t[${6:ColumnName3}] ${7:NVARCHAR(50)} NOT NULL",
"\t$0-- Specify more columns here",
");",
"GO"
],
@@ -64,10 +64,10 @@
"Drop a Table": {
"prefix": "sqlDropTable",
"body": [
"-- Drop a table called '${3:TableName}' in schema '${2:SchemaName}' in Database '${1:DatabaseName}'",
"-- Drop a table called '${1:TableName}' in schema '${2:dbo}'",
"-- Drop the table if it already exists",
"IF OBJECT_ID('[${1:DatabaseName}].[${2:SchemaName}].[${3:TableName}]', 'U') IS NOT NULL",
"DROP TABLE [${1:DatabaseName}].[${2:SchemaName}].[${3:TableName}]",
"IF OBJECT_ID('[${2:dbo}].[${1:TableName}]', 'U') IS NOT NULL",
"DROP TABLE [${2:dbo}].[${1:TableName}]",
"GO"
],
"description": "Drop a Table"
@@ -76,9 +76,9 @@
"Add a new column to a Table": {
"prefix": "sqlAddColumn",
"body": [
"-- Add a new column '[${1:NewColumnName}]' to table '[${2:TableName}]' in schema '[${3:SchemaName}]' in database '[${4:DatabaseName}]'",
"ALTER TABLE [${4:DatabaseName}].[${3:SchemaName}].[${2:TableName}]",
"\tADD [${1:NewColumnName}] /*new_column_name*/ ${5:int} /*new_column_datatype*/ ${6:NULL} /*new_column_nullability*/",
"-- Add a new column '[${1:NewColumnName}]' to table '[${2:TableName}]' in schema '[${3:dbo}]'",
"ALTER TABLE [${3:dbo}].[${2:TableName}]",
"\tADD [${1:NewColumnName}] /*new_column_name*/ ${4:int} /*new_column_datatype*/ ${5:NULL} /*new_column_nullability*/",
"GO"
],
"description": "Add a new column to a Table"
@@ -87,8 +87,8 @@
"Drop a column from a Table": {
"prefix": "sqlDropColumn",
"body": [
"-- Drop '[${1:ColumnName}]' from table '[${2:TableName}]' in schema '[${3:SchemaName}]' in database '[${4:DatabaseName}]'",
"ALTER TABLE [${4:DatabaseName}].[${3:SchemaName}].[${2:TableName}]",
"-- Drop '[${1:ColumnName}]' from table '[${2:TableName}]' in schema '[${3:dbo}]'",
"ALTER TABLE [${3:dbo}].[${2:TableName}]",
"\tDROP COLUMN [${1:ColumnName}]",
"GO"
],
@@ -98,9 +98,9 @@
"Select rows from a Table or a View": {
"prefix": "sqlSelect",
"body": [
"-- Select rows from a Table or View '[${1:TableOrViewName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'",
"SELECT * FROM [${3:DatabaseName}].[${2:SchemaName}].[${1:TableOrViewName}]",
"WHERE ${4:/* add search conditions here */}",
"-- Select rows from a Table or View '[${1:TableOrViewName}]' in schema '[${2:dbo}]'",
"SELECT * FROM [${2:dbo}].[${1:TableOrViewName}]",
"WHERE ${3:/* add search conditions here */}",
"GO"
],
"description": "Select rows from a Table or a View"
@@ -109,17 +109,17 @@
"Insert rows into a Table": {
"prefix": "sqlInsertRows",
"body": [
"-- Insert rows into table '${1:TableName}' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'",
"INSERT INTO [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]",
"-- Insert rows into table '${1:TableName}' in schema '[${2:dbo}]'",
"INSERT INTO [${2:dbo}].[${1:TableName}]",
"( -- Columns to insert data into",
" ${4:[ColumnName1], [ColumnName2], [ColumnName3]}",
" ${3:[ColumnName1], [ColumnName2], [ColumnName3]}",
")",
"VALUES",
"( -- First row: values for the columns in the list above",
" ${5:ColumnValue1, ColumnValue2, ColumnValue3}",
" ${4:ColumnValue1, ColumnValue2, ColumnValue3}",
"),",
"( -- Second row: values for the columns in the list above",
" ${6:ColumnValue1, ColumnValue2, ColumnValue3}",
" ${5:ColumnValue1, ColumnValue2, ColumnValue3}",
")",
"-- Add more rows here",
"GO"
@@ -130,9 +130,9 @@
"Delete rows from a Table": {
"prefix": "sqlDeleteRows",
"body": [
"-- Delete rows from table '[${1:TableName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'",
"DELETE FROM [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]",
"WHERE ${4:/* add search conditions here */}",
"-- Delete rows from table '[${1:TableName}]' in schema '[${2:dbo}]'",
"DELETE FROM [${2:dbo}].[${1:TableName}]",
"WHERE ${3:/* add search conditions here */}",
"GO"
],
"description": "Delete rows from a Table"
@@ -141,13 +141,13 @@
"Update rows in a Table": {
"prefix": "sqlUpdateRows",
"body": [
"-- Update rows in table '[${1:TableName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'",
"UPDATE [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}]",
"-- Update rows in table '[${1:TableName}]' in schema '[${2:dbo}]'",
"UPDATE [${2:dbo}].[${1:TableName}]",
"SET",
"\t[${4:ColumnName1}] = ${5:ColumnValue1},",
"\t[${6:ColumnName2}] = ${7:ColumnValue2}",
"\t[${3:ColumnName1}] = ${4:ColumnValue1},",
"\t[${5:ColumnName2}] = ${6:ColumnValue2}",
"\t-- Add more columns and values here",
"WHERE ${8:/* add search conditions here */}",
"WHERE ${7:/* add search conditions here */}",
"GO"
],
"description": "Update rows in a Table"
@@ -156,27 +156,27 @@
"Create a stored procedure": {
"prefix": "sqlCreateStoredProc",
"body": [
"-- Create a new stored procedure called '${1:StoredProcedureName}' in schema '${2:SchemaName}'",
"-- Create a new stored procedure called '${1:StoredProcedureName}' in schema '${2:dbo}'",
"-- Drop the stored procedure if it already exists",
"IF EXISTS (",
"SELECT *",
"\tFROM INFORMATION_SCHEMA.ROUTINES",
"WHERE SPECIFIC_SCHEMA = N'${2:SchemaName}'",
"WHERE SPECIFIC_SCHEMA = N'${2:dbo}'",
"\tAND SPECIFIC_NAME = N'${1:StoredProcedureName}'",
")",
"DROP PROCEDURE ${2:SchemaName}.${1:StoredProcedureName}",
"DROP PROCEDURE ${2:dbo}.${1:StoredProcedureName}",
"GO",
"-- Create the stored procedure in the specified schema",
"CREATE PROCEDURE ${2:SchemaName}.${1:StoredProcedureName}",
"\t$3@param1 /*parameter name*/ int /*datatype_for_param1*/ = 0, /*default_value_for_param1*/",
"\t$4@param2 /*parameter name*/ int /*datatype_for_param1*/ = 0 /*default_value_for_param2*/",
"CREATE PROCEDURE ${2:dbo}.${1:StoredProcedureName}",
"\t$3@param1 /*parameter name*/ $4int /*datatype_for_param1*/ = 0, /*default_value_for_param1*/",
"\t$5@param2 /*parameter name*/ $6int /*datatype_for_param1*/ = 0 /*default_value_for_param2*/",
"-- add more stored procedure parameters here",
"AS",
"\t-- body of the stored procedure",
"\tSELECT @param1, @param2",
"GO",
"-- example to execute the stored procedure we just created",
"EXECUTE ${2:SchemaName}.${1:StoredProcedureName} 1 /*value_for_param1*/, 2 /*value_for_param2*/",
"EXECUTE ${2:dbo}.${1:StoredProcedureName} 1 /*value_for_param1*/, 2 /*value_for_param2*/",
"GO"
],
"description": "Create a stored procedure"
@@ -185,14 +185,14 @@
"Drop a stored procedure": {
"prefix": "sqlDropStoredProc",
"body": [
"-- Drop the stored procedure called '${1:StoredProcedureName}' in schema '${2:SchemaName}'",
"-- Drop the stored procedure called '${1:StoredProcedureName}' in schema '${2:dbo}'",
"IF EXISTS (",
"SELECT *",
"\tFROM INFORMATION_SCHEMA.ROUTINES",
"WHERE SPECIFIC_SCHEMA = N'${2:SchemaName}'",
"WHERE SPECIFIC_SCHEMA = N'${2:dbo}'",
"\tAND SPECIFIC_NAME = N'${1:StoredProcedureName}'",
")",
"DROP PROCEDURE ${2:SchemaName}.${1:StoredProcedureName}",
"DROP PROCEDURE ${2:dbo}.${1:StoredProcedureName}",
"GO"
],
"description": "Drop a stored procedure"
@@ -241,7 +241,7 @@
"Declare a cursor": {
"prefix": "sqlCursor",
"body": [
"-- Declare a cursor for a Table or a View '${1:TableOrViewName}' in schema '${2:SchemaName}'",
"-- Declare a cursor for a Table or a View '${1:TableOrViewName}' in schema '${2:dbo}'",
"DECLARE @ColumnName1 NVARCHAR(50), @ColumnName2 NVARCHAR(50)",
"",
"DECLARE db_cursor CURSOR FOR",
@@ -304,8 +304,8 @@
"prefix": "sqlCreateIndex",
"body": [
"-- Create a nonclustered index with or without a unique constraint",
"-- Or create a clustered index on table '[${1:TableName}]' in schema '[${2:SchemaName}]' in database '[${3:DatabaseName}]'",
"CREATE ${5:/*UNIQUE or CLUSTERED*/} INDEX IX_${4:IndexName} ON [${3:DatabaseName}].[${2:SchemaName}].[${1:TableName}] ([${6:ColumnName1}] DESC /*Change sort order as needed*/",
"-- Or create a clustered index on table '[${1:TableName}]' in schema '[${2:dbo}]' in database '[${3:DatabaseName}]'",
"CREATE ${5:/*UNIQUE or CLUSTERED*/} INDEX IX_${4:IndexName} ON [${3:DatabaseName}].[${2:dbo}].[${1:TableName}] ([${6:ColumnName1}] DESC /*Change sort order as needed*/",
"GO"
],
"description": "Create a new Index"
@@ -319,13 +319,13 @@
"IF OBJECT_ID('tempDB..#${1:TableName}', 'U') IS NOT NULL",
"DROP TABLE #${1:TableName}",
"GO",
"-- Create the temporary table from a physical table called '${4:TableName}' in schema '${3:SchemaName}' in database '${2:DatabaseName}'",
"-- Create the temporary table from a physical table called '${4:TableName}' in schema '${3:dbo}' in database '${2:DatabaseName}'",
"SELECT *",
"INTO #${1:TableName}",
"FROM [${2:DatabaseName}].[${3:[SchemaName}].[${4:TableName}]",
"FROM [${2:DatabaseName}].[${3:[dbo}].[${4:TableName}]",
"WHERE ${5:/* add search conditions here */}"
],
"description": "Create a new Temporary Table"
},
}
}

View File

@@ -1,6 +1,6 @@
{
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "1.5.0-alpha.48",
"version": "1.5.0-alpha.52",
"downloadFileNames": {
"Windows_86": "win-x86-netcoreapp2.2.zip",
"Windows_64": "win-x64-netcoreapp2.2.zip",

View File

@@ -2,7 +2,7 @@
"name": "profiler",
"displayName": "SQL Server Profiler",
"description": "SQL Server Profiler for Azure Data Studio",
"version": "0.2.0",
"version": "0.3.0",
"publisher": "Microsoft",
"preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt",

View File

@@ -4,66 +4,69 @@
"type": "dark",
"colors": {
// base
"foreground": "#fffffe",
"focusBorder": "#0E639C",
// base
"foreground": "#fffffe",
"focusBorder": "#0078d7",
"selection.background": "#3062d6",
//text colors
"textLinkForeground": "#30B4FF",
"textLinkActiveForeground": "#30B4FF",
//text colors
"textLinkForeground": "#30b4ff",
"textLinkActiveForeground": "#30b4ff",
//Button control
"button.background": "#00BCF2",
"button.foreground": "#212121",
"button.hoverBackground": "#0099BC",
//Button control
"button.background": "#0078d7cc",
"button.foreground": "#ffffff",
"button.hoverBackground": "#0078d7",
// TODO add support for these
// "button.secondaryBackground": "#c8c8c8",
// "button.secondaryHoverBackground": "#a6a6a6",
// "button.secondaryForeground": "#333333",
// "button.disabledBackground": "#444444" ,
// "button.disabledForeground": "#888888" ,
// TODO add support for these
// "button.secondaryBackground": "#c8c8c8",
// "button.secondaryHoverBackground": "#a6a6a6",
// "button.secondaryForeground": "#333333",
// "button.disabledBackground": "#444444" ,
// "button.disabledForeground": "#888888" ,
//Dropdown Control
"dropdown.background": "#212121",
"dropdown.foreground": "#fffffe",
"dropdown.border": "#888888",
//Checkbox
"checkbox.disabled.foreground": "#888888",
//Input Control
"input.background": "#212121",
//Dropdown Control
"dropdown.background": "#212121",
"dropdown.foreground": "#fffffe",
"dropdown.border": "#888888",
//Input Control
"input.background": "#212121",
"input.border": "#888888",
"input.disabled.background": "#444444",
"input.disabled.foreground": "#888888",
"inputOption.activeBorder": "#007ACC",
"input.placeholderForeground": "#888888",
"inputValidation.errorBackground": "#D02E00",
"inputValidation.errorBorder": "#D02E00",
"inputOption.activeBorder": "#0078d7",
"input.placeholderForeground": "#888888",
"inputValidation.errorBackground": "#b62e00",
"inputValidation.errorBorder": "#b62e00",
//List and trees
"list.activeSelectionBackground": "#3062d6",
"list.hoverBackground": "#444444",
"pickerGroup.border": "#00BCF2",
//List and trees
"list.activeSelectionBackground": "#3062d6",
"list.hoverBackground": "#444444",
"pickerGroup.border": "#0078d7",
"activityBar.background": "#444444",
"sideBar.background": "#333333",
"sideBarTitle.foreground": "#BBBBBB",
"input.placeholderForeground": "#A6A6A6",
"editorGroupHeader.tabsBackground": "#444444",
"editor.background": "#212121",
"editor.foreground": "#ffffff",
"editorWidget.background": "#444444",
"editorLink.activeForeground": "#30B4FF",
"editorGroup.border": "#333333",
"editorGroup.background": "#212121",
"editorIndentGuide.activeBackground": "#707070",
"tab.activeBackground": "#212121",
"tab.activeForeground": "#ffffff",
"tab.inactiveBackground": "#444444",
"tab.inactiveForeground": "#b6b6b6",
"sideBarTitle.foreground": "#bbbbbb",
"input.placeholderForeground": "#a6a6a6",
"editorGroupHeader.tabsBackground": "#444444",
"editor.background": "#212121",
"editor.foreground": "#ffffff",
"editorWidget.background": "#444444",
"editorLink.activeForeground": "#30b4ff",
"editorGroup.border": "#333333",
"editorGroup.background": "#212121",
"editorIndentGuide.activeBackground": "#707070",
"tab.activeBackground": "#212121",
"tab.activeForeground": "#ffffff",
"tab.inactiveBackground": "#444444",
"tab.inactiveForeground": "#b6b6b6",
"tab.border": "#3c3c3c",
"panel.background": "#212121",
"panel.border": "#515151",
"panelTitle.activeForeground": "#ffffff",
"panel.background": "#212121",
"panel.border": "#515151",
"panelTitle.activeForeground": "#ffffff",
"panelTitle.inactiveForeground": "#888888"
},
"tokenColors": [

View File

@@ -5,18 +5,18 @@
"colors": {
// base
"foreground": "#4a4a4a",
"focusBorder": "#00BCF2",
"selection.background": "#C9D0D9",
"focusBorder": "#0078d7",
"selection.background": "#c9d0d9",
"widget.shadow": "#666666",
// text colors
"textLinkForeground": "#3062D6",
"textLinkActiveForeground": "#3062D6",
"textLinkForeground": "#3062d6",
"textLinkActiveForeground": "#3062d6",
//Button control
"button.background": "#00BCF2",
"button.foreground": "#212121",
"button.hoverBackground": "#0099BC",
"button.background": "#0078d7cc",
"button.foreground": "#ffffff",
"button.hoverBackground": "#0078d7",
// TODO add support for these
// "button.secondaryBackground": "#c8c8c8",
@@ -25,35 +25,38 @@
// "button.disabledBackground": "#eaeaea",
// "button.disabledForeground": "#888888",
//Checkbox
"checkbox.disabled.foreground": "#888888",
//Dropdown Control
"dropdown.background": "#fffffe",
"dropdown.background": "#ffffff",
"dropdown.foreground": "#4a4a4a",
"dropdown.border": "#C8C8C8",
"dropdown.border": "#c8c8c8",
//badge
"badge.background": "#777777",
"badge.foreground": "#ffffff",
//Input Control
"input.background": "#fffffe",
"input.background": "#ffffff",
"input.border": "#c8c8c8",
"input.disabled.background": "#dcdcdc",
"input.disabled.foreground": "#888888",
"inputOption.activeBorder": "#666666",
"input.placeholderForeground": "#767676",
"inputValidation.errorBackground": "#ffeaea",
"inputValidation.errorBorder": "#f1897f",
"inputValidation.errorBorder": "#b62e00",
//List and tree
"list.activeSelectionBackground": "#3062d6",
"list.hoverBackground": "#dcdcdc",
"pickerGroup.border": "#00BCF2",
"pickerGroup.border": "#0078d7",
// Workbench: Activity Bar
"activityBar.background": "#212121",
// Workbench: Side Bar
"sideBar.background": "#EAEAEA",
"sideBar.background": "#eaeaea",
"editorGroupHeader.tabsBackground": "#f4f4f4",
"editor.background": "#fffffe",
"editor.foreground": "#212121",
@@ -64,15 +67,15 @@
"editorIndentGuide.activeBackground": "#939393",
// Workbench: Tabs
"tab.activeBackground": "#FFFFFE",
"tab.activeForeground": "#4A4A4A",
"tab.activeBackground": "#ffffff",
"tab.activeForeground": "#4a4a4a",
"tab.inactiveBackground": "#f4f4f4",
"tab.inactiveForeground": "#707070",
"tab.border": "#EAEAEA",
"tab.border": "#eaeaea",
"tab.unfocusedInactiveForeground": "#888888",
"tab.unfocusedActiveForeground": "#212121",
"panel.background": "#FFFFFE",
"panel.border": "#C8C8C8",
"panel.background": "#ffffff",
"panel.border": "#c8c8c8",
"panelTitle.activeForeground": "#212121",
"panelTitle.inactiveForeground": "#757575"
},