fixed datetime null condition #356

This commit is contained in:
Jan Prochazka 2022-09-04 08:47:58 +02:00
parent c9a9c7d0f7
commit 5b8d70747f

View File

@ -181,10 +181,23 @@ const binaryCondition = operator => value => ({
},
});
const unaryCondition = conditionType => () => {
return {
conditionType,
expr: {
exprType: 'placeholder',
},
};
};
const createParser = () => {
const langDef = {
comma: () => word(','),
not: () => word('NOT'),
notNull: r => r.not.then(r.null).map(unaryCondition('isNotNull')),
null: () => word('NULL').map(unaryCondition('isNull')),
yearNum: () => P.regexp(/\d\d\d\d/).map(yearCondition()),
yearMonthNum: () => P.regexp(/\d\d\d\d-\d\d?/).map(yearMonthCondition()),
yearMonthDayNum: () => P.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayCondition()),
@ -264,6 +277,8 @@ const createParser = () => {
r.lastYear,
r.thisYear,
r.nextYear,
r.null,
r.notNull,
r.le,
r.lt,
r.ge,