* TNTGrid is not capable of displaying a sort arrow in column titles. So, signalize sort direction of columns in grids and listviews by lightgrey (= ascending) and mediumgrey (= descending)
* Remove special color for NULL cells in grids because it can conflict with the new sorting colors. Instead, place a grey (NULL) text in these cells. Less gaudy colors now.
* Also remove grey background in primary key columns for the benefit of sorting colors. PK cells have bold font anyway, should be noticable enough.
- Implement an alternative solution for handling sorted columns without usage of SMDBGrid's sortcolumns. Move relevant structures and functions from data_sorting.pas to childwin.pas and use them in both units.
- Upgrade some code parts to use WideStrings instead of Strings so they don't break with the new grid.
- Use Grid.OnDrawDataCell as an alternative to Grid.OnGetCellParams as the latter one is a feature of SMDBGrid
- Cosmetic: enhance screen real estate in viewdata()
- Introduce helper "MakeFloat" which does exactly the same as MakeInt except from truncating floats
- Use MakeFloat instead of MakeInt in vstCompareNodes to fix the above mentioned bug
* Add helpful (hopefully) delimiter syntax checking.
* Protect the backslash-in-string-literal parsing a bit more by only activating it inside string literals. Also move it towards the string literal handler to improve readability.
* Fix regression: choose characters for secchar and thdchar that are really unused by the parser logic.
* When shortcutting and snipping whitespace early, the start pointer must be adjusted whenever a comment "whitespace" is accounted for.
* When handling end-of-string inside loop, shortcutting via continue must not be performed if at the last character of the string, otherwise an entire sentence might be skipped.
* Processing sentence contents must happen after processing comments (as before the delimiter changes).
* Trying to handle the conditional markers with a state variable inside the end-of-sentence block did not work, sometimes too much sql got included in the conditional.
* parsesql():
- Much added complexity.
- Handle end-of-sql inside loop instead of being a special case outside.
- Only set 'start' after a complete statement has been handled.
* addResults(): Adjustment to allow trimming of enclosed string.
* isNumber(): New helper.
* DELIMITER is not a SQL reserved word interpreted in any way by mysqld.
* ComboBoxQueryDelimiterExit was not attached to ComboBoxQueryDelimiter's exit event.
* Fork out IsValidDelimiter to avoid code duplication.
* Simplify delimiter handling:
- Shortcut on whitespace in start of SQL sentences, trims it off by skipping it.
- Remove start_of_command_pos variable in SQL parser, with the above change 'start' is interchangeable.
- Remove comment stating that a delimiter could be part of the SQL command currently being parsed (it can't).
- Disallow DELIMITER inside conditional comment.
- Remove region without matching end-region (?).
- Disallow DELIMITER DELIMITER, it makes for simpler code.
Plus minor optimizations:
* Fast continue at end of one-line comments.
* Test for most-likely-to-fail conditions first in some of the "if"'s.
* Avoid calling (?) Length() for each invocation of the loop.
- Consistency:
- Move all global preferences vars from mainform to childwin.
- Get rid of unused legacy vars NativeFieldTypes + LanguageOffset
- Readability:
- Add documentation
- Prefix preferences vars with "pref"
- Get rid of WITH .. DO statements
Pros:
- ShowDBProperties doesn't reset column layout
- Sort direction is remembered automatically
- Reading columnlist from registry is done once in a TMDIChild, not on each ShowDBProperties
- Hiding/unhiding columns doesn't call ShowDBProperties
- No more hassling with what is called a "default column" or not. popupDBGrid is usable like in Windows Explorer.
- Column layout is stored global, not per session.
Cons:
- Column layout from old settings logic needed to be discarded
Side effect:
- Fixes a potential AV in FormatNumber(str) with empty strings.
- Created an overloaded FormatByteNumber() which can take a string as input
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.
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
- Dropping non breaking spaces by adding css attribute border-collapse to table.
- Use the same font and background colors as in the datagrids. Even applies for the colored NULL-fields.
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.