This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 227588

Summary: Cleanup db.dataview and implement multiple resultsets
Product: db Reporter: matthias42
Component: Show DataAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED FIXED    
Severity: normal Keywords: NETFIX, PATCH_AVAILABLE
Priority: P3    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 73341, 205307    
Attachments: Result of test for scrollable resultsets
Make SQLStatementExecutorTest work reliable (AXION held internal views open, that prevented simpletable from drop)
02 Preclean Celleditors
03 Cleanup TableModels
04 NumberFieldEditor should return Numbers,not strings
05 Fix JXTableRowHeader to react to changes in the table model
06 Enable display of LOB values in read-only tables
07 Use scrollable resultset for efficient queries (replaces SQL mangeling)
08 Move paging handling (display part) completly into DataViewPageContext
09 Fix display of "page" and total row count for the "unknown row count case"
10 Fix spelling of DataViewDBTable#getTable and DataViewDBTable#getTableCount
11 Make SQLStatementGenerator independent of DataVIew
12 Move tblMetaData into DavaViewPageContext
13 Move editable handling completly into the DataViewTableUIModel
14 Correct handling of composite primary keys
15 Handle multiple resultsets from sql
Exception in DataViewTableUI#getCellRenderer
16 Improve handling of EDT in dataview
17 Fix changing width row header

Description matthias42 2013-03-17 22:47:46 UTC
Created attachment 132720 [details]
Result of test for scrollable resultsets

Attached you find a patch series, that

a) cleans up the table models/handling in the db.dataview module
b) make LOB fields accessible when the view is not editable (ex. in joins)
c) switch to use scrollable resultsets if available (simlifies the SQL handling)
d) fix bug in primary key handling (a partial composite key was acceptet as a valid identifier for a table)
e) implements display of multiple resultsets (bug 73341)
f) simplifies the JXTableRowHeadder (bug 205307)

I'll also attach a protocol of my quick check of scrollable resultset support. I had only one fail, so I'm pretty confident, that the JDBC drivers matured enougth to use this feature.
Comment 1 matthias42 2013-03-17 22:49:41 UTC
Created attachment 132721 [details]
Make SQLStatementExecutorTest work reliable (AXION held internal views open, that prevented simpletable from drop)
Comment 2 matthias42 2013-03-17 22:50:05 UTC
Created attachment 132722 [details]
02 Preclean Celleditors
Comment 3 matthias42 2013-03-17 22:50:37 UTC
Created attachment 132723 [details]
03 Cleanup TableModels
Comment 4 matthias42 2013-03-17 22:50:58 UTC
Created attachment 132724 [details]
04 NumberFieldEditor should return Numbers,not strings
Comment 5 matthias42 2013-03-17 22:51:26 UTC
Created attachment 132725 [details]
05 Fix JXTableRowHeader to react to changes in the table model
Comment 6 matthias42 2013-03-17 22:52:46 UTC
Created attachment 132726 [details]
06 Enable display of LOB values in read-only tables
Comment 7 matthias42 2013-03-17 22:53:05 UTC
Created attachment 132727 [details]
07 Use scrollable resultset for efficient queries (replaces SQL mangeling)
Comment 8 matthias42 2013-03-17 22:53:26 UTC
Created attachment 132728 [details]
08 Move paging handling (display part) completly into DataViewPageContext
Comment 9 matthias42 2013-03-17 22:54:03 UTC
Created attachment 132729 [details]
09 Fix display of "page" and total row count for the "unknown row count case"
Comment 10 matthias42 2013-03-17 22:54:35 UTC
Created attachment 132730 [details]
10 Fix spelling of DataViewDBTable#getTable and DataViewDBTable#getTableCount
Comment 11 matthias42 2013-03-17 22:54:55 UTC
Created attachment 132731 [details]
11 Make SQLStatementGenerator independent of DataVIew
Comment 12 matthias42 2013-03-17 22:55:12 UTC
Created attachment 132732 [details]
12 Move tblMetaData into DavaViewPageContext
Comment 13 matthias42 2013-03-17 22:55:48 UTC
Created attachment 132733 [details]
13 Move editable handling completly into the DataViewTableUIModel
Comment 14 matthias42 2013-03-17 22:56:10 UTC
Created attachment 132734 [details]
14 Correct handling of composite primary keys
Comment 15 matthias42 2013-03-17 22:56:28 UTC
Created attachment 132735 [details]
15 Handle multiple resultsets from sql
Comment 16 Jaroslav Havlin 2013-03-19 07:05:03 UTC
Wow, great job! Thank you very much, Matthias.

I've applied the patches locally and I'm testing them now.
If everything goes well, I'll push the changes to repository in a few hours.
Comment 17 Jaroslav Havlin 2013-03-19 10:51:20 UTC
Applied as core-main #8d338de53196, #ddb67b8a29de, #345ea2a50dd6, #ef61f0ef8dce, #eea56a79fe8c, #2544049e1c63, #877efcefc70d, #703dcdbf7e71, #db24ed0f1dd8, #c624d0b53da5, #7116387436bf, #36bcd5a21e11, #dbc6ebe16347, #7357da8c17bf, #5c6fcd257573
Comment 18 Jaroslav Havlin 2013-03-19 11:01:50 UTC
Created attachment 132790 [details]
Exception in DataViewTableUI#getCellRenderer

Exception encountered while setting page size or moving to next/previous page.

I've discovered two small issues:

DataViewTableUI#getCellRenderer should not probably throw any exception when the cell is not in the model.
The "Previous page" button was enabled if the first page was shown.

Fixed in http://hg.netbeans.org/core-main/rev/7fbd44e93df0
Please check it.

Thank you for all the patches, Matthias!
Comment 19 matthias42 2013-03-19 20:41:40 UTC
I think I know the reason for the exception. There are changes done to the DataViewTableUIModel off the EDT - this just cries for problems.

I'll look into it in the next days, but I'm not sure when to get to it. This needs some serious reworks in SQLExcecutionHelper, as calls are wildly scattered.

Most probably wrapping the finally part in SQLExcecutionHelper#loadDataFrom into Mutex.Event#writeAccess would already go a long way (the most brutal update is moved into the EDT by this).

Thanks for the very fast reaction Jaroslav!
Comment 20 Quality Engineering 2013-03-20 02:07:32 UTC
Integrated into 'main-golden', will be available in build *201303192300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/8d338de53196
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #227588: Make SQLStatementExecutorTest work reliable (AXION held internal views open, that prevented simpletable from drop)
Patch from Matthias42
Comment 21 matthias42 2013-03-24 16:15:34 UTC
Created attachment 132995 [details]
16 Improve handling of EDT in dataview

The attached patch should improve the situation. The critical sections are guarded by Mutex.Event#writeAccess - forcing updates into the EDT should eliminate problems while rendering (your exception report).

Please give it a spin.

I'll attach another patch - the row header size changed while edditing the content - the attached patch fixes this by forcing a reasonable size (fitting five digits).
Comment 22 matthias42 2013-03-24 16:17:01 UTC
Created attachment 132996 [details]
17 Fix changing width row header
Comment 23 Jaroslav Havlin 2013-03-25 09:33:23 UTC
(In reply to comment #21)
> Created attachment 132995 [details]
> 16 Improve handling of EDT in dataview
Thank you very much for another huge patch!
Integrated as http://hg.netbeans.org/core-main/rev/9711f16a0085

> I'll attach another patch - the row header size changed while edditing the
> content - the attached patch fixes this by forcing a reasonable size (fitting
> five digits).
Integrated as http://hg.netbeans.org/core-main/rev/4e4efc1ec6af
Thanks again.