Open
Description
Hi
I've already implemented this in an older build of the main sqlite-net, but I'm sure it would help some others, so here goes (I'm sorry I'm not really a git user so I've never done a pull request)
In TableQuery.cs, method private CompileResult CompileExpr(Expression expr, List queryArgs), before else if (expr.NodeType == ExpressionType.MemberAccess) you add another else if containing the following code
else if (expr.NodeType == ExpressionType.Not) {
var n = (UnaryExpression)expr;
var ty = n.Type;
var valn = CompileExpr(n.Operand, queryArgs);
switch (n.Operand.NodeType)
{
case ExpressionType.MemberAccess:
valn.CommandText += " = 0";
break;
case ExpressionType.Call:
valn.CommandText = valn.CommandText.Replace(" like ", " not like ");
valn.CommandText = valn.CommandText.Replace(" in ", " not in ");
valn.CommandText = valn.CommandText.Replace(" = ", " <> ");
break;
default:
break;
}
return new CompileResult { CommandText = valn.CommandText };
}
Do that and you get your standard NOT operator support working for booleans, strings, collections and values you can compare with = and <>.
Rather than having to keep my own copy of the lib, I think it would be easier to just mainline it.