@@ -30,7 +30,7 @@ OpenLayers.Format.CQL = (function() {
|
||||
COMPARISON: /^(=|<>|<=|<|>=|>|LIKE)/i,
|
||||
COMMA: /^,/,
|
||||
LOGICAL: /^(AND|OR)/i,
|
||||
VALUE: /^('\w+'|\d+(\.\d*)?|\.\d+)/,
|
||||
VALUE: /^('([^']|'')*'|\d+(\.\d*)?|\.\d+)/,
|
||||
LPAREN: /^\(/,
|
||||
RPAREN: /^\)/,
|
||||
SPATIAL: /^(BBOX|INTERSECTS|DWITHIN|WITHIN|CONTAINS)/i,
|
||||
@@ -258,8 +258,9 @@ OpenLayers.Format.CQL = (function() {
|
||||
type: operators[tok.text.toUpperCase()]
|
||||
});
|
||||
case "VALUE":
|
||||
if ((/^'.*'$/).test(tok.text)) {
|
||||
return tok.text.substr(1, tok.text.length - 2);
|
||||
var match = tok.text.match(/^'(.*)'$/);
|
||||
if (match) {
|
||||
return match[1].replace(/''/g, "'");
|
||||
} else {
|
||||
return Number(tok.text);
|
||||
}
|
||||
@@ -425,7 +426,7 @@ OpenLayers.Format.CQL = (function() {
|
||||
}
|
||||
case undefined:
|
||||
if (typeof filter === "string") {
|
||||
return "'" + filter + "'";
|
||||
return "'" + filter.replace(/'/g, "''") + "'";
|
||||
} else if (typeof filter === "number") {
|
||||
return String(filter);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user