Not Support in Linq Syntax #158

ssteiner opened this Issue Feb 9, 2013 · 0 comments


1 participant

ssteiner commented Feb 9, 2013

I've really missed the support for the not syntax, so I've gone ahead and implemented it. It may not be complete, I've only tested it for binary properties and contains and I'm entirely unfamiliar with git so posting the bit of code is the best I can do for now.

Put my code before

} else if (expr.NodeType == ExpressionType.MemberAccess) {

As you can see, I've implemented not for binary properties by comparing to zero (seeing as bits are stored as integers in sqlite), and for call operations I'm changing the sql syntax to add the sql reflection of the not statement:

} 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";
                case ExpressionType.Call:
                    valn.CommandText = valn.CommandText.Replace(" like ", " not like ");
                    valn.CommandText = valn.CommandText.Replace(" in ", " not in ");
                    valn.CommandText = valn.CommandText.Replace(" = ", " <> ");
            return new CompileResult { CommandText = valn.CommandText };


softlion added a commit to softlion/SQLite.Net-PCL that referenced this issue Jan 13, 2014

Add support for property types: XElement, DateTimeOffset, TimeSpan
Add support for multiple primary keys
Fix string not stored in i18n format
Implements NOT operator (patch from praeclarum#158)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment