Exemplo n.º 1
0
        public void GetSql(DbTarget db_target, ref StringBuilder sql)
        {
            int count = this.Count;

            if (count == 0)
            {
                return;
            }

            sql.Append(" ").Append(_Name).Append(" ");
            for (int x = 0; x < count; x++)
            {
                ICondition cond = _Conditions[x];
                // concat operator
                if (x > 0)
                {
                    if (cond.ConditionType == ConditionType.And)
                    {
                        sql.Append(" AND ");
                    }
                    else if (cond.ConditionType == ConditionType.Or)
                    {
                        sql.Append(" OR ");
                    }
                }
                cond.GetSql(db_target, ref sql);
            }
        }
Exemplo n.º 2
0
        public void GetSql(DbTarget db_target, ref StringBuilder sql)
        {
            if (_Conditions == null)
            {
                return;
            }

            int count = _Conditions.Count;

            if (count == 0)
            {
                return;
            }

            sql.Append(" WHERE ");


            for (int x = 0; x < count; x++)
            {
                ICondition cond = _Conditions[x];

                if (cond.Negation)
                {
                    sql.Append(" NOT ");
                }
                // concat operator
                if (x > 0)
                {
                    if (cond.ConditionType == ConditionType.And)
                    {
                        sql.Append(" AND ");
                    }
                    else if (cond.ConditionType == ConditionType.Or)
                    {
                        sql.Append(" OR ");
                    }
                }

                cond.GetSql(db_target, ref sql);
            }
        }