📄 reportmanagerimpl.java
字号:
package net.sf.jxls.report;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.Map;
import org.apache.commons.beanutils.RowSetDynaClass;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @author Leonid Vysochyn
*/
public class ReportManagerImpl implements ReportManager {
protected final Log log = LogFactory.getLog(getClass());
Connection connection;
Map beans;
public ReportManagerImpl(Connection connection, Map beans) {
this.connection = connection;
this.beans = beans;
}
public ReportManagerImpl(Connection connection) {
this.connection = connection;
}
public Connection getConnection() {
return connection;
}
public void setConnection(Connection connection) {
this.connection = connection;
}
public List exec(String sql) throws SQLException {
Statement stmt = connection.createStatement();
sql = sql.replaceAll("'", "'");
ResultSet rs = stmt.executeQuery(sql);
// second parameter to RowSetDynaClass constructor indicates that properties should not be lowercased
RowSetDynaClass rsdc = new RowSetDynaClass(rs, true);
stmt.close();
rs.close();
return rsdc.getRows();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -