當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。