Merge pull request #27 from strongloop/fix-regex-coercion
Fix RegExp coercion
This commit is contained in:
commit
1e2d0692b5
|
@ -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