jaguar_orm icon indicating copy to clipboard operation
jaguar_orm copied to clipboard

Implement iss and isNot in where clause

Open KamalElShazly opened this issue 4 years ago • 1 comments

Hello,

I wanted to use iss in a where clause to check for NULL values but it was not recognized. I'm using jaguar_query-2.2.8 and i can't find it in \jaguar_query-2.2.8\lib\src\operators\operators.dart Although i found the implementation in \jaguar_query-2.2.8\lib\src\core\expression\condition.dart and in \jaguar_query-2.2.8\lib\src\core\operators\comparision.dart

I have an easy fix by adding the following in \jaguar_query-2.2.8\lib\src\operators\operators.dart /// DSL to create 'IS' relational condition Cond<ValType> iss<ValType>(String field, ValType rhs, {String tableName}) => Cond<ValType>(Field<ValType>.inTable(tableName, field), Op.Is, rhs);

/// DSL to create 'IS NOT' relational condition Cond<ValType> isNot<ValType>(String field, ValType rhs, {String tableName}) => Cond<ValType>(Field<ValType>.inTable(tableName, field), Op.IsNot, rhs);

But i'm not sure which branch is mapped to version 2.2.8 as i can't find the operators folder in master branch.

KamalElShazly avatar Jul 07 '19 16:07 KamalElShazly

Hello,

I'm using this and it works:

return _bean.findWhere(IntField('id').iss(null));

Code is here https://github.com/Jaguar-dart/jaguar_orm/blob/legacyV3/query/lib/src/core/expression/field.dart#L35

It's not anymore in master because master code has been updated to v4 and release version is still v3 for now

jaumard avatar Oct 09 '19 10:10 jaumard