mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 15:16:01 +00:00
fixed datetime null condition #356
This commit is contained in:
@@ -181,10 +181,23 @@ const binaryCondition = operator => value => ({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const unaryCondition = conditionType => () => {
|
||||||
|
return {
|
||||||
|
conditionType,
|
||||||
|
expr: {
|
||||||
|
exprType: 'placeholder',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const createParser = () => {
|
const createParser = () => {
|
||||||
const langDef = {
|
const langDef = {
|
||||||
comma: () => word(','),
|
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()),
|
yearNum: () => P.regexp(/\d\d\d\d/).map(yearCondition()),
|
||||||
yearMonthNum: () => P.regexp(/\d\d\d\d-\d\d?/).map(yearMonthCondition()),
|
yearMonthNum: () => P.regexp(/\d\d\d\d-\d\d?/).map(yearMonthCondition()),
|
||||||
yearMonthDayNum: () => P.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayCondition()),
|
yearMonthDayNum: () => P.regexp(/\d\d\d\d-\d\d?-\d\d?/).map(yearMonthDayCondition()),
|
||||||
@@ -264,6 +277,8 @@ const createParser = () => {
|
|||||||
r.lastYear,
|
r.lastYear,
|
||||||
r.thisYear,
|
r.thisYear,
|
||||||
r.nextYear,
|
r.nextYear,
|
||||||
|
r.null,
|
||||||
|
r.notNull,
|
||||||
r.le,
|
r.le,
|
||||||
r.lt,
|
r.lt,
|
||||||
r.ge,
|
r.ge,
|
||||||
|
|||||||
Reference in New Issue
Block a user