use of io.seata.sqlparser.SQLSelectRecognizer in project seata by seata.
the class PostgresqlSelectForUpdateRecognizerTest method testGetTableName.
@Test
public void testGetTableName() {
String sql = "select * from t where id = ? for update";
SQLSelectRecognizer recognizer = (SQLSelectRecognizer) SQLVisitorFactory.get(sql, DB_TYPE).get(0);
Assertions.assertEquals(recognizer.getTableName(), "t");
}
use of io.seata.sqlparser.SQLSelectRecognizer in project seata by seata.
the class PostgresqlSelectForUpdateRecognizerTest method testGetTableAlias.
@Test
public void testGetTableAlias() {
String sql = "select * from t where id = ? for update";
SQLSelectRecognizer recognizer = (SQLSelectRecognizer) SQLVisitorFactory.get(sql, DB_TYPE).get(0);
Assertions.assertNull(recognizer.getTableAlias());
}
use of io.seata.sqlparser.SQLSelectRecognizer in project seata by seata.
the class PostgresqlSelectForUpdateRecognizerTest method testGetWhereCondition_1.
@Test
public void testGetWhereCondition_1() {
String sql = "select * from t for update";
SQLSelectRecognizer recognizer = (SQLSelectRecognizer) SQLVisitorFactory.get(sql, DB_TYPE).get(0);
String whereCondition = recognizer.getWhereCondition();
Assertions.assertEquals("", whereCondition);
}
use of io.seata.sqlparser.SQLSelectRecognizer in project seata by seata.
the class PostgresqlSelectForUpdateRecognizerTest method testGetSqlType.
@Test
public void testGetSqlType() {
String sql = "select * from t where id = ? for update";
SQLSelectRecognizer recognizer = (SQLSelectRecognizer) SQLVisitorFactory.get(sql, DB_TYPE).get(0);
Assertions.assertEquals(recognizer.getSQLType(), SQLType.SELECT_FOR_UPDATE);
}
use of io.seata.sqlparser.SQLSelectRecognizer in project seata by seata.
the class PostgresqlSelectForUpdateRecognizerTest method testGetWhereCondition_0.
@Test
public void testGetWhereCondition_0() {
String sql = "select * from t for update";
SQLSelectRecognizer recognizer = (SQLSelectRecognizer) SQLVisitorFactory.get(sql, DB_TYPE).get(0);
String whereCondition = recognizer.getWhereCondition(new ParametersHolder() {
@Override
public Map<Integer, ArrayList<Object>> getParameters() {
return null;
}
}, new ArrayList<>());
Assertions.assertEquals("", whereCondition);
}
Aggregations