Skip to content

Commit 4ef32be

Browse files
committed
Bug fix in filtering for null or not null.
1 parent 2c87f2f commit 4ef32be

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

js/crud.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,27 +114,37 @@ function SQLgetMany(m, req, isCSV, wCount){
114114
}else{
115115
let w='t1."'+f.column+'"'+sqlOperators[cond];
116116
if(cond==='in' && (f.type===ft.lov || f.type===ft.list)){
117+
// - in list
117118
sqlWs.push(w+'('+cs[1].split(',').map(li => {
118119
sqlParams.push(li);
119120
return '$'+sqlParams.length
120121
}).join(',')+')');
121-
}else if(cond==='0'){ // false
122+
}else if(cond==='0'){
123+
// - false
122124
sqlWs.push('('+w+'false OR t1."'+f.column+'" IS NULL)');
123-
}else if(cond==='1'){ // true
125+
}else if(cond==='1'){
126+
// - true
124127
sqlWs.push(w+'true');
125-
}else if(cond==='null'){ // empty
128+
}else if(cond==='nn'){
129+
// - not empty
126130
sqlWs.push(' NOT '+w+'NULL');
131+
}else if(cond==='null'){
132+
// - empty
133+
sqlWs.push(w+'NULL');
127134
}else{
128135
if(cond==='nct'){ // not contains
129136
//TODO replace % in cs[1]
130137
sqlParams.push('%'+cs[1]+'%');
131138
sqlWs.push(' NOT '+w+'$'+sqlParams.length);
132139
}else{
133-
if(cond==='sw'){ // start with
140+
if(cond==='sw'){
141+
// - start with
134142
sqlParams.push(cs[1]+'%');
135-
}else if(cond==='fw'){ // finishes with
143+
}else if(cond==='fw'){
144+
// - finishes with
136145
sqlParams.push('%'+cs[1]);
137-
}else if(cond==='ct'){ // contains
146+
}else if(cond==='ct'){
147+
// - contains
138148
sqlParams.push('%'+cs[1]+'%');
139149
}else{
140150
sqlParams.push(cs[1]);

0 commit comments

Comments
 (0)