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.
The SQL History dialog is time-consuming and awkward. Unless your queries are extremely short, you can't differentiate between them in the limited space in the dialog. If your queries were that short it would be quicker to type them in again, anyway. Also, while I can guess the logic behind it, inserting the chosen SQL at the insertion point instead of replacing any current SQL in the editor doesn't adhere to the principle of least astonishment. Instead, why not do away with the dialog completely and just add arrow buttons on the toolbar to cycle back and forth in your history, much as unix command prompts do? Hitting an arrow would replace whatever is in the editor with the previous/next item in the history as it works with the command prompt. Same problem, same solution. If this weren't the least evil solution to the problem, command prompts would have abandoned it long ago.
I really do think this is a good idea that would improve productivity. This can be added without affecting the current system, so why not let users decide which one they prefer? Also, keyboard shortcuts would be good. :)
The current history options have improved, but it would still be very convenient to have a hotkey which allows you to cycle through you SQL history. Having to take your hand off of the keyboard, click the History button, and look through the dialog to find the command you want to modify or simply run again is more time consuming and breaks concentration. I reiterate that there's a reason (aside from UI format) that command prompts invariably work this way.
Created attachment 149703 [details] patch for db.core v1 The attached patch adds an API to have read-only access to the SQL history (the Set of entries and the entries themselfs are copied on access).
Created attachment 149704 [details] patch for db.sql.editor v1 This is the second part and depends on the changes to db.core from the first patch. This patch introduces a new Action (SQLInplaceHistoryAction), that: 1. Adds a boolean property to the Document that holds the SQL-File org.netbeans.modules.db.sql.editor.ui.actions.SQLInplaceHistoryAction 2. Invokes code completion The SQLCompletionProvider is modified to pick up the new property from the Document. If the property is present and true, a new completion code patch is invoked (and the property reset), that compares the current statement prefix with the history. If a history entry hold the same prefix it is added as a completion item. Selecting an entry replaces the current statement prefix with the selected SQL statement.