public void SetOperand([NotNull] QueryExpression op) { Debug.Assert(op != null); _json = new List <object> { "COLLATE", _collation, op.ConvertToJSON() }; }
protected override object ToJSON() { var inObj = Misc.TryCast <IExpression, QueryExpression>(_in); var variableName = Misc.TryCast <IVariableExpression, QueryTypeExpression>(_variableName); return(new[] { _function, variableName.KeyPath, inObj.ConvertToJSON(), _predicate?.ConvertToJSON() }); }
public object ToJSON() { return(_select?.ConvertToJSON()); }
protected override object ToJSON() { var obj = new List <object>(); var useArrayOp = false; switch (_type) { case BinaryOpType.Add: obj.Add("+"); break; case BinaryOpType.Between: obj.Add("BETWEEN"); break; case BinaryOpType.Divide: obj.Add("/"); break; case BinaryOpType.EqualTo: obj.Add("="); break; case BinaryOpType.GreaterThan: obj.Add(">"); break; case BinaryOpType.GreaterThanOrEqualTo: obj.Add(">="); break; case BinaryOpType.In: obj.Add("IN"); useArrayOp = true; break; case BinaryOpType.Is: obj.Add("IS"); break; case BinaryOpType.IsNot: obj.Add("IS NOT"); break; case BinaryOpType.LessThan: obj.Add("<"); break; case BinaryOpType.LessThanOrEqualTo: obj.Add("<="); break; case BinaryOpType.Like: obj.Add("LIKE"); break; case BinaryOpType.Matches: obj.Add("MATCH()"); break; case BinaryOpType.Modulus: obj.Add("%"); break; case BinaryOpType.Multiply: obj.Add("*"); break; case BinaryOpType.NotEqualTo: obj.Add("!="); break; case BinaryOpType.RegexLike: obj.Add("regexp_like()"); break; case BinaryOpType.Subtract: obj.Add("-"); break; } obj.Add(_lhs.ConvertToJSON()); if ((_rhs as QueryTypeExpression)?.ExpressionType == ExpressionType.Aggregate) { var collection = _rhs.ConvertToJSON() as IList <object>; Debug.Assert(collection != null); if (useArrayOp) { collection?.Insert(0, "[]"); obj.Add(collection); } else { obj.AddRange(collection); } } else { obj.Add(_rhs.ConvertToJSON()); } return(obj); }