use of io.seata.common.exception.DataAccessException in project XHuiCloud by sindaZeng.
the class LogStoreDataBaseDAO method queryGlobalTransactionDO.
@Override
public List<GlobalTransactionDO> queryGlobalTransactionDO(int[] statuses, int limit) {
List<GlobalTransactionDO> ret = new ArrayList<>();
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
conn = logStoreDataSource.getConnection();
conn.setAutoCommit(true);
String paramsPlaceHolder = org.apache.commons.lang.StringUtils.repeat("?", ",", statuses.length);
String sql = LogStoreSqlsFactory.getLogStoreSqls(dbType).getQueryGlobalTransactionSQLByStatus(globalTable, paramsPlaceHolder);
ps = conn.prepareStatement(sql);
for (int i = 0; i < statuses.length; i++) {
int status = statuses[i];
ps.setInt(i + 1, status);
}
ps.setInt(statuses.length + 1, limit);
rs = ps.executeQuery();
while (rs.next()) {
ret.add(convertGlobalTransactionDO(rs));
}
return ret;
} catch (SQLException e) {
throw new DataAccessException(e);
} finally {
IOUtil.close(rs, ps, conn);
}
}
Aggregations