Class SimpleSQLReportDataFactory
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.AbstractDataFactory
-
- org.pentaho.reporting.engine.classic.core.modules.misc.datafactory.sql.SimpleSQLReportDataFactory
-
- All Implemented Interfaces:
Serializable
,Cloneable
,DataFactory
,DataFactoryDesignTimeSupport
,DataFactoryMetaProvider
- Direct Known Subclasses:
SQLReportDataFactory
public class SimpleSQLReportDataFactory extends AbstractDataFactory
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
AbstractDataFactory.DataRowWrapper
-
-
Field Summary
Fields Modifier and Type Field Description static org.pentaho.reporting.libraries.base.config.Configuration
globalConfig
-
Fields inherited from interface org.pentaho.reporting.engine.classic.core.DataFactory
QUERY_LIMIT, QUERY_SORT, QUERY_TIMEOUT
-
Fields inherited from interface org.pentaho.reporting.engine.classic.core.DataFactoryDesignTimeSupport
DESIGN_TIME
-
-
Constructor Summary
Constructors Constructor Description SimpleSQLReportDataFactory()
SimpleSQLReportDataFactory(Connection connection)
SimpleSQLReportDataFactory(ConnectionProvider connectionProvider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancelRunningQuery()
Attempts to cancel the query process that is generating the data for this data factory.SimpleSQLReportDataFactory
clone()
void
close()
Closes the data factory and frees all resources held by this instance.protected String
computedQuery(String queryName, DataRow parameters)
int
getBestResultSetType(DataRow dataRow)
protected Connection
getConnection(DataRow dataRow)
ConnectionProvider
getConnectionProvider()
String
getPasswordField()
ArrayList<Object>
getQueryHash(String queryName, DataRow parameter)
String[]
getQueryNames()
Returns all known query-names.String[]
getReferencedFields(String query, DataRow parameters)
String
getUserField()
static boolean
isExpandArrayParameterNeeded(String query)
protected boolean
isExpandArrays()
boolean
isQueryExecutable(String query, DataRow parameters)
Checks whether the query would be executable by this datafactory.protected TableModel
parametrizeAndQuery(DataRow parameters, String translatedQuery, String[] preparedParameterNames)
ResultSet
performQuery(Statement statement, String translatedQuery, String[] preparedParameterNames)
TableModel
queryData(String query, DataRow parameters)
Queries a datasource.void
setConnectionProvider(ConnectionProvider connectionProvider)
void
setPasswordField(String passwordField)
void
setUserField(String userField)
protected String
translateQuery(String query)
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.AbstractDataFactory
calculateQueryLimit, calculateQueryTimeOut, derive, getConfiguration, getContextKey, getDataFactoryContext, getDisplayConnectionName, getLocale, getMetaData, getResourceBundleFactory, getResourceManager, initialize, queryDesignTimeStructure
-
-
-
-
Constructor Detail
-
SimpleSQLReportDataFactory
public SimpleSQLReportDataFactory()
-
SimpleSQLReportDataFactory
public SimpleSQLReportDataFactory(Connection connection)
-
SimpleSQLReportDataFactory
public SimpleSQLReportDataFactory(ConnectionProvider connectionProvider)
-
-
Method Detail
-
getUserField
public String getUserField()
-
setUserField
public void setUserField(String userField)
-
getPasswordField
public String getPasswordField()
-
setPasswordField
public void setPasswordField(String passwordField)
-
getConnection
protected Connection getConnection(DataRow dataRow) throws SQLException
- Throws:
SQLException
-
getBestResultSetType
public int getBestResultSetType(DataRow dataRow) throws SQLException
- Throws:
SQLException
-
queryData
public TableModel queryData(String query, DataRow parameters) throws ReportDataFactoryException
Queries a datasource. The string 'query' defines the name of the query. The Parameterset given here may contain more data than actually needed. The dataset may change between two calls, do not assume anything!- Parameters:
query
-parameters
-- Returns:
- Throws:
ReportDataFactoryException
- if an error occured while performing the query.
-
getReferencedFields
public String[] getReferencedFields(String query, DataRow parameters) throws ReportDataFactoryException
- Specified by:
getReferencedFields
in interfaceDataFactoryMetaProvider
- Overrides:
getReferencedFields
in classAbstractDataFactory
- Throws:
ReportDataFactoryException
-
computedQuery
protected String computedQuery(String queryName, DataRow parameters) throws ReportDataFactoryException
- Throws:
ReportDataFactoryException
-
isExpandArrayParameterNeeded
public static boolean isExpandArrayParameterNeeded(String query)
-
parametrizeAndQuery
protected TableModel parametrizeAndQuery(DataRow parameters, String translatedQuery, String[] preparedParameterNames) throws SQLException
- Throws:
SQLException
-
performQuery
public ResultSet performQuery(Statement statement, String translatedQuery, String[] preparedParameterNames) throws SQLException
- Throws:
SQLException
-
isExpandArrays
protected boolean isExpandArrays()
-
cancelRunningQuery
public void cancelRunningQuery()
Description copied from interface:DataFactory
Attempts to cancel the query process that is generating the data for this data factory. If it is not possible to cancel the query, this call should be ignored.- Specified by:
cancelRunningQuery
in interfaceDataFactory
- Overrides:
cancelRunningQuery
in classAbstractDataFactory
-
close
public void close()
Description copied from interface:DataFactory
Closes the data factory and frees all resources held by this instance.
-
clone
public SimpleSQLReportDataFactory clone()
- Specified by:
clone
in interfaceDataFactory
- Overrides:
clone
in classAbstractDataFactory
-
setConnectionProvider
public void setConnectionProvider(ConnectionProvider connectionProvider)
-
getConnectionProvider
public ConnectionProvider getConnectionProvider()
-
isQueryExecutable
public boolean isQueryExecutable(String query, DataRow parameters)
Description copied from interface:DataFactory
Checks whether the query would be executable by this datafactory. This performs a rough check, not a full query.- Parameters:
query
- the query, never null.parameters
- the parameters, never null.- Returns:
- true, if the query would be executable, false if the query is not recognized.
-
getQueryNames
public String[] getQueryNames()
Description copied from interface:DataFactory
Returns all known query-names. A data-factory may accept more than the query-names returned here.- Returns:
- the known query names.
-
getQueryHash
public ArrayList<Object> getQueryHash(String queryName, DataRow parameter)
- Specified by:
getQueryHash
in interfaceDataFactoryMetaProvider
- Overrides:
getQueryHash
in classAbstractDataFactory
-
-