public static WhereStatement Copy(WhereStatement statement)
        {
            int currentLevel = 0;
            var result       = new WhereStatement();

            foreach (var level in statement)
            {
                currentLevel++;
                result.Add(new List <WhereClause>());

                foreach (var clause in statement[currentLevel - 1])
                {
                    var clauseCopy = new WhereClause(clause.FieldName, clause.ComparisonOperator, clause.Value);

                    foreach (var subClause in clause.SubClauses)
                    {
                        clauseCopy.SubClauses.Add(new WhereClause.SubClause(subClause.LogicOperator, subClause.ComparisonOperator, subClause.Value));
                    }

                    result[currentLevel - 1].Add(clauseCopy);
                }
            }

            return(result);
        }
Esempio n. 2
0
 public void AddHaving(WhereClause clause, int level)
 {
     _havingStatement.Add(clause, level);
 }
Esempio n. 3
0
 public SqlBuilder Where(WhereClause clause, int level)
 {
     _whereStatement.Add(clause, level);
     return(this);
 }