public class JoSQLJRDataSource extends Query
Query
that allows the
results to be iterated over, thereby providing the ability for objects to be reported on
that are held in memory.
One limitation here is that the SQL query must return columns rather than the objects since the values need to be mapped by JasperReports. For example:
SELECT lastModified, name FROM java.io.File WHERE name LIKE '%.html'
This query would work but it should be noted that the select "columns" (since they do not have aliases assigned) will be labeled 1, 2, X and so on. You can assign aliases to the "columns" and then use them in the report definition file.
Please note: due to my bewilderment (and the fact that I can't get the examples to work ;) I haven't been able to adequately test this implementation, in the rudementary tests I performed it seemed to work. If it doesn't please send me an example so that I can try it!
ALL, ALL_OBJS_VAR_NAME, CURR_OBJ_VAR_NAME, GROUP_BY_RESULTS, GRPBY_OBJ_VAR_NAME, GRPBY_OBJ_VAR_NAME_SYNONYM, HAVING_RESULTS, INT_BIND_VAR_PREFIX, nullQueryList, ORDER_BY_ASC, ORDER_BY_DESC, PARENT_BIND_VAR_NAME, QUERY_BIND_VAR_NAME, RESULTS, WHERE_RESULTS
Constructor and Description |
---|
JoSQLJRDataSource() |
Modifier and Type | Method and Description |
---|---|
void |
clearResults() |
QueryResults |
executeQuery(List l)
Exectute the query and return the results.
|
Object |
getFieldValue(JRField field) |
List |
getResults() |
void |
moveFirst() |
boolean |
next() |
addBindVariableChangedListener, addFunctionHandler, addSaveValueChangedListener, addTiming, doExecuteOn, execute, execute, execute, fireBindVariableChangedEvent, fireSaveValueChangedEvent, getAliases, getAllObjects, getAnonymousBindVariableName, getClassLoader, getColumns, getCurrentObject, getDefaultFunctionHandlers, getExecuteOnFunctions, getFrom, getFromObjectClass, getFunctionHandler, getFunctionHandlers, getGroupByColumns, getGroupBySaveValue, getGroupBySaveValues, getGroupByVariable, getHavingClause, getLimit, getObjectComparator, getOrderByColumns, getOrderByComparator, getParent, getQuery, getQueryResults, getSaveValue, getTopLevelQuery, getVariable, getVariable, getVariableClass, getVariables, getWhereClause, getWildcardCharacter, init, initOrderByComparator, isWantObjects, isWhereTrue, loadClass, parse, parseAndExec, parsed, removeBindVariableChangedListener, removeSaveValueChangedListener, reorder, reorder, setAllObjects, setClassLoader, setClassName, setColumns, setCurrentGroupByObjects, setCurrentObject, setExecuteOnFunctions, setFrom, setFromObjectClass, setGroupByColumns, setGroupByLimit, setGroupByOrderColumns, setHaving, setLimit, setObjectComparator, setOrderByColumns, setParent, setSaveValue, setSaveValues, setVariable, setVariable, setVariables, setWantDistinctResults, setWantObjects, setWantTimings, setWhere, setWildcardCharacter, toString
public QueryResults executeQuery(List l) throws QueryExecutionException
clearResults()
to free up the references to the results.l
- The List of objects to execute the query on.QueryExecutionException
- If the query cannot be executed, or if the query
is set to return objects rather than "columns".public List getResults()
public void clearResults()
public Object getFieldValue(JRField field)
public boolean next()
public void moveFirst()