Search in sources :

Example 21 with OracleExprParser

use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.

the class EqualTest_dbLink method test_eq.

public void test_eq() throws Exception {
    String sql = "a@b";
    String sql_c = "a@c";
    SQLDbLinkExpr exprA, exprB, exprC;
    {
        OracleExprParser parser = new OracleExprParser(sql);
        exprA = (SQLDbLinkExpr) parser.expr();
    }
    {
        OracleExprParser parser = new OracleExprParser(sql);
        exprB = (SQLDbLinkExpr) parser.expr();
    }
    {
        OracleExprParser parser = new OracleExprParser(sql_c);
        exprC = (SQLDbLinkExpr) parser.expr();
    }
    Assert.assertEquals(exprA, exprB);
    Assert.assertNotEquals(exprA, exprC);
    Assert.assertTrue(exprA.equals(exprA));
    Assert.assertFalse(exprA.equals(new Object()));
    Assert.assertEquals(exprA.hashCode(), exprB.hashCode());
    Assert.assertEquals(new SQLDbLinkExpr(), new SQLDbLinkExpr());
    Assert.assertEquals(new SQLDbLinkExpr().hashCode(), new SQLDbLinkExpr().hashCode());
}
Also used : SQLDbLinkExpr(com.alibaba.druid.sql.ast.expr.SQLDbLinkExpr) OracleExprParser(com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser)

Aggregations

OracleExprParser (com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser)21 SQLBinaryOpExpr (com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr)2 SQLNotExpr (com.alibaba.druid.sql.ast.expr.SQLNotExpr)2 SQLDataTypeImpl (com.alibaba.druid.sql.ast.SQLDataTypeImpl)1 SQLAggregateExpr (com.alibaba.druid.sql.ast.expr.SQLAggregateExpr)1 SQLAnyExpr (com.alibaba.druid.sql.ast.expr.SQLAnyExpr)1 SQLBetweenExpr (com.alibaba.druid.sql.ast.expr.SQLBetweenExpr)1 SQLCaseExpr (com.alibaba.druid.sql.ast.expr.SQLCaseExpr)1 SQLCastExpr (com.alibaba.druid.sql.ast.expr.SQLCastExpr)1 SQLDbLinkExpr (com.alibaba.druid.sql.ast.expr.SQLDbLinkExpr)1 SQLExistsExpr (com.alibaba.druid.sql.ast.expr.SQLExistsExpr)1 SQLInListExpr (com.alibaba.druid.sql.ast.expr.SQLInListExpr)1 SQLInSubQueryExpr (com.alibaba.druid.sql.ast.expr.SQLInSubQueryExpr)1 SQLMethodInvokeExpr (com.alibaba.druid.sql.ast.expr.SQLMethodInvokeExpr)1 SQLNumberExpr (com.alibaba.druid.sql.ast.expr.SQLNumberExpr)1 SQLQueryExpr (com.alibaba.druid.sql.ast.expr.SQLQueryExpr)1 SQLSomeExpr (com.alibaba.druid.sql.ast.expr.SQLSomeExpr)1 SQLTimestampExpr (com.alibaba.druid.sql.ast.expr.SQLTimestampExpr)1 SQLUnaryExpr (com.alibaba.druid.sql.ast.expr.SQLUnaryExpr)1 MySqlKey (com.alibaba.druid.sql.dialect.mysql.ast.MySqlKey)1