mirror of
https://github.com/grafana/grafana.git
synced 2025-09-26 05:13:57 +08:00
use quoting functions from MysqlQuery in datasource
This commit is contained in:
@ -19,7 +19,7 @@ export class MysqlDatasource {
|
|||||||
interpolateVariable(value, variable) {
|
interpolateVariable(value, variable) {
|
||||||
if (typeof value === 'string') {
|
if (typeof value === 'string') {
|
||||||
if (variable.multi || variable.includeAll) {
|
if (variable.multi || variable.includeAll) {
|
||||||
return "'" + value.replace(/'/g, `''`) + "'";
|
return this.queryModel.quoteLiteral(value);
|
||||||
} else {
|
} else {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -29,12 +29,8 @@ export class MysqlDatasource {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const quotedValues = _.map(value, function(val) {
|
const quotedValues = _.map(value, v => {
|
||||||
if (typeof value === 'number') {
|
return this.queryModel.quoteLiteral(v);
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "'" + val.replace(/'/g, `''`) + "'";
|
|
||||||
});
|
});
|
||||||
return quotedValues.join(',');
|
return quotedValues.join(',');
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user