use of io.seata.sqlparser.SQLDeleteRecognizer in project seata by seata.
the class PostgresqlDeleteRecognizerTest method testGetTableName.
@Test
public void testGetTableName() {
String sql = "delete from t where id = ?";
List<SQLStatement> asts = SQLUtils.parseStatements(sql, DB_TYPE);
List<SQLRecognizer> sqlRecognizers = SQLVisitorFactory.get(sql, DB_TYPE);
SQLDeleteRecognizer recognizer = (SQLDeleteRecognizer) sqlRecognizers.get(0);
Assertions.assertEquals(recognizer.getTableName(), "t");
}
use of io.seata.sqlparser.SQLDeleteRecognizer in project seata by seata.
the class DeleteExecutor method beforeImage.
@Override
protected TableRecords beforeImage() throws SQLException {
SQLDeleteRecognizer visitor = (SQLDeleteRecognizer) sqlRecognizer;
TableMeta tmeta = getTableMeta(visitor.getTableName());
ArrayList<List<Object>> paramAppenderList = new ArrayList<>();
String selectSQL = buildBeforeImageSQL(visitor, tmeta, paramAppenderList);
return buildTableRecords(tmeta, selectSQL, paramAppenderList);
}
Aggregations