Jump to content

BIRT Developer Center
Download


Photo
- - - - -

Callback class for SQL modification (table names in FROM clause changed)


  • Please log in to reply
2 replies to this topic

#1 John Berchmans

John Berchmans

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 06 February 2012 - 08:45 PM

I am developing a report getting data from Teradata.
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.

#2 Birtnewbe

Birtnewbe

    Member

  • Members
  • PipPip
  • 23 posts

Posted 28 March 2012 - 05:24 PM

any inputs on this?

#3 cbrell

cbrell

    Member

  • Members
  • 571 posts

Posted 29 March 2012 - 12:37 AM

Can you provide more information like the stack trace?
Without Stack trace is it just finding a needle inside of a haystack
Interested to join BIRT User Group Mannheim (Germany)?
Have a look at: http://www.xing.com/...-group-mannheim or write me an email