public static expr not(expr exp) { return(new UnaryExpression("NOT", exp) { fieldType = dbType.Bool }); }
public expr plus(expr exp) { return(new BinaryExpression(this, "+", exp) { fieldType = this.fieldType }); }
public static expr Minus(expr exp) { return(new UnaryExpression("-", exp) { fieldType = dbType.Double }); }
public expr lessThan(expr exp) { return(new BinaryExpression(this, "<", exp) { fieldType = dbType.Bool }); }
public expr between(expr exp1, expr exp2) { return(new BetweenExpression(this, true, exp1, exp2) { fieldType = dbType.Bool }); }
public expr greaterThan(expr exp) { return(new BinaryExpression(this, ">", exp) { fieldType = dbType.Bool }); }
public expr greaterOrEqual(expr exp) { return(new BinaryExpression(this, ">=", exp) { fieldType = dbType.Bool }); }
public expr And(expr exp) { return(new BinaryExpression(this, "AND", exp) { fieldType = dbType.Bool }); }
public expr OR(expr exp) { return(new BinaryExpression(this, "OR", exp) { fieldType = dbType.Bool }); }
public expr divide(expr exp) { return(new BinaryExpression(this, "/", exp) { fieldType = dbType.Double }); }
public expr multiply(expr exp) { return(new BinaryExpression(this, "*", exp) { fieldType = dbType.Double }); }
public expr mod(expr exp) { return(new BinaryExpression(this, "%", exp) { fieldType = dbType.Int }); }
public static expr abs(expr exp) { return(new FunctionExpression("Abs", exp) { fieldType = exp.fieldType }); }
public expr notBetween(expr exp1, expr exp2) { return(new BetweenExpression(this, false, exp1, exp2) { fieldType = dbType.Bool }); }
public JoinTable(AbsTable t1, JoinType j, AbsTable t2, expr on) { this.Tbl1 = t1; this.tbl2 = t2; this.join = j; this.on = on; }
public expr concat(expr exp) { return(new BinaryExpression(this, "||", exp) { fieldType = dbType.String }); }
public static expr ceiling(expr exp) { return(new FunctionExpression("ceiling", exp) { fieldType = dbType.Int }); }
public BetweenExpression(expr exp, bool betweenOrNot, expr exp1, expr exp2) { this.exp = exp; this.exp1 = exp1; this.exp2 = exp2; this._between = betweenOrNot; }
public expr notEqual(expr exp) { return(new BinaryExpression(this, "<>", exp) { fieldType = dbType.Bool }); }
/// <summary> /// the length of a string value /// </summary> public static expr length(expr exp) { return(new FunctionExpression("length", exp) { fieldType = dbType.Int }); }
public static expr floor(expr exp) { return(new FunctionExpression("floor", exp) { fieldType = dbType.Int }); }
public List <T> select <T>(expr cond, int pageIndex, int pageSize) where T : Entity, new() { var tbl = new T().Tbl; var list = new List <T>(); var dt = this.select().from(tbl).where (cond).page(pageIndex, pageSize).execute(); foreach (DataRow dr in dt.Rows) { var item = new T(); item.attach(dr); list.Add(item); } return(list); }
public T selectFirstWhere <T>(expr cond) where T : Entity, new() { var ent = new T(); var r = this.select().from(ent.Tbl).where (cond).executeRow(); if (r == null) { return(null); } else { ent.attach(r); return(ent); } }
public InExpression(expr exp, bool InOrNotIn, params object[] values) { this.exp = exp; this.inOrNotIn = InOrNotIn; this.values = values; }
public Assignment value(expr exp) { return(new Assignment(this, exp)); }
/// <summary> /// only use with gruopBy() otherwise it's useless /// </summary> public SelectStatement having(expr exp) { this.havingExp = exp; return(this); }
/// <summary> /// use only once /// </summary> public SelectStatement where (expr cond) { this.cond = cond; return(this); }
public SortExp(expr exp) { this.exp = exp; }
public SortExp(expr exp, bool Desc) { this.exp = exp; so = Desc? SortOrder.DESC : SortOrder.ASC; }
public AliasedExpr(expr exp, string alias) { this.exp = exp; this._alias = alias; this.fieldType = exp.fieldType; }