use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_number method test_exits.
public void test_exits() throws Exception {
String sql = "3.5";
String sql_c = "3.51";
SQLNumberExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLNumberExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLNumberExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLNumberExpr) 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 SQLNumberExpr(), new SQLNumberExpr());
Assert.assertEquals(new SQLNumberExpr().hashCode(), new SQLNumberExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_some method test_exits.
public void test_exits() throws Exception {
String sql = "some(select id from t)";
String sql_c = "some(select id from t1)";
SQLSomeExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLSomeExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLSomeExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLSomeExpr) 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 SQLSomeExpr(), new SQLSomeExpr());
Assert.assertEquals(new SQLSomeExpr().hashCode(), new SQLSomeExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_between method test_exits.
public void test_exits() throws Exception {
String sql = "x between 1 AND 2";
String sql_c = "x between 1 AND 3";
SQLBetweenExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLBetweenExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLBetweenExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLBetweenExpr) 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 SQLBetweenExpr(), new SQLBetweenExpr());
Assert.assertEquals(new SQLBetweenExpr().hashCode(), new SQLBetweenExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_binaryOp method test_exits.
public void test_exits() throws Exception {
String sql = "a > b";
String sql_c = "a > 2";
SQLBinaryOpExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLBinaryOpExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLBinaryOpExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLBinaryOpExpr) 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 SQLBinaryOpExpr(), new SQLBinaryOpExpr());
Assert.assertEquals(new SQLBinaryOpExpr().hashCode(), new SQLBinaryOpExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_case method test_exits.
public void test_exits() throws Exception {
String sql = "case x when 1 then 0 else 2 end";
String sql_c = "case x when 2 then 0 else 2 end";
SQLCaseExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLCaseExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLCaseExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLCaseExpr) 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 SQLCaseExpr(), new SQLCaseExpr());
Assert.assertEquals(new SQLCaseExpr().hashCode(), new SQLCaseExpr().hashCode());
}
Aggregations