public override SoqlExpression Simplify() { if (this.Right.Count == 0) { return(SoqlBooleanLiteralExpression.False); } SoqlExpression lhsExpression = this.Left.Simplify(); SoqlBooleanExpression retVal = null; for (int i = 0; i < this.Right.Count; ++i) { SoqlExpression e = (SoqlExpression)this.Right[i]; SoqlBooleanRelationalExpression bre = new SoqlBooleanRelationalExpression(lhsExpression, e, SoqlRelationalOperator.Equal); if (retVal == null) { retVal = bre; } else { retVal = new SoqlBooleanOrExpression(retVal, bre); } } return(retVal.Simplify()); }
public static SoqlBooleanExpression ParseWhereClause(string whereClause) { SoqlBooleanExpression e = ParseBooleanExpression(whereClause); if (e == null) { throw new SoqlException("Expression is not of boolean type"); } return(e); }
public static SoqlBooleanExpression ParseBooleanExpression(string expr) { SoqlParser parser = new SoqlParser(expr); SoqlBooleanExpression e = parser.ParseBooleanExpression(); if (!parser.tokenizer.IsEOF()) { throw new SoqlException("Unexpected token: " + parser.tokenizer.TokenValue, parser.tokenizer.TokenPosition); } return(e); }
protected virtual SoqlQueryExpression BuildDataQuery(ListInfo li, SoqlBooleanExpression whereClause, IList<string> theQueryParameters, int startIndex, int topCount, string orderBy, IList<string> selectAliases) { SoqlQueryExpression theQuery; theQuery = new SoqlQueryExpression(); theQuery.SelectExpressions = new SoqlExpressionCollection(); theQuery.SelectAliases = new StringCollection(); theQuery.TopCount = topCount; theQuery.From.Add(li.RecordClass); theQuery.FromAliases.Add(String.Empty); if (orderBy != null) { //ParseOrderBy(theQuery, orderBy, columns, theQueryParameters); } // special columns - class Name and key and label theQuery.SelectExpressions.Add(new SoqlSoodaClassExpression()); theQuery.SelectAliases.Add(String.Empty); ClassInfo ci = DatabaseSchema.FindClassByName(li.RecordClass); Sooda.Schema.FieldInfo key_fi = ci.GetPrimaryKeyFields()[0]; // ci.GetPrimaryKeyField(); //theQuery.SelectExpressions.Add(new SoqlPathExpression(key_fi.Name)); //theQuery.SelectAliases.Add(String.Empty); foreach (ListColumnInfo lci in li.Columns) { string alias = lci.DataField; alias = alias.Replace('.', '_'); if (lci.DataExpression != null) { theQuery.SelectExpressions.Add(SoqlParser.ParseExpression(lci.DataExpression)); } else { theQuery.SelectExpressions.Add(SoqlParser.ParseExpression(lci.DataField)); } theQuery.SelectAliases.Add(alias); //selectAliases.Add(alias); } theQuery.WhereClause = whereClause; return theQuery; }
public SoodaWhereClause(SoqlBooleanExpression whereExpression, params object[] par) { this.Parameters = par; this.WhereExpression = whereExpression; }
public SoodaWhereClause(SoqlBooleanExpression whereExpression) { this.WhereExpression = whereExpression; }
public SoodaObjectListSnapshot(IList list, SoqlBooleanExpression filterExpression) : this(list, new SoodaWhereClause(filterExpression)) { }
public ISoodaObjectList Filter(SoqlBooleanExpression filterExpression) { return new SoodaObjectListSnapshot(this, filterExpression); }