Don't quote bigints when copying them from the Query Tool results grid. Fixes #4459

This commit is contained in:
Aditya Toshniwal
2019-10-25 11:53:39 +01:00
committed by Dave Page
parent 4125360dfb
commit 6d7ff9444a
6 changed files with 251 additions and 344 deletions

View File

@@ -7,8 +7,8 @@
//
//////////////////////////////////////////////////////////////
define(['sources/selection/range_selection_helper'],
function (RangeSelectionHelper) {
define(['sources/selection/range_selection_helper', 'json-bignumber'],
function (RangeSelectionHelper, JSONBigNumber) {
return {
getUnion: function (allRanges) {
if (_.isEmpty(allRanges)) {
@@ -135,12 +135,13 @@ define(['sources/selection/range_selection_helper'],
csvCell: function (data, columnDefinitions, CSVOptions, rowId, colId) {
var val = data[rowId][columnDefinitions[colId].field],
cell_type = columnDefinitions[colId].cell || '',
quoting = CSVOptions.quoting || 'strings',
quote_char = CSVOptions.quote_char || '"';
if (quoting == 'all') {
if (val && _.isObject(val)) {
val = quote_char + JSON.stringify(val) + quote_char;
val = quote_char + JSONBigNumber.stringify(val) + quote_char;
} else if (val) {
val = quote_char + val.toString() + quote_char;
} else if (_.isNull(val) || _.isUndefined(val)) {
@@ -149,8 +150,8 @@ define(['sources/selection/range_selection_helper'],
}
else if(quoting == 'strings') {
if (val && _.isObject(val)) {
val = quote_char + JSON.stringify(val) + quote_char;
} else if (val && typeof val != 'number' && typeof val != 'boolean') {
val = quote_char + JSONBigNumber.stringify(val) + quote_char;
} else if (val && cell_type != 'number' && cell_type != 'boolean') {
val = quote_char + val.toString() + quote_char;
} else if (_.isNull(val) || _.isUndefined(val)) {
val = '';

View File

@@ -411,6 +411,7 @@ import gettext from 'sources/gettext';
$input.addClass('pg-text-invalid');
return {
valid: false,
msg: e.message,
};
}
}