42 Commits

Author SHA1 Message Date
23c13d2531 Cleanup usage of background colors in grids and listviews:
* 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.
2007-12-01 22:37:21 +00:00
f6d4e637e3 Replace TSMDBGrid in Data + Query tabs by TTntDBGrid.
- 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()
2007-11-26 20:58:08 +00:00
cbc37695de Minor: Add/update documentation for MakeFloat 2007-10-23 19:00:54 +00:00
a4406b229f Fix a sorting bug in vstCompareNodes: Floats were always truncated to integers, then compared. So, sorting 0,1 and 0,2 placed these values somewhere between the 0 values.
- 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
2007-10-21 18:48:23 +00:00
17f9730b76 Fix bugs
#1814411 "Incorrect SQL when changing structure on a field"
#1814293 "Incorrect SQL when changing structure on a FLOAT field"
2007-10-16 19:34:25 +00:00
4286244eda Add meaningful messages to the SQL log when a delimiter is selected or declined. 2007-10-06 00:08:19 +00:00
db55bbcbe3 Code optimization: avoid a Length() call and a comparison in scanReverse(). 2007-10-05 23:08:19 +00:00
4c4c1aabfe Add an extra guard. 2007-10-05 22:26:55 +00:00
e3fb1070d9 Code optimization: remove a superfluous bit compare.
(Guess I'll be the one buying beer ;-).)
2007-10-05 22:11:09 +00:00
213d145f3a * Add code comments.
* 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.
2007-10-05 20:17:11 +00:00
a3e18dc1dc Bugfix: one occasion assumed a delimiter length of 1, leading to superfluous character in resulting sql sentence. 2007-10-05 19:16:40 +00:00
d33be19be0 Nuke ExpectResultSet. Opted not to disable the mysql driver exceptions in zeos, instead used Anse's TZConnection.GetAffectedRowsFromLastPost().
(Messing with the internals here, please test...)
2007-10-05 18:52:38 +00:00
d616f1bdce Fix various regressions:
* 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.
2007-10-05 12:49:59 +00:00
f0db5d8497 Fix queries like /*!40000 SHOW ENGINES */ to be recognized as "result"-queries while not breaking getFirstWord calls in situations where the second or later char can be a number (fx the collation in createdatabase). 2007-10-04 20:31:31 +00:00
f88e1ff4d6 Implement todo: support for multiple statements inside conditional comments.
* 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.
2007-10-04 17:19:30 +00:00
ed54bb2be6 Changes based on delimiter review:
* 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.
2007-10-04 17:07:27 +00:00
93eb8003c3 SQL Process: DELIMITER optimization (minor fix) 2007-10-02 12:33:47 +00:00
d315e45885 Nuke various never called procedures and functions. Just readd them if you want to use them somewhere, especially the helpers-functions. 2007-09-26 23:13:18 +00:00
ee1fb08158 SQL Process: handling of DELIMITER to mimic mysql CLI (minor fix) 2007-09-25 02:13:03 +00:00
a8809f4975 SQL Process: handling of DELIMITER to mimic mysql CLI 2007-09-25 02:05:38 +00:00
6ae3e42bcd Fix bug in GetFirstWord: Last character was cut if length of input textlength matched the word length. 2007-09-23 22:38:08 +00:00
6adaf3bd6a Bugfix: Range error in getEnumValues() for any string without '(' in it, eg popping up the field editor for a 'datetime' field. 2007-09-17 21:08:49 +00:00
b056d43e4b Fix a range error and various other bugs in vstFreeNode(). 2007-09-11 20:40:41 +00:00
c8979cd114 Bugfix: A "for Cardinal(i) := 0 to -1" loop in Delphi will run for 2^32 iterations rather than 0 iterations - when a list given to AddUniqueItemsToList() is empty, avoid starting this for loop and thereby avoid a range error when clicking the '+' sign next to an empty database. 2007-09-11 09:27:17 +00:00
6d72ead5dd Refactor logic in preferences dialog:
- 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
2007-09-03 15:44:18 +00:00
895e69269f Fix AV on comparing mixed column content in VirtualTrees (strings compared to integers) 2007-09-02 13:46:07 +00:00
bab0a38fe4 MakeInt(): Correctly backconvert strings which were previously formatted by FormatByteNumber() . Fixes incorrect sorting of columns in VirtualTrees which contain some byte values. Also enables us to call FormatToByteNumber() in "Size" column of ListTables. 2007-09-02 10:05:09 +00:00
40c41d3cbe Add support for TeraByte and PetaByte in FormatByteNumber.
Overcomes a "E2099 Overflow in conversion or arithmetic operation" compiler error by using constants instead of calculating the limits.
2007-08-31 00:03:55 +00:00
8ab0b95440 Implement a more effective solution for hiding and unhiding columns in ListColumns.
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
2007-08-30 23:49:38 +00:00
bf401df253 * Implement Pos2, which takes a start parameter.
* Mask USING {BTREE,HASH,RTREE} from older servers. I wonder why mysqld doesn't do this by itself. Fixes issue #1779065.
2007-08-29 00:49:40 +00:00
5d718e5152 Iterate through data arrays of VirtualTrees rather than through the nodes to get their captions. Fixes sorting in ColumnSelection-dialog and other places where GetVTCaptions is called to get all captions (not the selection). 2007-08-27 18:46:21 +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
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
b54a122fe6 Fix bug #1757524 "Exporting rather slow when processing large BLOBs" by making use of mysql_real_escape_string() . 2007-08-21 16:47:28 +00:00
e78c25f25b Fix bug #1776163 "Blank/Space in HTML-export"
- 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.
2007-08-18 00:17:08 +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
c83bcb5315 Minor: Fix displaying formatted bytes. Use K-units on 1024 factor. 2007-07-26 06:11:48 +00:00
c10ff3fab6 Try to nuke some memory leaks. 2007-07-23 20:48:10 +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
86f01b4675 Attach server version to SQL functions and use that to hide unsupported functions in query helpers, popupQuery and SynCompletionProposal. 2007-07-06 22:07:05 +00:00
aeb7be0a37 * Fix hint for SQL functions menuitems which have pipes in declarations (fx TRIM).
* Fix splitting of function descriptions by implementing + using LastPos()
2007-07-02 19:08:59 +00:00
3c8f123a81 Move *.pas, *.dfm and *.inc files from root directory to a new "source" subdirectory. Leaving just the readme in the root to give all newbies a very clear and unique starting point. 2007-06-28 20:00:04 +00:00