Fix RegExp coercion
- Do not coerce RegExp literal/objects into a string
This commit is contained in:
parent
7f76270940
commit
8d01d3e8e2
|
@ -712,6 +712,8 @@ SQLConnector.prototype.buildExpression = function(columnName, operator, columnVa
|
|||
case 'nlike':
|
||||
sqlExp += ' NOT LIKE ';
|
||||
break;
|
||||
// this case not needed since each database has its own regex syntax, but
|
||||
// we leave the MySQL syntax here as a placeholder
|
||||
case 'regexp':
|
||||
sqlExp += ' REGEXP ';
|
||||
break;
|
||||
|
@ -797,6 +799,9 @@ SQLConnector.prototype._buildWhere = function(model, where) {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (operator === 'regexp' && expression instanceof RegExp) {
|
||||
// do not coerce RegExp based on property definitions
|
||||
columnValue = expression;
|
||||
} else {
|
||||
columnValue = this.toColumnValue(props[key], expression);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue