当前位置: 首页>>代码示例>>Java>>正文


Java QueryUtil.getColumns方法代码示例

本文整理汇总了Java中ro.nextreports.engine.util.QueryUtil.getColumns方法的典型用法代码示例。如果您正苦于以下问题:Java QueryUtil.getColumns方法的具体用法?Java QueryUtil.getColumns怎么用?Java QueryUtil.getColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ro.nextreports.engine.util.QueryUtil的用法示例。


在下文中一共展示了QueryUtil.getColumns方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllColumnTypesForReport

import ro.nextreports.engine.util.QueryUtil; //导入方法依赖的package包/类
public static List<String> getAllColumnTypesForReport(String sql) throws Exception {
    List<String> columnTypes = new ArrayList<String>();
    Connection con = null;
    String md5Key = Cache.getColumnsKey(sql);        
    List<NameType> result = Cache.getColumns(md5Key);
    if (result != null) {        	
    	return ReportUtil.getColumnTypes(result);
    }
    try {
        con = Globals.createTempConnection(
                DefaultDataSourceManager.getInstance().getConnectedDataSource());
        QueryUtil qu = new QueryUtil(con, Globals.getDialect());
        // get parameters definition from system
        Map<String, QueryParameter> params = new HashMap<String, QueryParameter>();
        ParameterManager paramManager = ParameterManager.getInstance();
        List<String> paramNames = paramManager.getParameterNames();
        for (String paramName : paramNames) {
            QueryParameter param = paramManager.getParameter(paramName);
            if (param == null) {
                throw new Exception(I18NSupport.getString("parameter.undefined", paramName));
            }
            params.put(paramName, param);
        }
        List <NameType>  columns = qu.getColumns(sql, params);
        columnTypes = ReportUtil.getColumnTypes(columns);
        Cache.setColumns(md5Key, columns);
    } finally {
        if (con != null) {
            con.close();
        }
    }

    return columnTypes;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:35,代码来源:ReportLayoutUtil.java

示例2: getAllColumnsForReport

import ro.nextreports.engine.util.QueryUtil; //导入方法依赖的package包/类
public static List<NameType> getAllColumnsForReport(String sql) throws Exception {
    List<NameType> columnTypes = new ArrayList<NameType>();
    String md5Key = Cache.getColumnsKey(sql);
    List<NameType> result = Cache.getColumns(md5Key);
    if (result != null) {        	
    	return result;
    }
    Connection con = null;
    try {
        con = Globals.createTempConnection(
                DefaultDataSourceManager.getInstance().getConnectedDataSource());
        QueryUtil qu = new QueryUtil(con, Globals.getDialect());
        // get parameters definition from system
        Map<String, QueryParameter> params = new HashMap<String, QueryParameter>();
        ParameterManager paramManager = ParameterManager.getInstance();
        List<String> paramNames = paramManager.getParameterNames();
        for (String paramName : paramNames) {
            QueryParameter param = paramManager.getParameter(paramName);
            if (param == null) {
                throw new Exception(I18NSupport.getString("parameter.undefined", paramName));
            }
            params.put(paramName, param);
        }
        columnTypes = qu.getColumns(sql, params);
        Cache.setColumns(md5Key, columnTypes);
    } finally {
        if (con != null) {
            con.close();
        }
    }       
    return columnTypes;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:33,代码来源:ReportLayoutUtil.java

示例3: getColumnTypeForReportColumn

import ro.nextreports.engine.util.QueryUtil; //导入方法依赖的package包/类
public static String getColumnTypeForReportColumn(String sql, String column) throws Exception {
    Connection con = null;  
    String md5Key = Cache.getColumnsKey(sql);        
    List<NameType> result = Cache.getColumns(md5Key);
    if (result != null) {        	
    	return getColumnTypeByName(column, result);
    }
    try {
        con = Globals.createTempConnection(
                DefaultDataSourceManager.getInstance().getConnectedDataSource());
        QueryUtil qu = new QueryUtil(con, Globals.getDialect());
        // get parameters definition from system
        Map<String, QueryParameter> params = new HashMap<String, QueryParameter>();
        ParameterManager paramManager = ParameterManager.getInstance();
        List<String> paramNames = paramManager.getParameterNames();
        for (String paramName : paramNames) {
            QueryParameter param = paramManager.getParameter(paramName);
            if (param == null) {
                throw new Exception(I18NSupport.getString("parameter.undefined", paramName));
            }
            params.put(paramName, param);
        }
        List<NameType> columns = qu.getColumns(sql, params);
        Cache.setColumns(md5Key, columns);
        return getColumnTypeByName(column, columns);
    } finally {
        if (con != null) {
            con.close();
        }
    }        
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:32,代码来源:ReportLayoutUtil.java


注:本文中的ro.nextreports.engine.util.QueryUtil.getColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。