use of com.alibaba.druid.sql.parser.SQLExprParser in project druid by alibaba.
the class EqualTest_inquery_mysql method test_exits.
public void test_exits() throws Exception {
String sql = "fstate in (select state from t_status)";
String sql_c = "fstate_c in (select state from t_status)";
SQLInSubQueryExpr exprA, exprB, exprC;
{
SQLExprParser parser = new SQLExprParser(sql);
exprA = (SQLInSubQueryExpr) parser.expr();
}
{
SQLExprParser parser = new SQLExprParser(sql);
exprB = (SQLInSubQueryExpr) parser.expr();
}
{
SQLExprParser parser = new SQLExprParser(sql_c);
exprC = (SQLInSubQueryExpr) 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 SQLInSubQueryExpr(), new SQLInSubQueryExpr());
Assert.assertEquals(new SQLInSubQueryExpr().hashCode(), new SQLInSubQueryExpr().hashCode());
}
use of com.alibaba.druid.sql.parser.SQLExprParser in project druid by alibaba.
the class EqualTest_inquery_oracle method test_exits.
public void test_exits() throws Exception {
String sql = "fstate in (select state from t_status)";
String sql_c = "fstate_c in (select state from t_status)";
SQLInSubQueryExpr exprA, exprB, exprC;
{
SQLExprParser parser = new OracleExprParser(sql);
exprA = (SQLInSubQueryExpr) parser.expr();
}
{
SQLExprParser parser = new OracleExprParser(sql);
exprB = (SQLInSubQueryExpr) parser.expr();
}
{
SQLExprParser parser = new OracleExprParser(sql_c);
exprC = (SQLInSubQueryExpr) 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 SQLInSubQueryExpr(), new SQLInSubQueryExpr());
Assert.assertEquals(new SQLInSubQueryExpr().hashCode(), new SQLInSubQueryExpr().hashCode());
}
use of com.alibaba.druid.sql.parser.SQLExprParser in project druid by alibaba.
the class EqualTest_orderBy method test_exits.
public void test_exits() throws Exception {
String sql = "ORDER BY f1";
String sql_c = "ORDER BY f2";
SQLOrderBy exprA, exprB, exprC;
{
SQLExprParser parser = new SQLExprParser(sql);
exprA = (SQLOrderBy) parser.parseOrderBy();
}
{
SQLExprParser parser = new SQLExprParser(sql);
exprB = (SQLOrderBy) parser.parseOrderBy();
}
{
SQLExprParser parser = new SQLExprParser(sql_c);
exprC = (SQLOrderBy) parser.parseOrderBy();
}
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 SQLOrderBy(), new SQLOrderBy());
Assert.assertEquals(new SQLOrderBy().hashCode(), new SQLOrderBy().hashCode());
Assert.assertEquals(new SQLSelectOrderByItem(), new SQLSelectOrderByItem());
Assert.assertEquals(new SQLSelectOrderByItem().hashCode(), new SQLSelectOrderByItem().hashCode());
}
use of com.alibaba.druid.sql.parser.SQLExprParser in project druid by alibaba.
the class EqualTest_binary method test_exits.
public void test_exits() throws Exception {
String sql = "b'01010'";
String sql_c = "b'010101'";
SQLBinaryExpr exprA, exprB, exprC;
{
SQLExprParser parser = new MySqlExprParser(sql);
exprA = (SQLBinaryExpr) parser.expr();
}
{
SQLExprParser parser = new MySqlExprParser(sql);
exprB = (SQLBinaryExpr) parser.expr();
}
{
SQLExprParser parser = new MySqlExprParser(sql_c);
exprC = (SQLBinaryExpr) 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 SQLBinaryExpr(), new SQLBinaryExpr());
Assert.assertEquals(new SQLBinaryExpr().hashCode(), new SQLBinaryExpr().hashCode());
}
use of com.alibaba.druid.sql.parser.SQLExprParser in project druid by alibaba.
the class EqualTest_boolean method test_exits.
public void test_exits() throws Exception {
String sql = "true";
String sql_c = "false";
SQLBooleanExpr exprA, exprB, exprC;
{
SQLExprParser parser = new MySqlExprParser(sql);
exprA = (SQLBooleanExpr) parser.expr();
}
{
SQLExprParser parser = new MySqlExprParser(sql);
exprB = (SQLBooleanExpr) parser.expr();
}
{
SQLExprParser parser = new MySqlExprParser(sql_c);
exprC = (SQLBooleanExpr) 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 SQLBooleanExpr(), new SQLBooleanExpr());
Assert.assertEquals(new SQLBooleanExpr().hashCode(), new SQLBooleanExpr().hashCode());
}
Aggregations