hsqldb Oracle mode select for update NOWAIT

前端 未结 1 1937
长发绾君心
长发绾君心 2021-01-28 15:09

It seems NOWAIT is not supported by HSQLDB in Oracle syntax.

HSQLDB version: 2.3.3

with

SET DATABASE SQL SYNTAX ORA TRUE;

Excep

1条回答
  •  猫巷女王i
    2021-01-28 15:35

    Found answer to my own question finally after digging hsqldb source code on sourceforge.

    Version 2.3.3 of HSQLDB does NOT support NOWAIT.

    I have asked this question in their Discussion Forum and raised the issue however its not like GitHub where you can create an issue so no formal Issue/Request opened.

    I am getting along with a bad hack for now modifying HSQLDB code myself org.hsqldb.ParserDQL class to just ignore the NOWAIT in the select-for-update SQL.

    If anyone has better answer I will accept their answer.

    UPDATE: (Aug-24-2015)

    Received confirmation from HSQLDB forum that NOWAIT will be ignored. Meanwhile I am posting the code snippet to ignore NOWAIT that I received from the HSQLDB sourceforge forum. You may want to wait for the next version of HSQLDB than adding this to your code base (as a hack).

     if (Tokens.T_NOWAIT.equals(token.tokenString)) {
            read();
     }
    

    UPDATED to show the full context as to where to add the above snippet in the ParserDQL.java

        /**
     * Retrieves a SELECT or other query expression Statement from this parse context.
     */
    StatementQuery compileCursorSpecification(RangeGroup[] rangeGroups,
            int props, boolean isRoutine) {
    
        OrderedHashSet  colNames        = null;
        QueryExpression queryExpression = XreadQueryExpression();
    
        if (token.tokenType == Tokens.FOR) {
            read();
    
            if (token.tokenType == Tokens.READ
                    || token.tokenType == Tokens.FETCH) {
                read();
                readThis(Tokens.ONLY);
    
                props = ResultProperties.addUpdatable(props, false);
            } else {
                readThis(Tokens.UPDATE);
    
                props = ResultProperties.addUpdatable(props, true);
    
                if (token.tokenType == Tokens.OF) {
                    readThis(Tokens.OF);
    
                    colNames = new OrderedHashSet();
    
                    readColumnNameList(colNames, null, false);
                }
                if (Tokens.T_NOWAIT.equalsIgnoreCase(token.tokenString)) {
                    readIfThis(Tokens.X_IDENTIFIER);
                }
            }
        }
    

    0 讨论(0)
提交回复
热议问题