use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_not_2 method test_exits.
public void test_exits() throws Exception {
String sql = "NOT A=1 AND NOT B=1";
SQLNotExpr exprA, exprB;
{
OracleExprParser parser = new OracleExprParser(sql);
SQLBinaryOpExpr binaryEpr = (SQLBinaryOpExpr) parser.expr();
exprA = (SQLNotExpr) binaryEpr.getLeft();
exprB = (SQLNotExpr) binaryEpr.getRight();
}
Assert.assertNotNull(exprA);
Assert.assertNotNull(exprB);
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_any method test_exits.
public void test_exits() throws Exception {
String sql = "any(select id from t)";
String sql_c = "any(select id from t1)";
SQLAnyExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLAnyExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLAnyExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLAnyExpr) 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 SQLAnyExpr(), new SQLAnyExpr());
Assert.assertEquals(new SQLAnyExpr().hashCode(), new SQLAnyExpr().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_cast method test_exits.
public void test_exits() throws Exception {
String sql = "cast(a as varchar(50))";
String sql_c = "cast(b as varchar(50))";
SQLCastExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (SQLCastExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (SQLCastExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLCastExpr) 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 SQLCastExpr(), new SQLCastExpr());
Assert.assertEquals(new SQLCastExpr().hashCode(), new SQLCastExpr().hashCode());
Assert.assertEquals(new SQLDataTypeImpl(), new SQLDataTypeImpl());
Assert.assertEquals(new SQLDataTypeImpl().hashCode(), new SQLDataTypeImpl().hashCode());
}
use of com.alibaba.druid.sql.dialect.oracle.parser.OracleExprParser in project druid by alibaba.
the class EqualTest_cursor method test_exits.
public void test_exits() throws Exception {
String sql = "CURSOR(select id from t)";
String sql_c = "CURSOR(select id from t1)";
OracleCursorExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (OracleCursorExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (OracleCursorExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (OracleCursorExpr) 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 OracleCursorExpr(), new OracleCursorExpr());
Assert.assertEquals(new OracleCursorExpr().hashCode(), new OracleCursorExpr().hashCode());
}
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";
OracleDbLinkExpr exprA, exprB, exprC;
{
OracleExprParser parser = new OracleExprParser(sql);
exprA = (OracleDbLinkExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql);
exprB = (OracleDbLinkExpr) parser.expr();
}
{
OracleExprParser parser = new OracleExprParser(sql_c);
exprC = (OracleDbLinkExpr) 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 OracleDbLinkExpr(), new OracleDbLinkExpr());
Assert.assertEquals(new OracleDbLinkExpr().hashCode(), new OracleDbLinkExpr().hashCode());
}
Aggregations