Client says the schema and table names might change in production. So, I use callback class to modify the SQL.
In the SQL data objects in the FROM clause are changed; But column names and datatypes in the SELECT clause remain the same.
Modified SQL executes successfully in a SQL client. But it fails in the report.
Partial code of the callback:
DataSourceCollection dsc = bk.getDataSourceCollection();
Source[] src = dsc.get();
int position;
if(dsc.hasDataSetCache())
position=1;
else position = 0;
DataQueryCollection dqc = src[position].getDataQueryCollection();
DataQuery dq[] = dqc.get();
String[] queryNames = dqc.getNames();
DatabaseQuery dbq;
//String sql = null;
for (int i = 0; i< queryNames.length; i++) {
dbq = (DatabaseQuery) dq[i];
//sql = dbq.getQuery();
rptSQL = bindCommonQueryParameters(rptSQL);
rptSQL = processSchemaTableChange(rptSQL);
dbq.setQuery(rptSQL,false);
}
I get Not all Queries Executed Successfully error.
I need some help re the classes I have to use in the callback to change the SQL successfully.
Any help is appreciated.





MultiQuote






