Search in sources :

Example 1 with ResultSetToMapConverter

use of com.kyj.fx.voeditor.visual.functions.ResultSetToMapConverter in project Gargoyle by callakrsos.

the class CommonsSqllPan method singleConnection.

protected List<Map<String, Object>> singleConnection(Connection con, String query, Map<String, Object> param) throws Exception {
    List<Map<String, Object>> arrayList = new ArrayList<>();
    if (DbUtil.isDml(query)) {
        int update = DbUtil.update(con, query);
        Map<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("result", update);
        arrayList.add(hashMap);
    } else {
        String sql = query;
        Properties prop = new Properties();
        // Velocity텍스트이면 변수맵핑 처리를한다.
        if (ValueUtil.isVelocityContext(sql)) {
            sql = getDynmicSQL(sql, param, false);
        }
        // 큰사이즈 컬럼은 간단한 형식으로 표시할지 유무.
        if ("true".equals(ResourceLoader.getInstance().get(ResourceLoader.SKIP_BIG_DATA_COLUMN))) {
            prop.put(ResourceLoader.SKIP_BIG_DATA_COLUMN, true);
        }
        int limitSize = -1;
        if ("true".equals(ResourceLoader.getInstance().get(ResourceLoader.APPLY_MAX_ROW_COUNT))) {
            /* 2016. 02. 11 velocity 문법을 적용하여 rownum 적용 */
            // String dynamicSql =
            // ConfigResourceLoader.getInstance().get(ConfigResourceLoader.SQL_LIMIT_WRAPPER);
            // HashMap<String, Object> paramMap = new HashMap<String,
            // Object>();
            // paramMap.put(ConfigResourceLoader.USER_SQL, sql);
            // paramMap.put(ConfigResourceLoader.START_ROW, 0);
            // paramMap.put(ConfigResourceLoader.MAX_ROW, 1000);
            // sql = ValueUtil.getVelocityToText(dynamicSql, paramMap);
            limitSize = 1000;
        }
        prop.put("pageIndex", 0);
        arrayList = DbUtil.select(con, sql, 10, limitSize, new ResultSetToMapConverter(prop));
    }
    return arrayList;
}
Also used : HashMap(java.util.HashMap) ResultSetToMapConverter(com.kyj.fx.voeditor.visual.functions.ResultSetToMapConverter) ArrayList(java.util.ArrayList) Properties(java.util.Properties) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with ResultSetToMapConverter

use of com.kyj.fx.voeditor.visual.functions.ResultSetToMapConverter in project Gargoyle by callakrsos.

the class CommonsSqllPan method baseConnection.

protected List<Map<String, Object>> baseConnection(String query, Map<String, Object> param) throws Exception {
    List<Map<String, Object>> arrayList = new ArrayList<>();
    if (DbUtil.isDml(query)) {
        int update = DbUtil.update(query);
        Map<String, Object> hashMap = new HashMap<String, Object>();
        hashMap.put("result", update);
        arrayList.add(hashMap);
    } else {
        String sql = query;
        Properties prop = new Properties();
        // Velocity텍스트이면 변수맵핑 처리를한다.
        if (ValueUtil.isVelocityContext(sql)) {
            sql = getDynmicSQL(sql, param);
        }
        // 큰사이즈 컬럼은 간단한 형식으로 표시할지 유무.
        if ("true".equals(ResourceLoader.getInstance().get(ResourceLoader.SKIP_BIG_DATA_COLUMN))) {
            prop.put(ResourceLoader.SKIP_BIG_DATA_COLUMN, true);
        }
        int limitSize = -1;
        if ("true".equals(ResourceLoader.getInstance().get(ResourceLoader.APPLY_MAX_ROW_COUNT))) {
            /* 2016. 02. 11 velocity 문법을 적용하여 rownum 적용 */
            // String dynamicSql =
            // ConfigResourceLoader.getInstance().get(ConfigResourceLoader.SQL_LIMIT_WRAPPER);
            // HashMap<String, Object> paramMap = new HashMap<String,
            // Object>();
            // paramMap.put(ConfigResourceLoader.USER_SQL, sql);
            // paramMap.put(ConfigResourceLoader.START_ROW, 0);
            // paramMap.put(ConfigResourceLoader.MAX_ROW, 1000);
            // sql = ValueUtil.getVelocityToText(dynamicSql, paramMap);
            limitSize = 1000;
        }
        prop.put("pageIndex", 0);
        arrayList = DbUtil.select(sql, 10, limitSize, new ResultSetToMapConverter(prop));
    }
    return arrayList;
}
Also used : HashMap(java.util.HashMap) ResultSetToMapConverter(com.kyj.fx.voeditor.visual.functions.ResultSetToMapConverter) ArrayList(java.util.ArrayList) Properties(java.util.Properties) Map(java.util.Map) HashMap(java.util.HashMap)

Example 3 with ResultSetToMapConverter

use of com.kyj.fx.voeditor.visual.functions.ResultSetToMapConverter in project Gargoyle by callakrsos.

the class DbUtil method selectCursor.

public static List<Map<String, Object>> selectCursor(final Connection con, final String sql, int startRow, int limitRow) throws Exception {
    Properties properties = new Properties();
    properties.put(ResultSetToMapConverter.START_ROW, --startRow);
    return select(con, sql, DEFAULT_FETCH_SIZE, limitRow, READ_ONLY_CURSOR_PREPAREDSTATEMENT_CONVERTER, new ResultSetToMapConverter(properties));
}
Also used : ResultSetToMapConverter(com.kyj.fx.voeditor.visual.functions.ResultSetToMapConverter) PoolProperties(org.apache.tomcat.jdbc.pool.PoolProperties) Properties(java.util.Properties)

Aggregations

ResultSetToMapConverter (com.kyj.fx.voeditor.visual.functions.ResultSetToMapConverter)3 Properties (java.util.Properties)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 PoolProperties (org.apache.tomcat.jdbc.pool.PoolProperties)1