Esempio n. 1
0
        public IQuery NotIn(IList values)
        {
            OrlConstraint c = new OrlConstraint(pending, "not in", values);

            AddConstraint(c);
            return(this);
        }
Esempio n. 2
0
        public virtual string GetSql(OrlTable table, ref int offset)
        {
            if (!IsComplete)
            {
                throw new InvalidOperationException("invalid query");
            }

            StringBuilder buf = new StringBuilder();
            int           sz  = constraints.Count;

            if (sz > 0)
            {
                buf.Append("where");
            }
            for (int i = 0; i < sz; i++)
            {
                if (i > 0)
                {
                    string op = operators[i - 1];
                    buf.Append(" ").Append(op);
                }
                OrlConstraint constraint = constraints[i];
                string        sql        = constraint.GetSql(table, ref offset);
                buf.Append(" ").Append(sql);
            }
            sz = orders.Count;
            if (sz > 0)
            {
                buf.Append(" order by ");
                for (int i = 0; i < sz; i++)
                {
                    if (i > 0)
                    {
                        buf.Append(",");
                    }
                    OrlOrder order = orders[i];
                    string   sql   = order.GetSql(table);
                    buf.Append(sql);
                }
            }
            buf.Append(";");
            return(buf.ToString());
        }
Esempio n. 3
0
 protected void AddConstraint(OrlConstraint c)
 {
     ErrorIfNotPending();
     constraints.Add(c);
     pending = null;
 }
Esempio n. 4
0
 protected void AddConstraint(string op, object val)
 {
     OrlConstraint c = new OrlConstraint(pending, op, val);
     AddConstraint(c);
 }
Esempio n. 5
0
 public IQuery NotIn(IList values)
 {
     OrlConstraint c = new OrlConstraint(pending, "not in", values);
     AddConstraint(c);
     return this;
 }
Esempio n. 6
0
        protected void AddConstraint(string op, object val)
        {
            OrlConstraint c = new OrlConstraint(pending, op, val);

            AddConstraint(c);
        }
Esempio n. 7
0
 protected void AddConstraint(OrlConstraint c)
 {
     ErrorIfNotPending();
     constraints.Add(c);
     pending = null;
 }