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 150272

Summary: Deleted column is shown after refresh
Product: db Reporter: Roman Mostyka <romanmostyka>
Component: Show DataAssignee: Shansi 11 <sivashankari>
Status: VERIFIED FIXED    
Severity: blocker CC: sustaining
Priority: P2    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Bug Depends on:    
Bug Blocks: 152437    
Attachments: Error

Description Roman Mostyka 2008-10-15 18:54:49 UTC
1. Connect to some DB and expand it's node.
2. Rightclick "Tables" node and choose "Create Table".
3. Add table with 2 columns.
4. Rightclick added table and choose "View Data".
5. Rightclick one of the column in database explorer and choose "Delete".
6. Click "Refresh" in data view window.

Result: Deleted column is still shown.
Comment 1 _ ahimanikya 2008-10-17 19:27:50 UTC
I tried the same as per the steps a couple, I am unable to reproduce this.

If you still think this is an issue, please provide exact details: database, table structure etc.
Comment 2 Roman Mostyka 2008-10-21 08:41:35 UTC
I still see this issue.
But now all values disappear and result table becomes clean, but after refresh column should disappear and all values
for the rest of columns should be refreshed.
Note, that I'm talking about "Refresh" button in view data window, not about run statement again. Run statement again
works fine and I don't see any problem with it.
And that isn't the case of DB I guess, since I tried with MySQL and PostgreSQL and results are the same.
I tried with table with 2 columns and INT type for both, but I think again that table structure isn't the case.
Comment 3 _ ahimanikya 2008-10-21 08:48:51 UTC
OK, I am not sure how to fix this. once data view is created the query can't be changed. In this case may be somehow we
should tell user that unable to execute the query and user may have to do an editor level refresh by executing the run
command again.

There is nothing much I can do in the scope of data view. 
Comment 4 Roman Mostyka 2008-10-21 08:59:55 UTC
Probably your suggestion isn't so bad, at least it is better than nothing. But how does "Refresh" work? Can you somehow
run statement again from data view module? Why data can be refreshed, but table structure can't?
Comment 5 _ ahimanikya 2008-10-21 09:16:12 UTC
Data View provides an API which is called by the editor. When you delete the column from the table, there is no way data
view get that information, so we need to an external refresh. 

So once the column the deleted, the dataview showing the result before the deletion is invalid, in other words the query
is invalid hence it should throw exception and that is when we could clear the data and disable all the buttons.

Comment 6 David Vancouvering 2008-10-29 01:00:20 UTC
Sorry, why can't you re-execute the query when the DataView refresh is called?

BTW, I'm working on the Metadata API for the next release, and we should have listeners so you can detect when the
metadata has changed.

Ahi, you and I should talk about the Metadata API...
Comment 7 _ ahimanikya 2008-10-29 05:37:45 UTC
I think we are able to re-execute the query, but the issue is here is something to do with UI event. 

Sure, Lets talk on Metadata API.
Comment 8 Roman Mostyka 2008-11-19 14:09:40 UTC
ahimanikya, can You take a look at this issue? This issue is P2 and is going to be included into NetBeans 6.5 Patch 1.
Please fix it till 27 November (this is code freeze date for Patch 1) or update this issue with justification why the
fix isn't possible till this date.
Thanks.
Comment 9 pgebauer 2008-11-24 09:29:05 UTC
The issue didn't pass the nomination process by nomination cut-off date. It has been marked as 65fixes2-candidate.
Comment 10 Shansi 11 2008-12-04 17:15:14 UTC
Needs Verification
http://hg.netbeans.org/main/rev/29ae81f1adf9
Comment 11 Shansi 11 2008-12-04 17:19:05 UTC
Needs Verification
Comment 12 Roman Mostyka 2008-12-06 22:18:11 UTC
Verified with build 081205.
Comment 13 pgebauer 2008-12-20 02:10:02 UTC
One hunk from the changeset 29ae81f1adf9 has been rejected (see below) during import to the release65_fixes branch. After the manual import of the 
rejected hunk, the re-built IDE reports the error (see the attachment) when I click the Refresh in the step 6. from steps to reproduce ( BTW I'm running 
Sybase SQL ANywhere 11). Besides, once you run "View Data" above a table with the only one column and you add the second column via the Services tab 
after that, the Refresh in the view data window still shows the first column only.

All in all, I don't think that the fix in the current condition can be ported into the branch in High Resistant mode - the release65_fixes. Could you please rethink whether the issue is a good candidate for 65patch2? If so, please provide improved patch.

--- SQLExecutionHelper.java
+++ SQLExecutionHelper.java
@@ -415,11 +415,15 @@ class SQLExecutionHelper {
                     } else {
                         return;
                     }
-                } catch (SQLException sqlEx) {                    
-                    List<Object[]> rows = new ArrayList<Object[]>();
-                    dataView.getDataViewPageContext().setCurrentRows(rows);
-                    NotifyDescriptor nd = new NotifyDescriptor.Message(sqlEx.getMessage());
+                } catch (SQLException sqlEx) {
+                    //List<Object[]> rows = new ArrayList<Object[]>();
+                    //dataView.getDataViewPageContext().setCurrentRows(rows);
+                    String title = NbBundle.getMessage(SQLExecutionHelper.class, "MSG_error");
+                    NotifyDescriptor nd = new NotifyDescriptor.Confirmation(sqlEx.getMessage() + "." + NbBundle.getMessage(SQLExecutionHelper.class, 
"Confirm_Close"), title, NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.QUESTION_MESSAGE);
                     DialogDisplayer.getDefault().notify(nd);
+                    if (nd.getValue().equals(NotifyDescriptor.YES_OPTION)) {
+                        dataView.removeComponents();
+                    }
                     throw sqlEx;
 
                 } finally {

Comment 14 pgebauer 2008-12-20 02:11:54 UTC
Created attachment 75208 [details]
Error
Comment 15 Roman Mostyka 2008-12-22 11:12:05 UTC
Ahi, can you look at this issue again? It will be better to have this fix in Patch 2, since it provides solid work flow
to the user. So if you are able to provide improved patch, it will be very good. But if you can't (for any reason), then
please change status whiteboard to '65fixes3-candidate'.
Thanks.
Comment 16 pgebauer 2009-01-15 10:14:29 UTC
No solution for the release65_fixes branch was provided by 65patch2 code freeze. The issues has been moved to 65patch3.
Comment 17 pgebauer 2009-04-08 13:58:07 UTC
The status whiteboard "65fixes4-candidate" has been removed.
At this time our proactive patches for the NetBeans 6.5.x IDE have concluded.

If you own a Sun service plan contract for NetBeans, you may wish to contact
Sun Service http://www.sun.com/contact/support.jsp to request a fix via the
product defect escalation process.

For more information on purchasing a Sun service plan contract for NetBeans,
refer to the service plan item "Sun Software Service Plans (S3P) for Developers"
in the Sun Service table found on our NetBeans Support Resources
page http://www.netbeans.org/kb/support.html