88 Commits

Author SHA1 Message Date
627bd0b51c Bugfix: Switch to database selected in db tree before firing user query. 2007-08-28 23:23:52 +00:00
e77a3ec06d Fix displaying the current database in childwins window caption. 2007-08-28 23:18:25 +00:00
b9d7377b64 Fix firing various queries via GUI or query-editor on the current database after selecting a db which was cached before. 2007-08-28 23:16:23 +00:00
98e2fb7541 Minor fix for sorting columns in list which contain large numbers which exceed Integer (fx "Max_data_length"). 2007-08-28 19:35:06 +00:00
e40df52ead Don't call sorting procedure on right clicking header columns. Some list-headers have a contextmenu which should popup then. 2007-08-28 19:32:01 +00:00
c4f7ada3cb Paint background of sorted columns light grey. Imitates behaviour of the Windows XP Explorer and adds a clear signal to the user that the list is somehow sorted currently. 2007-08-27 20:58:33 +00:00
cc470b33fe Fix previous revision: The compiler complains about declaring properties after functions and procedures. 2007-08-27 18:36:26 +00:00
2977bcb735 Encapsulate detection of data array for a VirtualTree in a new function "GetVTreeDataArray". Should make it easier to read data from these arrays instead of the nodes. 2007-08-27 18:32:08 +00:00
46cad8f9eb The right place to call ValidateControls is in ListTables.OnChange rather than in ListTables.OnClick + popupDbGrid.OnPopup. 2007-08-27 18:10:24 +00:00
ad14e12595 Don't call VT.SortTree manually. Let AutoSort do the work for us. 2007-08-27 17:55:43 +00:00
bc6c65d28b Call VT.Clear before filling it rather than manually calling ReInitNode after filling data. Seems more consistent and less hackish. 2007-08-27 17:51:02 +00:00
3f0b70c409 Switch ListColumns from TSortListView to TVirtualStringTree
Additionally/Sideeffects:
- Fix vstFreeNode to delete the item from the array, not only free the item itself
- Change/Rename GetSelectedNodesFromVT to GetVTCaptions and give it the ability to return all captions, not only the selected. This function is very useful now and saves writing much redundant code.

A table with 500 columns needed 3 seconds to display in the TSortListView, now that takes less than a half second.
2007-08-27 00:01:53 +00:00
f67200157b Fix a focus-issue for rightclicking in ListTables. ValidateControls is called by OnClick, but rightclicking doesn't seem to call OnClick. So, add ValidateControls to popupDbGrid.OnPopup.
Also checking the focused node doesn't say if some nodes are selected. A focused node can even be unselected in the way that its background is not highlighted. So, rather check the selection in ValidateControls.
2007-08-26 06:19:34 +00:00
f814439f03 Nuke an ugly workaround for setting the correct width and height of ListTables and ListColumns after the form has been resized. Somehow this workaround was not functioning as expected any longer with the new VirtualTree on the Database-tab.
Now the lists take all room they can get (alClient), which makes the workaround superflous. However, that made it necessairy to group the toolbars on a TPanel and set the TPanel to alLeft.
2007-08-25 11:53:53 +00:00
9068f08609 Convert ListTables from TSortListview to TVirtualStringTree
Additionally/Side effects:
- TVTreeData structure moved to helpers.pas to be able to use it in new function GetSelectedNodesFromVT.
- ListTablesEditing dropped. We don't need to disable any shortcut there because there is none set.
- Avoid potential AVs when accessing not created items in TVTreeData.Captions
2007-08-25 00:08:31 +00:00
43f6d11cc2 Convert ListProcesses from TSortListView to VirtualTree.
- Don't replace "ListProcessesSelectItem" by "ListProcessesClick". Do the menuitem stuff in popupHost.popup()
- Avoid potential AV when exceeding the captions-list of a node in GetNodeText.
2007-08-21 23:19:51 +00:00
2b8a75b61c Avoid a follow-up AV when seeing unknown data types. 2007-08-21 19:35:14 +00:00
cc1063b8dd Implement RFE #1685787: create table button in popup menu. 2007-08-21 18:28:53 +00:00
6461212dcc Bugfix: Correctly handle when a database is taken away behind the scenes. 2007-08-21 17:57:59 +00:00
80496695c1 Add some safety to the file-commands in popupQueryHelpers:
- Create the snippets folder if it's not present and user clicks on "Explore .."
- If no snippets exist, disable the menuitems "Insert at cursor", "Load" and "Delete"
2007-08-20 21:28:33 +00:00
de4182d69d Add menuitem "Explore folder" to query helpers. Just opens the snippets-folder in your windows explorer. 2007-08-17 23:37:40 +00:00
50b5d31e11 Add menuitems to query helpers, "Snippets" tab:
- "Insert at cursor"
 - "Load"
