use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_exists method test_exits.
public void test_exits() throws Exception {
String sql = "exists (select 1)";
String sql_c = "not exists (select 1)";
SQLExistsExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLExistsExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLExistsExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLExistsExpr) 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 SQLExistsExpr(), new SQLExistsExpr());
Assert.assertEquals(new SQLExistsExpr().hashCode(), new SQLExistsExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_query method test_exits.
public void test_exits() throws Exception {
String sql = "(select id from t)";
String sql_c = "(select id from t1)";
SQLQueryExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLQueryExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLQueryExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLQueryExpr) 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 SQLQueryExpr(), new SQLQueryExpr());
Assert.assertEquals(new SQLQueryExpr().hashCode(), new SQLQueryExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_unary method test_exits.
public void test_exits() throws Exception {
String sql = "-a";
String sql_c = "-(a+1 + +(b+1))";
SQLUnaryExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLUnaryExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLUnaryExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLUnaryExpr) 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 SQLUnaryExpr(), new SQLUnaryExpr());
Assert.assertEquals(new SQLUnaryExpr().hashCode(), new SQLUnaryExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_inList method test_exits.
public void test_exits() throws Exception {
String sql = "x in (1, 2, 3)";
String sql_c = "x not in (1, 2, 3)";
SQLInListExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLInListExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLInListExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLInListExpr) 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 SQLInListExpr(), new SQLInListExpr());
Assert.assertEquals(new SQLInListExpr().hashCode(), new SQLInListExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_not method test_exits.
public void test_exits() throws Exception {
String sql = "not f1 = f2";
String sql_c = "not f1 = f3";
SQLNotExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLNotExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLNotExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLNotExpr) 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 SQLNotExpr(), new SQLNotExpr());
Assert.assertEquals(new SQLNotExpr().hashCode(), new SQLNotExpr().hashCode());
}
Aggregations