Exemplo n.º 1
0
 public static FromTerm SubQuery(string query, string alias)
 {
     FromTerm term = new FromTerm();
     term.expr = query;
     term.alias = alias;
     term.type = FromTermType.SubQuery;
     return term;
 }
Exemplo n.º 2
0
 public static FromTerm Table(string tableName, string alias, string ns1, string ns2)
 {
     FromTerm term = new FromTerm();
     term.expr = tableName;
     term.alias = alias;
     term.type = FromTermType.Table;
     term.ns1 = ns1;
     term.ns2 = ns2;
     return term;
 }
Exemplo n.º 3
0
 public SelectColumn(string columnName, FromTerm table, string columnAlias, SqlAggregationFunction function)
 {
     if (function == SqlAggregationFunction.None)
     {
         this.expr = SqlExpression.Field(columnName, table);
     }
     else
     {
         this.expr = SqlExpression.Function(function, SqlExpression.Field(columnName, table));
     }
     this.alias = columnAlias;
 }
Exemplo n.º 4
0
 public static SqlExpression Field(string fieldName, FromTerm table)
 {
     SqlExpression expression = new SqlExpression();
     expression.val = fieldName;
     expression.table = table;
     expression.type = SqlExpressionType.Field;
     return expression;
 }
Exemplo n.º 5
0
 public OrderByTerm(string field, FromTerm table, OrderByDirection dir)
 {
     this.field = field;
     this.table = table;
     this.direction = dir;
 }
Exemplo n.º 6
0
 public SelectColumn(string columnName, FromTerm table, string columnAlias) : this(columnName, table, columnAlias, SqlAggregationFunction.None)
 {
 }
Exemplo n.º 7
0
 public SelectColumn(string columnName, FromTerm table) : this(columnName, table, null)
 {
 }
Exemplo n.º 8
0
 private void ApplyOrderBy(OrderByTermCollection terms, SelectQuery orderQuery, bool forward, FromTerm table)
 {
     foreach (SkyMap.Net.SqlOM.OrderByTerm term in terms)
     {
         OrderByDirection dir = term.Direction;
         if (!(forward || (dir != OrderByDirection.Ascending)))
         {
             dir = OrderByDirection.Descending;
         }
         else if (!(forward || (dir != OrderByDirection.Descending)))
         {
             dir = OrderByDirection.Ascending;
         }
         orderQuery.OrderByTerms.Add(new SkyMap.Net.SqlOM.OrderByTerm(this.FormatSortFieldName(term.Field.ToString()), table, dir));
     }
 }
Exemplo n.º 9
0
 protected virtual void RenderFromTerm(StringBuilder builder, FromTerm table, string tableSpace)
 {
     if (table.Type == FromTermType.Table)
     {
         if (table.Ns1 != null)
         {
             this.TableNamespace(builder, table.Ns1);
         }
         if (table.Ns2 != null)
         {
             this.TableNamespace(builder, table.Ns2);
         }
         if (((table.Ns1 == null) && (table.Ns2 == null)) && (tableSpace != null))
         {
             this.TableNamespace(builder, tableSpace);
         }
         this.Identifier(builder, (string) table.Expression);
     }
     else if (table.Type == FromTermType.SubQuery)
     {
         builder.AppendFormat("( {0} )", table.Expression);
     }
     else
     {
         if (table.Type != FromTermType.SubQueryObj)
         {
             throw new InvalidQueryException("Unknown FromExpressionType: " + table.Type.ToString());
         }
         builder.AppendFormat("( {0} )", this.RenderSelect((SelectQuery) table.Expression));
     }
     if (table.Alias != null)
     {
         builder.AppendFormat(" ", new object[0]);
         this.Identifier(builder, table.Alias);
     }
 }
Exemplo n.º 10
0
 public GroupByTerm(string field, FromTerm table)
 {
     this.field = field;
     this.table = table;
 }