Esempio n. 1
0
        public WhereClip Or(WhereClip where)
        {
            if (WhereClip.IsNullOrEmpty(where) || where.Sql.Length == 0)
            {
                return(this);
            }

            if (sql.Length > 0)
            {
                sql.Append(" OR ");
            }

            if (where.isNot && where.sql.Length > 0)
            {
                sql.Append("NOT ");
            }

            if (where.sql.Length > 0)
            {
                sql.Append('(');
                sql.Append(where.sql);
                sql.Append(')');
            }

            SqlQueryUtils.AddParameters(parameters, where);

            return(this);
        }
Esempio n. 2
0
 public ExpressionClip Append(QueryOperator op, ExpressionClip right)
 {
     this.sql.Append(SqlQueryUtils.ToString(op));
     this.sql.Append(SqlQueryUtils.ToString(right));
     SqlQueryUtils.AddParameters(this.parameters, right);
     return(this);
 }
Esempio n. 3
0
        public WhereClip Or(ExpressionClip left, QueryOperator op, ExpressionClip right)
        {
            if (this.sql.Length > 0)
            {
                this.sql.Append(" OR ");
            }
            this.sql.Append(SqlQueryUtils.ToString(left));
            this.sql.Append(SqlQueryUtils.ToString(op));
            this.sql.Append(SqlQueryUtils.ToString(right));

            SqlQueryUtils.AddParameters(this.parameters, left);
            SqlQueryUtils.AddParameters(this.parameters, right);

            return(this);
        }
Esempio n. 4
0
        public ExpressionClip SubString(int start)
        {
            ExpressionClip expr      = (ExpressionClip)this.Clone();
            ExpressionClip cloneExpr = (ExpressionClip)this.Clone();
            StringBuilder  sb        = new StringBuilder("SUBSTRING(");

            SqlQueryUtils.AppendColumnName(sb, expr.Sql);
            sb.Append(',');
            sb.Append(start + 1);
            sb.Append(",LEN(");
            SqlQueryUtils.AppendColumnName(sb, cloneExpr.Sql);
            sb.Append(')');
            sb.Append(')');

            expr.sql = sb;
            SqlQueryUtils.AddParameters(expr.parameters, cloneExpr);

            return(expr);
        }
Esempio n. 5
0
 public CustomQueryTable(SubQuery subQuery)
     : base(subQuery.ToString())
 {
     this.tableName = subQuery.ToString();
     SqlQueryUtils.AddParameters(this.parameters, subQuery);
 }