public class QueryValueProvider extends SQLValueProvider implements CascadingSource, HasCascadingParent
Connection.createStatement()
and
Statement.executeQuery(String)
, which means that the SQL query can be any standard
SQL statement. SPs also work for most databases, but not for Oracle or PostgreSQL.Datasource
,
Statement.execute(String)
,
Serialized FormMAX_RECORDS
Constructor and Description |
---|
QueryValueProvider(java.lang.String query,
Datasource datasource)
Creates an instance of QueryValueProvider with the given query and data source.
|
Modifier and Type | Method and Description |
---|---|
Datasource |
getDatasource()
Returns the data source the query is to be run on
|
java.lang.String |
getFieldRefName()
Returns the name to be used as the SQL reference name in the WHERE part of the query
used by a cascading prompt referencing this as its parent.
|
PromptField |
getParent()
Returns the set parent prompt field
|
java.lang.String |
getQuery()
Get the current query to execute.
|
java.lang.String |
getSQL()
Returns the query which is to be used for fetching the values and optionally descriptions dynamically.
|
void |
setDatasource(Datasource datasource)
Sets the data source on which the query is to be executed.
|
void |
setFieldRefName(java.lang.String refName)
Sets the reference name to use if this provider used as a parent source to a cascading prompt.
|
void |
setParent(PromptField parent)
Sets the parent prompt field which is to be used for filtering the default values.
|
void |
setQuery(java.lang.String query)
Query to execute.
|
void |
setSQL(java.lang.String query)
Deprecated.
As of i-net Clear Reports 16, use
setQuery(String) instead |
getDefaultValues
getDefaultValues
isDOMParser, parseDOM, parseElement, parseEndElement, parseText
public QueryValueProvider(java.lang.String query, Datasource datasource)
query
- Query to use to extract default values from, may not be null. Its ResultSet
should have its first column be the value of each default value and an optional second
column will be used as the description of each default value. Optionally instead, there should be a
column called 'value' and a column called 'description'.datasource
- data source to run the query on, may not be nulljava.lang.IllegalArgumentException
- if the query or the data source is nullDatasource
,
DynamicValueProvider
public void setDatasource(Datasource datasource)
datasource
- data source to execute the query on.java.lang.IllegalArgumentException
- if datasource is nullpublic Datasource getDatasource()
getDatasource
in class SQLValueProvider
@Deprecated public void setSQL(java.lang.String query)
setQuery(String)
insteadquery
- Query to execute. Its ResultSet should have its first column be the value of each
default value and an optional second column will be used as the description of each
default value.java.lang.IllegalArgumentException
- if query is nullpublic void setQuery(java.lang.String query)
query
- Query to execute. Its ResultSet should have its first column be the value of each
default value and an optional second column will be used as the description of each
default value.java.lang.IllegalArgumentException
- if query is nullpublic java.lang.String getQuery()
public java.lang.String getSQL() throws ReportException
getSQL
in class SQLValueProvider
ReportException
- if the database structure does allow a single joined querypublic java.lang.String getFieldRefName()
reference name
= prompt value
)".getFieldRefName
in interface CascadingSource
CascadingValueProvider
,
SQLValueProvider
public void setFieldRefName(java.lang.String refName)
refName
- Reference name to use in the SQL query to filter cascading results if this provider
is referenced as a parent to a cascading prompt.public PromptField getParent()
getParent
in interface HasCascadingParent
public void setParent(PromptField parent)
setParent
in interface HasCascadingParent
parent
- Parent prompt field, may not be null and must have a FieldValueProviderCopyright © 1999-2020 by i-net software GmbH