| | QueryParser.TableColumnContext tableColumn = ctx.tableColumn(); |
| | QueryParser.ExprSetContext set = ctx.exprSet(); |
| | - QueryParser.ExprValueContext value = ctx.exprValue(); |
| | |
| | // If the terminal node is null, then the equality is T_INEQ. |
| | - TerminalNode equal = ctx.getToken( QueryParser.T_EQ, 0 ); |
| | + TerminalNode equals = ctx.getToken( QueryParser.T_EQ, 0 ); |
| | |
| | String entity = tableColumn.getText(); |
| | + String equalTo = (equals == null) ? "NOT " : ""; |
| | |
| | if( set == null ) { |
| | - // Presume = or <> by default (could change to IS or IS NOT). |
| | + // Presume = or <> by default (changes to IS or IS NOT as needed). |
| | String comparator = ctx.getChild(1).getText(); |
| | - |
| | - QueryParser.LiteralContext literal = value.literal(); |
| | + QueryParser.LiteralContext literal = ctx.exprValue().literal(); |
| | |
| | if( literal == null ) { |
 |
| | if( literal.T_NULL() != null ) { |
| | rhs = "NULL"; |
| | - comparator = " IS " + (equal == null ? "NOT " : ""); |
| | + comparator = " IS " + equalTo; |
| | } |
| | |
| | append( String.format( "%s%s%s", entity, comparator, rhs ) ); |
| | } |
| | } |
| | else { |
| | // Transform to ANSI SQL set notation. |
| | append( String.format( "%s %sIN (%s)", |
| | entity, |
| | - equal == null ? "NOT " : "", |
| | + equalTo, |
| | set.exprList().getText() ) ); |
| | } |