Example #1
0
 protected SqlSourceItem ParseSourceItem()
 {
     if (IsSymbol("("))
     {
         SymbolPosition leftb = SkipSymbol("(");
         if (IsKeyword("select"))
         {
             SqlSelect      select = ParseSelect();
             SymbolPosition rightb = SkipSymbol(")");
             var            expr   = new SqlSelectExpression(leftb, select, rightb);
             var            alias  = ParseAlias();
             return(new SqlSelectSourceItem(expr, alias));
         }
         else
         {
             var            lst    = ParseSourceList();
             SymbolPosition rightb = SkipSymbol(")");
             var            alias  = ParseAlias();
             return(new SqlSourceListSourceItem(leftb, lst, rightb, alias));
         }
     }
     else
     {
         var expr  = ParseExpression();
         var alias = ParseAlias();
         return(new SqlTableSourceItem(expr, alias));
     }
 }
Example #2
0
 public bool EqualTo(SqlSelect other, SqlEqualityTestProps props)
 {
     if (!ResultFields.EqualSequence(other.ResultFields, (a, b) => a.EqualTo(b, props)))
     {
         return(false);
     }
     if (!Clauses.EqualSequence(other.Clauses, (a, b) => a.EqualTo(b, props)))
     {
         return(false);
     }
     return(true);
 }
Example #3
0
        protected SqlExpression ParseExprInBracket()
        {
            if (!IsSymbol("("))
            {
                return(null);
            }
            var leftb = SkipSymbol("(");

            if (IsKeyword("select"))
            {
                SqlSelect      select = ParseSelect();
                SymbolPosition rightb = SkipSymbol(")");
                return(new SqlSelectExpression(leftb, select, rightb));
            }
            else
            {
                SqlExpressionList inner  = ParseExprList(IsCloseBracket);
                SymbolPosition    rightb = SkipSymbol(")");
                return(new SqlExpressionInBracket(leftb, inner, rightb));
            }
        }
Example #4
0
 public SqlSelectExpression(SymbolPosition leftb, SqlSelect select, SymbolPosition rightb)
 {
     LeftBracket  = leftb;
     Select       = select;
     RightBracket = rightb;
 }