use of info.xiancloud.dao.core.action.AbstractSqlAction in project xian by happyyangyuan.
the class DaoUnit method logSql.
/**
* 打印sql语句,它不会将sql执行,只是打印sql语句。
* 仅供内部测试使用
*
* @param daoUnitClass unit class
* @param map parameter map
*/
public static void logSql(Class daoUnitClass, Map<String, Object> map) {
XianConnection connection = PoolFactory.getPool().getMasterDatasource().getConnection().blockingGet();
DaoUnit daoUnit;
try {
daoUnit = (DaoUnit) daoUnitClass.newInstance();
for (SqlAction action : daoUnit.getActions()) {
((AbstractSqlAction) action).setConnection(connection);
((AbstractSqlAction) action).setMap(map);
action.logSql(map);
}
} catch (InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
PoolFactory.getPool().destroyPoolIfNot();
}
Aggregations