Ejemplo n.º 1
0
 /// <summary>
 /// 创建Sql语句
 /// </summary>
 protected void CreateSqlByNoUnion(StringBuilder result)
 {
     AppendSelect(result);
     AppendFrom(result);
     AppendSql(result, JoinClause.ToSql());
     AppendSql(result, WhereClause.ToSql());
     AppendSql(result, GroupByClause.ToSql());
     AppendSql(result, OrderByClause.ToSql());
     AppendLimit(result);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 创建Sql语句
 /// </summary>
 protected virtual void CreateSql(StringBuilder result)
 {
     AppendSelect(result);
     AppendFrom(result);
     AppendSql(result, JoinClause.ToSql());
     AppendSql(result, GetWhere());
     AppendSql(result, GroupByClause.ToSql());
     AppendSql(result, OrderByClause.ToSql());
     AppendLimit(result);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 创建Sql语句 - 联合
 /// </summary>
 protected void CreateSqlByUnion(StringBuilder result)
 {
     result.Append("(");
     AppendSelect(result);
     AppendFrom(result);
     AppendSql(result, JoinClause.ToSql());
     AppendSql(result, WhereClause.ToSql());
     AppendSql(result, GroupByClause.ToSql());
     AppendSql(result, ")");
     foreach (var operation in UnionItems)
     {
         AppendSql(result, operation.Name);
         AppendSql(result, $"({operation.Builder.ToSql()}");
         AppendSql(result, ")");
     }
     AppendSql(result, OrderByClause.ToSql());
     AppendLimit(result);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 获取Sql语句
 /// </summary>
 private string GetSql()
 {
     return(_clause.ToSql());
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 获取分组语句
 /// </summary>
 /// <returns></returns>
 public virtual string GetGroupBy()
 {
     return(GroupByClause.ToSql());
 }