ModelQuery: fix is null / is not null checks
This commit is contained in:
parent
2bbe4db5fe
commit
8746ad2ea3
@ -263,7 +263,7 @@ class FieldValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public toString(first: boolean = true): string {
|
public toString(first: boolean = true): string {
|
||||||
return `${!first ? ',' : ''}${this.field}${this.test}${this.raw || this.value instanceof ModelQuery ? this.value : (Array.isArray(this.value) ? '(?)' : '?')}`;
|
return `${!first ? ',' : ''}${this.field}${this.test}${this.raw || this.value === null || this.value instanceof ModelQuery ? this.value : (Array.isArray(this.value) ? '(?)' : '?')}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected get test(): string {
|
protected get test(): string {
|
||||||
@ -299,6 +299,13 @@ class WhereFieldValue extends FieldValue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected get test(): string {
|
protected get test(): string {
|
||||||
|
if (this.value === null) {
|
||||||
|
if (this._test === WhereTest.EQ) {
|
||||||
|
return ' IS ';
|
||||||
|
} else if (this._test === WhereTest.NE) {
|
||||||
|
return ' IS NOT ';
|
||||||
|
}
|
||||||
|
}
|
||||||
return this._test;
|
return this._test;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user