hsqldb Oracle mode select for update NOWAIT

廉价感情. 提交于 2019-12-02 08:51:39

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);
            }
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!