Commit 0f02d5dc authored by terrymanu's avatar terrymanu
Browse files

support simple sub-query

parent 177b5013
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -269,8 +269,15 @@ public abstract class AbstractSelectParser implements SQLStatementParser {
    }
    
    public void parseTable() {
        if (sqlParser.equalAny(Symbol.LEFT_PAREN)) {
            throw new UnsupportedOperationException("Cannot support subquery");
        if (sqlParser.skipIfEqual(Symbol.LEFT_PAREN)) {
            if (!selectStatement.getTables().isEmpty()) {
                throw new UnsupportedOperationException("Cannot support subquery for nested tables.");
            }
            query();
            sqlParser.accept(Symbol.RIGHT_PAREN);
            if (sqlParser.equalAny(Assist.END)) {
                return;
            }
        }
        parseTableFactor();
        parseJoinTable();
+1 −2
Original line number Diff line number Diff line
@@ -21,11 +21,10 @@
        <limit offset="4" row-count="5" offset-index="-1" row-count-index="-1" />
    </assert>
    
    <!-- // TODO subquery
    <assert id="assertSubSelectForLimit" sql="SELECT * FROM (select * from order where num = 1 LIMIT 5,4)" expected-sql="SELECT * FROM (SELECT * FROM [Token(order)] WHERE num = 1 LIMIT 5, 4 )">
        <tables>
            <table name="order" />
        </tables>
        <limit offset="5" row-count="4" offset-index="-1" row-count-index="-1" />
    </assert>
    -->
</asserts>