2007-08-17 23:28:29 +00:00
17cad32f1c Convert ListCommandStats from TSortListView to VirtualTree.
- Make OnInitNode a general procedure by detecting which list was the Sender.
- Add recommended OnFreeNode procedure for all VT's.
2007-08-17 22:25:26 +00:00
3692c53a16 Switch from TListView to TVirtualStringTree (VST) for ListVariables.
This is the first VST and therefore some base procedures are added which can be reused for most other coming VT's:
- vstGetNodeDataSize
- vstGetText
- vstGetImageIndex
- vstHeaderClick
- vstCompareNodes
All these procedures should normally get linked to other VST's. Only the OnInitNode procedure cannot be reused, as it contains references to the data of the VST's nodes.

I hope the billions of options in this VST object make sense.

Left for later:
printlist.pas cannot process this list without changes. I will rewrite that as soon as all 5 lists are switched to VST.
2007-08-14 22:33:17 +00:00
79c7234f67 Make code for setting icon indexes at key-columns more compact and stable: Do the loop over the ListItems *outside* the IFs, not the IFs first and for each IF a redundant loop.
Fixes a bug in applying the iconindex for a column which is part of a fulltext key (was always shown as normal index).
2007-08-03 18:42:11 +00:00
de5d74f295 Use new image index constants in all relevant places. 2007-08-03 17:44:57 +00:00
e12f65b55b Followup / fix for rev 768: Ensure snippet menu doesn't contain a deleted file any longer. 2007-08-01 21:27:39 +00:00
732114b675 Optimize code for enabling/disabling menuitems in Table tab 2007-08-01 21:21:21 +00:00
b7e16074ab Followup / fix for rev 749: Disable menuitem "Rename column" if no item is selected. 2007-08-01 21:16:35 +00:00
fa11cf2fb6 New feature: Allow the user to select and delete multiple fields in listColumns. Just like in listTables where we allow to drop multiple tables. 2007-08-01 20:43:48 +00:00
a03d3cd2a7 GUI optimization: Avoid call to ShowTableProperties after dropping a field by using an "on exception skip code" logic. The exception ensures that the listItem of the dropped field is not deleted if any error occurs. Also makes sure the next available field is focused after successful dropping. 2007-08-01 18:52:43 +00:00
cd8e361c7c Sanitize USE clauses from unused units 2007-07-28 12:05:35 +00:00
c94cde0682 Add a popupmenu to queryhelpers which contains 2 items with shortcuts:
+ Delete [Del] (Deletes a snippetfile)
  + Help [F1] (Calls SQL help for selected keyword or function)
