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


Java Report.getSql方法代码示例

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


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

示例1: getSql

import ro.nextreports.engine.Report; //导入方法依赖的package包/类
protected String getSql(Report report) {
    String sql;
    if (report == null) {
        sql = queryArea.getText();
    } else {
        if (report.getSql() != null) {
            sql = report.getSql();
        } else {
        	try {
        		for (Column col : report.getQuery().getColumns()) {            		
		col.getTable().setDialect(DialectUtil.getDialect(Globals.getConnection()));					
        		}
        	} catch (Exception e) {					
	e.printStackTrace();
	LOG.error(e.getMessage(), e);
}
            sql = report.getQuery().toString();
        }
    }
    if (sql.equals("") || sql.equals(DEFAULT_QUERY)) {
        return null;
    }
    return sql;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:25,代码来源:SQLViewPanel.java

示例2: getAllColumnsForReport

import ro.nextreports.engine.Report; //导入方法依赖的package包/类
public static List<NameType> getAllColumnsForReport(Report report, DataSource ds) throws Exception {

        String sql;
        if (report == null) {
            QueryBuilderPanel builderPanel = Globals.getMainFrame().getQueryBuilderPanel();
            builderPanel.refreshSql();
            sql = builderPanel.getUserSql();
        } else {
            if (report.getSql() != null) {
                sql = report.getSql();
            } else {
                sql = report.getQuery().toString();
            }
        }
        return getAllColumnsForSql(report, sql, ds);
    }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:17,代码来源:ReportLayoutUtil.java

示例3: getAllColumnNamesForReport

import ro.nextreports.engine.Report; //导入方法依赖的package包/类
public static List<String> getAllColumnNamesForReport(Report report, DataSource ds) throws Exception {

        String sql;
        if (report == null) {
            QueryBuilderPanel builderPanel = Globals.getMainFrame().getQueryBuilderPanel();            
            builderPanel.refreshSql();
            sql = builderPanel.getUserSql();            
        } else {
            if (report.getSql() != null) {
                sql = report.getSql();
            } else {
                sql = report.getQuery().toString();
            }
        }
        return getAllColumnNamesForSql(report, sql, ds);
    }
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:17,代码来源:ReportLayoutUtil.java

示例4: parametersAreDefined

import ro.nextreports.engine.Report; //导入方法依赖的package包/类
/**
 * Test if all parameters used in the report are defined
 *
 * @param report report object
 * @throws ParameterNotFoundException if a parameter used in the report is not defined
 */
public void parametersAreDefined(Report report) throws ParameterNotFoundException {
    String[] paramNames;
    String sql = report.getSql();
    if (sql == null) {
        sql = report.getQuery().toString();
    }
    Query query = new Query(sql);
    paramNames = query.getParameterNames();

    List<QueryParameter> parameters = report.getParameters();

    for (String paramName : paramNames) {
        QueryParameter param = null;
        for (QueryParameter p : parameters) {
            if (paramName.equals(p.getName())) {
                param = p;
            }
        }
        if (param == null) {
            throw new ParameterNotFoundException(paramName);
        }
    }
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:30,代码来源:ParameterUtil.java

示例5: getSql

import ro.nextreports.engine.Report; //导入方法依赖的package包/类
public static String getSql(Report report) {
    String sql;
    if (report.getSql() != null) {
        sql = report.getSql();
    } else {
        sql = report.getQuery().toString();
    }
    return sql;
}
 
开发者ID:nextreports,项目名称:nextreports-designer,代码行数:10,代码来源:NextReportsUtil.java

示例6: getSql

import ro.nextreports.engine.Report; //导入方法依赖的package包/类
/**
 * Get sql string from report object
 * 
 * @param report
 *            report
 * @return sql string from report object
 */
public static String getSql(Report report) {
	String sql;
	if (report.getSql() != null) {
		sql = report.getSql();
	} else {
		sql = report.getQuery().toString();
	}
	return sql;
}
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:17,代码来源:ReportUtil.java

示例7: getUsedParametersMap

import ro.nextreports.engine.Report; //导入方法依赖的package包/类
private static Map<String, QueryParameter> getUsedParametersMap(Report report, boolean withHidden, boolean onlyHidden) {  
 	if (report == null) {
 		return new HashMap<String, QueryParameter>();
 	}
     String sql = report.getSql();
     if (sql == null) {
         sql = report.getQuery().toString();
     }
     Query query = new Query(sql);

     String[] paramNames = query.getParameterNames();
     LinkedHashMap<String, QueryParameter> params = new LinkedHashMap<String, QueryParameter>();
     for (QueryParameter qp : report.getParameters()) {
         String name = qp.getName();
         boolean found = false;
         for (String pName : paramNames) {
             if (pName.equals(name)) {
             	if (onlyHidden) {
             		if (qp.isHidden()) {
             			found = true;
             			break;
             		}
             	} else if (!qp.isHidden() || (qp.isHidden() && withHidden)) {
                     found = true;
                     break;
                 }
             }
         }
         // parameter is not used inside query but it is used inside other parameter
         if (!found) {
         	if (getChildDependentParameters(report, qp).size() > 0) {
         		found = true;            	
         	} 
         }
         
         if (onlyHidden) {
         	if  (found) {
         		params.put(name, qp);
         	}
} else {
	if (found || (qp.isHidden() && withHidden)) {
		params.put(name, qp);
	}
}
     }
     return params;
 }
 
开发者ID:nextreports,项目名称:nextreports-engine,代码行数:48,代码来源:ParameterUtil.java


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