|Problems implementing an External Result Set Viewer [message #592924]
||Thu, 28 August 2008 17:22
| Charles Eutsler
Registered: July 2009
I am investigating how to create an External Result Set Viewer that will |
let us add such capabilities as computing the sum of the values of columns
and to display LOBs. In my investigation so far I have come up with
concerns and questions and I'm not sure who to ask about them.
Any assistance or pointers to people who can help me out would be
The following was done with DTP 1.6.0/Eclipse 3.4.0.
When I add the extension point
org.eclipse.datatools.sqltools.result.resultSetViewer to my plug-in and
right-click on its name in the Extensions tab, the context menu does not
include a New|externalViewer menu item. (If I show the extension point's
schema, the DTD Approximation for the "extension" node is "EMPTY".) So I
can't add the "externalViewer" through the Extensions tab. This is
because the resultSetViewer.exsd schema has defined the "externalViewer"
element but has not specified that the element "extension" contains an
instance of that element.
If I edit the plugin.xml by hand and add the externalViewer element to the
resultSetViewer extension element specifying the vendor, class and id
attributes, I am able to define a new Result Set Viewer. It appears in
Preferences under Data Managment's Result Set Viewer Options.
Question 1: Since the resultSetViewer extension point's schema doesn't
specify that "extension" contains an "externalViewer" child element, am I
jumping the gun trying to create my own result set viewer? Is this
feature ready for prime time?
Question 2: I select my Result Set Viewer's name from the list. That
result set viewer is used. When I restart the application (I am currently
doing this in an RCP), the choice goes back to "Default Result Set
Viewer". I expected my choice to be persistent. Is this a bug?
Once I got my External Result Set Viewer to be used, I tried to retrieve
the values of CLOBs from the results of a query. The locators of the
CLOBs were not valid at the time the result set viewer provider's
configureViewer method is called. This method seems to be the earliest
point I have the opportunity to retrieve the CLOBs' values.
Question 3: Is there an earlier opportunity for an external result set
viewer to retrieve LOB values that are in the results of a query?
The problem with LOBs is that their locators are not valid once the
ResultSet is closed. The
org.eclipse.datatools.sqltools.result.ResultSetObject class processes the
ResultSets returned by running a SQL statement. It simply calls the
ResultSet.getObject method to get the values for all the columns in the
result. When the column value is a LOB, the CLOB or BLOB is stored in the
ResultSetObject. Retrieving the actual value of the LOB at that point is
not done nor is there a hook to allow us to retrieve them at that point
(at least I don't see such a hook).
is processing all of the results of the Statement. Along the way there
are calls to Statement.getMoreResults() that close the just-processed
ResultSet. At that point the LOBs' locators are no longer usable so the
LOBs' values can no longer be retrieved.
We have extended SimpleSQLResultRunnable but I don't see anything in the
loopThroughResults method that lets our class process the LOBs before the
ResultSets are closed. We surely don't want to reimplement the
loopThroughResults method in order to do that processing. We would prefer
to have it call another method while the ResultSets are still open that
lets us deal with LOBs.
Question 4: Can SimpleSQLResultRunnable.loopThroughResults be modified to
give extenders the opportunity to add to the processing of the results
before the ResultSet is closed? Or is that opportunity available that I
The ResultSupportRunnable.run method is calling Statement.setMaxFieldSize
with the arguement 16384.
Question 5: Why is the size of fields limited with a hard-coded value?
Shouldn't that be a preference that the users can set?
Well, that's a lot to have in one message (and it's all that I've come up
with in my afternoon of trying to see what's involved in creating our own
result set viewer.)
Powered by FUDForum
. Page generated in 0.04084 seconds