mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-01 17:47:19 +00:00
Feature : 'is' operator in where clause npm v0.3.0
This commit is contained in:
@@ -44,6 +44,22 @@ function prepareLikeValue(value) {
|
||||
|
||||
}
|
||||
|
||||
function prepareIsValue(value) {
|
||||
|
||||
//return value.replace("~", "%");
|
||||
if(value === 'null'){
|
||||
return null;
|
||||
} else if (value === 'true'){
|
||||
return true;
|
||||
} else if (value === 'false'){
|
||||
return false;
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function replaceWhereParamsToQMarks(openParentheses, str, comparisonOperator) {
|
||||
|
||||
@@ -103,13 +119,13 @@ function getComparisonOperator(operator) {
|
||||
return '>='
|
||||
break;
|
||||
|
||||
// case 'is':
|
||||
// return ' is '
|
||||
// break;
|
||||
case 'is':
|
||||
return ' is '
|
||||
break;
|
||||
|
||||
// case 'isnot':
|
||||
// return ' is not '
|
||||
// break;
|
||||
case 'isnot':
|
||||
return ' is not '
|
||||
break;
|
||||
|
||||
// case 'isnull':
|
||||
// return ' is NULL '
|
||||
@@ -253,6 +269,8 @@ exports.getConditionClause = function (whereInQueryParams, condType = 'where') {
|
||||
whereParams = whereParams.concat(obj.whereParams)
|
||||
} else if (comparisonOperator === ' like ' || comparisonOperator === ' not like ') {
|
||||
whereParams.push(prepareLikeValue(variableValue[1]))
|
||||
} else if (comparisonOperator === ' is ') {
|
||||
whereParams.push(prepareIsValue(variableValue[1]))
|
||||
} else {
|
||||
whereParams.push(variableValue[1])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user