101 Commits

Author SHA1 Message Date
d3711b5d62 Work around empty members of PMYSQL_FIELD on servers below 4.1 - org_name and db are empty on such servers, but Heidi needs both to compose safe and valid INSERT/UPDATE/DELETE queries. In order to at least allow grid editing, do some unsafe stuff for old servers: Never take db name into posted queries, neither use original fieldnames (instead, use the normal name). Should be ok as this is just to satisfy 2% of all Heidi users. Fixes issue #1934.
See also: http://dev.mysql.com/doc/refman/4.1/en/c-api-datatypes.html
2010-05-11 22:04:24 +00:00
133de5850a Remove unused member 2010-05-10 23:35:09 +00:00
1368508685 Do not display grid cells as modified if new value is effectively the same as the old one. Especially minimizes INSERTs for "Duplicate row" feature. 2010-05-10 23:34:36 +00:00
6355102eb0 In editing mode, when cursor points to a virtual edited row, we need to call mysql_data_seek() in SetRecNo, even if FRecNo points the previous row. Do that by checking for nil. Fixes issue #1931. Fixes issue #1919. 2010-05-10 23:26:47 +00:00
1319abe2c0 Number magic:
* Rewrite UnformatNumber() so it throws away characters other than digits, thousand or decimal separator. This is critical for adding WHERE clauses, where it was previously possible to update a whole table column accidentally: "UPDATE mytable SET numcol=123# WHERE id=567"
* Do not fetch last insert id when user passed a number to it. In that case LAST_INSERT_ID() would return 0
2010-05-10 22:04:21 +00:00
1838a0eaa7 Use original name of a foreign key in DROP FOREIGN KEY query when renaming. Fixes issue #1930. 2010-05-10 18:51:10 +00:00
e258f7ccec mysql_free_result() frees memory but does not set pointer to nil. Do that by hand, so later checks for nil don't run into AVs. Probably fixes issue #1901. 2010-05-08 17:49:47 +00:00
ae4b7faacd Binary column type detection is still a mess. But now TMySQLQuery parses its column names from a SHOW CREATE TABLE grid editing can benefit from the parsed stuff. Effect: data type of LEFT(bincol, 256) in data grid is re-detected when going into editing mode. Still displays these as green text before editing is tried, which could probably be solved by immediately call PrepareEditing for DataGrid result. 2010-05-08 15:53:37 +00:00
634f5cb951 Ensure column correct lengths are set in SetRecNo. Fixes issue #1921. 2010-05-08 13:50:32 +00:00
db5c5a1dc3 Ensure FCurrentResults is set, also in the special case when result has 0 rows, to avoid AVs in DatabaseName() and TableName(). Fixes issue #1917. 2010-05-08 10:37:34 +00:00
ede2fab6f1 SaveModifications() should process all virtual rows, but ignore just inserted ones, so we can call InsertRow and then SaveModifications for yet modified rows. Fixes issue #1918. 2010-05-08 08:14:35 +00:00
646006715b Avoid access violation in EnsureFullRow when row cannot be found. Just return false in that case and block editing. Fixes issue #1910. 2010-05-07 15:43:08 +00:00
7ce555ff1a Straighten sort logic in lists and db tree:
* Let both header clicks and TDBObjectComparer consistently use the same compare callback function CompareAnyNode()
* When refreshing a list, VT.SortTree sorts nodes if toAutoSort is set. Then, selected nodes are mostly different ones than before refreshing. Also, what GetVTCaptions did was only looking after the first column caption which can exist besides duplicates. So, for now, do not restore selected nodes after refreshing a list, which is now more standard behavior.
Fixes issue #1911.
2010-05-06 22:46:35 +00:00
dc62492a34 Avoid exceeding range of FColumns within ColAttributes(). Fixes issue #1908. 2010-05-06 18:17:41 +00:00
05b07eb8f2 Implement editing capabilities into TMySQLQuery, and make query results editable by using all the same events as in DataGrid. Most probably some bugs to fix now.
* Fixes issue #723
* Fixes issue #873
2010-05-05 21:39:15 +00:00
b3b1710c35 Introduce EDatabaseError exception class, so we're able to handle only those and let others raise the exception up to MadExcept. Helps finding non-database related AVs as users are able to get the callstack now. Similar to r3292 but more consistent all over the code now. 2010-04-24 13:56:57 +00:00
49dce8e08b Overcome MySQL bug #41907 - SHOW EVENTS shows events in other schema. 2010-04-22 16:24:28 +00:00
97f01a175b Move database filter again from mainform to session manager, so people without privilege to run SHOW DATABASE are not stuck. Fixes issue #1485. Also, allow to see available databases when user does a dropdown. Also, simplify logic for refreshing database list in mainform. 2010-04-22 15:16:27 +00:00
71ae99d225 Do not trigger OnDBObjectsCleared in TMySQLConnection.Destroy, to avoid loop backs to connection instance which triggers AVs. Fixes issue #1878. 2010-04-19 22:20:04 +00:00
43e35c8192 Throw successive result sets from stored procedures away, until we have real support for multi results. Otherwise mysql_ping() crashes on the next query. Fixes issue #1850. 2010-04-12 21:03:13 +00:00
aef5f3b147 Modify Mainform.SelectedTable so that it always returns a new TDBObject, instead of passing an item of the connection's internal cache. Makes sure that the object editors (table editor e.g.) still has a valid object reference. See also http://www.heidisql.com/forum.php?t=5511#p5514 2010-04-11 13:36:42 +00:00
f451d061eb Introduce 2 new columns in Host > Databases: "Last modification" and "Events". Plus:
* enhance db object lists for storing additional details like last modification and data size
* remove home brown Min() and Max() functions and use those from Math unit which are not restricted to Integers.
2010-04-11 12:03:07 +00:00
728d38b14b Issue #401: Close plink.exe also on connection errors. 2010-04-10 09:54:18 +00:00
5f9129bef2 Implement event editor for MySQL 5.1+ servers. Also, simplify some code around database objects and their editors. Fixes issue #1527 2010-04-08 23:16:40 +00:00
ea8574bc1a Fix some AVs around ListTables by reintroducing recently deleted connection event OnDBObjectsCleared. Required in cases where cache is cleared or refreshed (!) elsewhere and ListTables get repainted later. 2010-04-04 23:30:37 +00:00
f014190c9c Do not clear cache with db objects in a reconnect situation. Heals several AVs where we rely on some valid TDBObject, also when server stays unreachable. Fixes issue #1819. Also, this makes it superfluous to have an event fired after clearing the cache. 2010-04-03 21:30:11 +00:00
3c9dcfaaa0 Last tweaks for SSH tunnel, issue #401:
* Only pass SSH port if not empty
* Put right default file extension for selecting a PuTTY private key file (*.ppk)
* Add text hints on more input fields
* Indicate modified session also if SSH host, port or key file was changed.
2010-04-02 07:33:36 +00:00
adf68ecc65 Issue #401: Extend SSH tunnel options: Allow user to set SHH host/ip and port, and a private key file used for authentication. If SSH host is not set, use what the user specified as MySQL server host. 2010-04-01 23:34:07 +00:00
899040655c Add sub tab "Databases" with a more detailed list than the tree has. Also, paint bars for size and number of items in it. Implement TMySQLConnection.GetDBSize() which caches the size of dbs, synchronized with DBobjectlists. 2010-03-31 19:13:22 +00:00
0ec02d6fa3 Issue #401: Hide console window by passing CREATE_NO_WINDOW to CreateProcess(). 2010-03-31 10:36:46 +00:00
0970f5c2bd Implement SSH tunnel with plink.exe on session manager. Fixes issue #401 Plus:
* Simplify code for getting connection parameters from registry by implementing helpers:LoadConnectionParams()
* Use combobox for network type instead of radio buttons, now that 3 options would need more horizontal space than we have
* Hide tabs on session manager which are irrelevant for the selected network type (e.g. no SSL options for named pipe)
* Some minor code simplifications
2010-03-30 23:22:08 +00:00
aa9525e527 Unify default sorting of database objects in tree and lists. Fixes issue #1799. 2010-03-25 21:03:37 +00:00
03cc9d632a Attempt to fix issue #1780 - AV on closing main window. Free the cached list of db object lists, instead of making it empty, so a call to Assigned() returns false. 2010-03-20 00:18:17 +00:00
4147bbcfbc r3150 didn't fix all exceptions thrown by ListTables.OnGetText when nodes are bound to already freed TDBObjects. Do it right now - introduce a new event TMySQLConnection.OnAfterClearDBObjects for this purpose. Todo: Fix related issue #1723. 2010-03-12 22:23:09 +00:00
65d0b59eba Minor: Reset highlighter's list of table names when selecting a new db and not having fetched its objects. 2010-03-07 17:37:27 +00:00
cc0b931551 Internal refactoring: Directly bind TDBObject's to nodes in ListTables, instead of copying everything to an internal array structure first. Most events on ListTables have their own procedures now. Also, when selecting a database in the tree without expanding it and a query tab is selected, do not fetch objects. Could annoy some SQL writers which won't see the objects in selected db highlighted in that case. On the other hand this avoids loading objects in situations where you don't need them. For larger databases this should be really helpful, e.g. for the reporter of issue #1742. 2010-03-07 09:46:49 +00:00
15d698dfdb Do not truncate contents of column contents if it contains NUL chars. Fixes issue #1731. 2010-02-27 15:10:43 +00:00
4e84c99a72 Introduce SSL support on session manager. Code parts from SuperNiFF. Fixes issue #518. 2010-02-26 00:13:17 +00:00
f9ea5dc1ec Add support for startup SQL script on session manager. Fixes issue #1716. 2010-02-25 20:45:16 +00:00
95e12a0bd1 Introduce new log category lcUserFiredSQL, and make log level customizable via preferences. Fixes issue #1652. 2010-02-04 00:39:29 +00:00
efbf7a0b98 Add a toolbar button which, when pressed, allows BLOBs to be displayed as text. Explicitly ignoring weird effects in grid updates/inserts. Fixes issue #1624. 2010-01-30 07:57:07 +00:00
9f139029b7 Enhance command line processing:
* Rewrite parameter parser
* Remove support for "-C" option (compressed). Anyway switched on by default.
* Add support for loading multiple SQL files at once instead of only one: "fileA.sql fileB.sql ..."
* Also process connection parameters when "Allow multiple application instances" is disabled
* If a session name is specified with -dXYZ, load params from registry, but allow the user to override these by passing e.g. a different user name "-uOtherUser"
Fixes issue #1332.
2010-01-27 23:39:34 +00:00
b0ccbaadbd Minor code simplification 2010-01-24 15:15:46 +00:00
798cc36b99 Remove TMySQLConnection.Capabilities , which should have brought some light into the feature set of the server. Still doing that per version comparison which is nice enough. 2010-01-24 15:07:03 +00:00
1008dcf194 Convert MySQL date/time values more safely against 0-dates. Fixes issue #1613 2010-01-19 23:19:19 +00:00
9080ad7607 No need to use the Wide* version of string functions any longer. 2010-01-15 20:28:48 +00:00
52ea8f410a Use Unicode enabled TStringList instead of TWideStringList in all places. Should have no visible effect, apart from a very minor performance optimization, as String reference pointers are handled by Delphi, WideString by Windows. 2010-01-14 19:41:58 +00:00
307bb8ca65 Fix sporadic AV which seems to follow after a reconnect with no db selected. 2010-01-14 18:23:17 +00:00
9b8fb4cc1f Fix critical character in SQL on old servers which can be converted using the local codepage. Fixes issue #1569. 2010-01-12 22:17:54 +00:00
df6397abc7 Fix detection of VARCHAR columns as BLOBs on 4.0 servers. Workaround for shared type FIELD_TYPE_* constants should only apply to (TINY|MEDIUM|LONG)TEXT columns. Fixes issue #1588. 2010-01-11 22:24:25 +00:00