Commit Graph

94 Commits

Author SHA1 Message Date
Ansgar Becker
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
Ansgar Becker
b015b87fcb Fix confusion with TYPE/ENGINE in CREATE TABLE statements. On target versions below 4.1.2 we now use "TYPE", "ENGINE" on all other versions.
Was discussed here:
http://www.heidisql.com/forum/viewtopic.php?p=1226#1226
2007-08-13 23:25:20 +00:00
Francisco Ernesto Teixeira
b7cdd2b4cd Foreign Key support on ExportSQL: fixSQL for ANSI SQL compatibility 2007-08-09 17:44:23 +00:00
Francisco Ernesto Teixeira
5d62871cb4 Foreign Key support on ExportSQL, prevents errors on dump import. 2007-08-08 16:31:25 +00:00
Ansgar Becker
edb7fb0da8 Turn the query progress window not to be "always on top". It is already modal as set by the callers so that ensures no internal windows can cover this window.
I see no obvious reason why this status window should cover windows of other applications. And it can be annoying if you have a slow query running and want to work with other applications in the meantime. I asked the original developer for the initial reason for that change, but got no reply yet. Likely I won't get an answer ever.
2007-08-06 20:18:46 +00:00
Ansgar Becker
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
Ansgar Becker
de5d74f295 Use new image index constants in all relevant places. 2007-08-03 17:44:57 +00:00
Ansgar Becker
618d34ec3d Convert ComboboxKeys on the index-editor from a standard TCombobox to a TComboboxEx. Avoids/removes hackish code for drawing icons on items.
Also create some imageindexes constants to const.inc where they will be useful for other units.
2007-08-02 22:26:02 +00:00
Ansgar Becker
d96cf89849 Remove unused form-variable. 2007-08-02 21:29:14 +00:00
Ansgar Becker
74f056b708 Optimize updating indexes: Do the ALTER TABLE query in one go, not in one per changed or new index. So the server only has to rebuild the index file once. Especially changes on big tables with big fulltext indexes benefit from this optimization.
Also ensure the window stays open if any SQL error occurs on applying changes to the indexes, so the user doesn't has to check all changes again in that case, just fix the incorrect option and click OK again.
2007-08-02 21:22:45 +00:00
Ansgar Becker
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
Ansgar Becker
732114b675 Optimize code for enabling/disabling menuitems in Table tab 2007-08-01 21:21:21 +00:00
Ansgar Becker
b7e16074ab Followup / fix for rev 749: Disable menuitem "Rename column" if no item is selected. 2007-08-01 21:16:35 +00:00
Ansgar Becker
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
Ansgar Becker
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
Ansgar Becker
cd8e361c7c Sanitize USE clauses from unused units 2007-07-28 12:05:35 +00:00
Ansgar Becker
6a4a5cc1ad Followup to rev 770: Fix declaration of TButton and TabOrder property automatically added by IDE. 2007-07-28 06:50:48 +00:00
Ansgar Becker
1f33030188 Replace ugly bitmap button by a TButton 2007-07-28 06:36:12 +00:00
Ansgar Becker
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
rosenfield
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
rosenfield
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
rosenfield
17fc590309 Bugfix: If snippets list is active and a new snippet is saved, refresh the list. 2007-07-27 11:47:07 +00:00
rosenfield
5ae56fe00c Code cleanup; use hideExt instead of extra Copy(). 2007-07-27 11:23:24 +00:00
rosenfield
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
rosenfield
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
Ansgar Becker
3174feaf64 Doh.. fix "Clear" item when Filter memo is active. 2007-07-26 07:05:38 +00:00
Ansgar Becker
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
Ansgar Becker
c83bcb5315 Minor: Fix displaying formatted bytes. Use K-units on 1024 factor. 2007-07-26 06:11:48 +00:00
Ansgar Becker
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
Ansgar Becker
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
Ansgar Becker
c10ff3fab6 Try to nuke some memory leaks. 2007-07-23 20:48:10 +00:00
Ansgar Becker
d05a4fedb9 Detect max_allowed_packet also when exporting to a file. 2007-07-23 20:47:26 +00:00
Ansgar Becker
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
rosenfield
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
Ansgar Becker
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
Ansgar Becker
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
Ansgar Becker
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
Ansgar Becker
8573b7401d Fix: Restore previously set mousecursor after using crHourGlass. Fixes staying crHourGlass after renaming a table. 2007-07-14 19:09:20 +00:00
Ansgar Becker
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
Ansgar Becker
0f00d4a3c8 Enhancement: Disable the OK button in the new sorting dialog if there's no change to the old ORDER clause. Disabling that button should be the signal to the user that he didn't make any effective change yet. Helps forgetful people. 2007-07-14 18:51:27 +00:00
Ansgar Becker
490e192ca9 Call help window when pressing F1 in those query helpers tabs for which that makes sense. 2007-07-14 18:31:14 +00:00
Ansgar Becker
d6da05aa13 Add a splitter between query memo and helpers which recalls its position set in the last session. 2007-07-14 18:21:00 +00:00
Ansgar Becker
f49e9f9e41 New Feature. Add SQL snippets to query helpers in a new tab 2007-07-14 18:03:27 +00:00
Ansgar Becker
f39222fea5 Refresh table cache when one or more tables got renamed, created, dropped. 2007-07-14 12:59:25 +00:00
Ansgar Becker
3e566dcf13 Fix selecting the correct database when opening the usermanager and when it's closed. 2007-07-13 05:42:52 +00:00
Ansgar Becker
8e391548d4 Fix restoring column names with spaces from ORDER clause in registry 2007-07-13 05:25:15 +00:00
Ansgar Becker
064ed3b4da Decide to refresh data if the OK button in any of the two dialogs (column_selection, data_sorting) was pressed. Don't call viewdata in the dialogs, but in ChildWin itself. Saves some superflous procedures / code. 2007-07-12 22:44:05 +00:00
Ansgar Becker
cc84963b25 Implement a dialog for easier accessing the options for ordered columns.
This has one positive side effect: ViewData no longer re-saves an ORDERCLAUSE to registry after it has been read. At the same time the ORDERCLAUSE is read everytime when grid is filled, not only the first time. Those changes were needed to be able to apply an ORDERCLAUSE which was generated and saved by the new dialog.

Left for later: Moving order-columns up and down. Tested that with a TUpDown which seems to ignore clicks sometimes and then doesn't fire OnClick.
2007-07-12 22:33:59 +00:00
rosenfield
4d12bd3e42 Send focus back to query editor after a column name has been double clicked into it. 2007-07-12 09:54:59 +00:00
rosenfield
2c0caa154d Bugfix: 'stop on errors when executing sql batch' got broken in revision 667. 2007-07-12 09:47:38 +00:00