Enable custom delimiters when saving as CSV (#1928)

* Support custom delimiters for csv

* Run tsfmt
This commit is contained in:
Matt Irvine
2018-07-13 18:12:57 -07:00
committed by GitHub
parent fd49c081c2
commit 30b66934cd
3 changed files with 14 additions and 4 deletions

View File

@@ -275,6 +275,11 @@ let registryProperties = {
'description': localize('sql.saveAsCsv.includeHeaders', '[Optional] When true, column headers are included when saving results as CSV'), 'description': localize('sql.saveAsCsv.includeHeaders', '[Optional] When true, column headers are included when saving results as CSV'),
'default': true 'default': true
}, },
'sql.saveAsCsv.delimiter': {
'type': 'string',
'description': localize('sql.saveAsCsv.delimiter', '[Optional] The custom delimiter to use between values when saving as CSV'),
'default': ','
},
'sql.copyIncludeHeaders': { 'sql.copyIncludeHeaders': {
'type': 'boolean', 'type': 'boolean',
'description': localize('sql.copyIncludeHeaders', '[Optional] Configuration options for copying results from the Results View'), 'description': localize('sql.copyIncludeHeaders', '[Optional] Configuration options for copying results from the Results View'),

View File

@@ -186,7 +186,11 @@ export class ResultSerializer {
if (saveConfig.includeHeaders !== undefined) { if (saveConfig.includeHeaders !== undefined) {
saveResultsParams.includeHeaders = saveConfig.includeHeaders; saveResultsParams.includeHeaders = saveConfig.includeHeaders;
} }
if (saveConfig.delimiter !== undefined) {
saveResultsParams.delimiter = saveConfig.delimiter;
} }
}
return saveResultsParams; return saveResultsParams;
} }
@@ -202,6 +206,7 @@ export class ResultSerializer {
// and we want to have just 1 setting that lists this. // and we want to have just 1 setting that lists this.
let config = this.getConfigForCsv(); let config = this.getConfigForCsv();
config.resultFormat = SaveFormat.EXCEL; config.resultFormat = SaveFormat.EXCEL;
config.delimiter = undefined;
return config; return config;
} }

4
src/sql/sqlops.d.ts vendored
View File

@@ -840,6 +840,7 @@ declare module 'sqlops' {
columnStartIndex: number; columnStartIndex: number;
columnEndIndex: number; columnEndIndex: number;
includeHeaders?: boolean; includeHeaders?: boolean;
delimiter?: string;
} }
export interface SaveResultRequestResult { export interface SaveResultRequestResult {
@@ -1395,8 +1396,7 @@ declare module 'sqlops' {
job: AgentJobInfo; job: AgentJobInfo;
} }
export interface AgentJobCategory export interface AgentJobCategory {
{
id: string; id: string;
name: string; name: string;
} }