From: Colin Bell <Colin.B<ell@as...> - 2001-11-19 01:33:30
Brad, I've managed to lose your email about this so let me know the bits
I apologize for the way this email has rambled all over the place but I'm
trying to think this through as I'm writing it. Also bear in mind that I've
never used an updateable ResultSet in JDBC so I could easily miss something
Currently the SQL output for both the Content tab and the SQL execution
output is built using
net.sourceforge.squirrel_sql.fw.datasetviewer.DataSetViewer. The simplest
description of this class is that it will take a "row based or line based
input" such as a result set and convert it to "row based output" such as a
The input must implement IDataSet and the output implement
ResultSetDataSet is an implementation of IDataSet that displays a
java.sql.ResultSet, and DataSetViewerTablePanel is an implementation of
DataSetViewer that displays data in a JTable.
Currently the opening/closing of the ResultSet is done outside of these
There would be nothing stopping you from subclassing DataSetViewerTablePanel
to add data editing functionality and using it something like:
DataSetViewer viewer = new DataSetViewer(new
As long as you didn't close myResultSet and it is updateable then from
within MySubClassOfDataSetViewerTablePanel you could do what you like with
it. The current code would just display the result as it currently does.
The next question is how do we hook this into Squirrel?
The easiest way would be clicking on a button brings up a modal dialog with
the updateable table within it but I hate modal dialogs and I think this
would eb very irritating for users of the product.
Another idea would be a menu item or a button that reexecutes the current
SQL script and displays an editable table in place of the current
non-editable table or another tab with an "edit" title. I think I prefer the
replacing the table rather than another tab. Another tab would work for the
content tab but I think it would get very confusing for the SQL entry area.
Frankly I don't like either idea, the first is plain bad and the second
sounds messy. Anybody got any better ideas?
I'm not too keen on just replacing the current table outut with an editable
version of DataSetViewerTablePanel as the user currently has the option to
change the type of output viewer through the session options output tab.
Currently both table and text output is supported and I envision in the
future extending this to other types of output such as HTML by creating new
classes that implement IDataSetViewerDestination.
Something else to bear in mind is that not all JDCB drivers support
updateable result sets and it would be nice to be able to maintain data
through them as well, possibly by generating update scripts manually.
These are just my first thoughts on the subject. Comments, ideas, flames?