本文整理匯總了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;
}
示例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;
}
示例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();
}
}
}