fix custom variable quoting in sql* query interpolations

This commit is contained in:
Brice Maron
2018-08-01 19:38:13 +02:00
parent 9d3743774d
commit bb7e583863
6 changed files with 27 additions and 6 deletions

View File

@ -16,7 +16,7 @@ export class PostgresDatasource {
interpolateVariable(value, variable) {
if (typeof value === 'string') {
if (variable.multi || variable.includeAll) {
return "'" + value + "'";
return "'" + value.replace(/'/g, `''`) + "'";
} else {
return value;
}
@ -27,7 +27,7 @@ export class PostgresDatasource {
}
var quotedValues = _.map(value, function(val) {
return "'" + val + "'";
return "'" + val.replace(/'/g, `''`) + "'";
});
return quotedValues.join(',');
}