4 Replies Latest reply on May 15, 2013 8:37 AM by Amit Jahagirdar

    How to access ResultSetMetadata in the delegate translator?

    Amit Jahagirdar Newbie

      Hi Ramesh and Team,


      I am using Teiid 8.3 Final, and implementing a delegate translator by extending the BaseDelegatingExecutionFactory.

      Also there a class in my code which implements the ResultSetExecution,and I override the execute() and the next() method.

      Control Flow is like this : MyDelegateQueryExecution delgates/intercepts calls to (JDBCQueryExecution or MyQueryExecution ) depending on the translator used underneath .


      Now I need to do some changes to the values in the resultset, in the next() method,before its returned from the next() of delegating translator.

      The next method returns a List<?> , in my case objects(which have values from the resultset)...But I see no api from where I can get the resultset or its metadata to map the values to the column names.

      The resultset or the ResultSetMetadata is inaccessible beacuse the JDBCQueryExecution has resultset as protected and has no public api.


      1) Is there a way to get ResultSetMetadata  in the delegating translator?


      2) Can we have an api published in the ResultSetExecution like getResultsetMetadata which each translator's QueryExecution class would implement?

           I suppose that would be an enhancement to be made on the Teiid side and published out as a patch in Teiid8.3.


      Other than 1 and 2

      the "time being" approach that I plan to do this mapping is to:

      a) get the projectedquery from the command.

      b) Get the column name if its only one (Say Select Name from Employee) or list of columns from RuntimeMetadata in case(Select * from Employees) and map the columnName to Value list returned by the next() method of the actual translator class (Say JDBCQueryExecution).