2007-07-27 22:36:19 +00:00
2866e00f59 Change defaults for HandleErrors and DisplayErrors to FALSE. The other way around causes way too many bugs. 2007-07-27 14:46:38 +00:00
f18cf13097 Bugfix: EnsureActiveDatabase() is a helper function, it shouldn't gobble up exceptions.
(There we go with that default "HandleErrors = true" thing again...)
2007-07-27 14:36:16 +00:00
17fc590309 Bugfix: If snippets list is active and a new snippet is saved, refresh the list. 2007-07-27 11:47:07 +00:00
5ae56fe00c Code cleanup; use hideExt instead of extra Copy(). 2007-07-27 11:23:24 +00:00
37a5951835 * Add version of GetFilesFromDir() that hides file extensions.
* Change SQL snippet menus and lists to hide the .sql extension.
2007-07-27 11:10:20 +00:00
7807465aa6 Bugfix: Problem in logical construct; tab was always switched when not in drag mode, which was obviously not the intention.
Bugfix: Hiding tabs causes the active tab to switch implicitly.  Move code that depends on the active tab to happen before tabs are hidden.
Change: Don't switch away from query tab when switching tables etc.
2007-07-27 10:51:54 +00:00
3174feaf64 Doh.. fix "Clear" item when Filter memo is active. 2007-07-26 07:05:38 +00:00
8d896f732d Followup to rev 756:
* Hide new menuitems when SynMemoFilter is focused.
* Call SynMemoQuery.OnChange in popupQuery.Popup to ensure various menuitems are dis-/enabled
* Disable "Clear" item when memo is empty
2007-07-26 06:45:45 +00:00
5cecd6a91e Minor: Change format of "123,456,789 Characters" above querymemo to a better readable "123,4 MB" 2007-07-26 06:07:01 +00:00
021d56e0bc Clean up and enhance popupQuery menu:
* Bring items in a better, usable order
* Nuke dependency of hardcoded itemcount in code for SQL functions: "popupQuery.Items[i+13].Add(mi);"
* Add useful actions:
  + Insert file at cursor
  + Save selection to file
  + Save as snippet
  + Save selection as snippet
* Assign procedures for menuLoad + menuSave at designtime, not at runtime (which made sense in a MDI mechanism)
* Minor optimization of detecting selected text in SynMemo
2007-07-25 21:18:20 +00:00
6d8f8e1299 Implement a dialog/mechanism to run a SQL file directly without loading it into the query editor (= memory):
1. When user opens a file which is bigger than LOAD_SIZE (currently 5M), ask what to do
2. User can normally open the file, cancel, or use the new mechanism:
3. Load a chunk of LOAD_SIZE of SQL into memory
4. Split chunk with parseSQL into single queries
5. Run queries and go on with 3.

parseSQL is the bottleneck here, very CPU consuming, as it has to take care of different comment-styles and delimiters. So, the above strategy effected a good compromise regarding overall performance on different tests with worst case SQL files:
- "Wide" table exports with many big sized fields => long lines
- "Narrow" table exports with only one mini-sized field, extended INSERTs => short lines
Especially in the latter case it avoids to cause a hellfire of parseSQL-calls

Still seems to have some memory leaks somewhere.
2007-07-23 20:25:29 +00:00
561b057d5c Bugfix: Fix a (silenced) double reset of running flag caused by redundant CheckConnection calls, which in turn caused reconnect logic to break wrt manually fired queries.
Bugfix: FetchActiveDb...() is a helper function, do not try to handle exceptions as it leads to AVs.
Bugfix: ShowTableProperties() is a helper function, do not try to handle exceptions as it leads to AVs.
Bugfix: AV in ShowProcessList when disconnected.
Bugfix: AV in ShowVariablesAndProcesses when disconnected.  (Something tells me it could be better to let the default for HandleErrors be 'false', a lot of these seems to pop up during testing...)
Bugfix: Connected time counter did not stop when connection got dropped.
Bugfix: Uptime counter did not stop when connection got dropped.
viewdata(): Use standard method of fetching data to get rid of redundant code.
...BeforeSendingSql(): Remove now redundant code.
2007-07-23 15:03:34 +00:00
8e10529741 New feature: Enable column renaming from within listColumns.
Side-effect: Needed to change some editor-related shortcuts so they don't trigger their corresponding menu-commands from popupTableGrid when the user presses them at the time the column name gets edited:
- Call field editor : Now "Alt+Enter", was "Enter"
- Drop field : Now "Ctrl+Del", was "Del"
2007-07-15 06:45:47 +00:00
457db77cc8 Simplify code: Use one try-except block instead of two for procedures which can throw exceptions. 2007-07-14 20:46:57 +00:00
c711a29254 Remove superflous code which has no longer any visible effect since revision 745. Selected table item keeps focus because ShowDBProperties is not called any longer. 2007-07-14 19:14:58 +00:00
8573b7401d Fix: Restore previously set mousecursor after using crHourGlass. Fixes staying crHourGlass after renaming a table. 2007-07-14 19:09:20 +00:00
2f3bcd9e38 Enhancement: Only refresh table cache after renaming, don't refresh the listview. In any error case don't rename the list-item. 2007-07-14 19:03:59 +00:00