Search in sources :

Example 1 with AbstractAction

use of info.xiancloud.dao.jdbc.sql.AbstractAction in project xian by happyyangyuan.

the class DaoUnit method logSql.

/**
 * 打印sql语句,它不会将sql执行,只是打印sql语句。
 * 仅供内部测试使用
 */
public static void logSql(Class daoUnitClass, Map map) {
    try (Connection conn = DriverManager.getConnection(DatasourceConfigReader.getWriteUrl(), DatasourceConfigReader.getWriteUser(), DatasourceConfigReader.getWritePwd())) {
        DaoUnit daoUnit = (DaoUnit) daoUnitClass.newInstance();
        for (Action action : daoUnit.getActions()) {
            ((AbstractAction) action).setConnection(conn);
            ((AbstractAction) action).setMap(map);
            /*((AbstractAction) action).create();*/
            action.logSql(map);
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
}
Also used : AbstractAction(info.xiancloud.dao.jdbc.sql.AbstractAction) Action(info.xiancloud.dao.jdbc.sql.Action) Connection(java.sql.Connection) AbstractAction(info.xiancloud.dao.jdbc.sql.AbstractAction)

Aggregations

AbstractAction (info.xiancloud.dao.jdbc.sql.AbstractAction)1 Action (info.xiancloud.dao.jdbc.sql.Action)1 Connection (java.sql.Connection)1