Is there a GUIish way to remove all the objects from a database when there're foreign keys out there?
So far, I have to issue a SET @@FOREIGN_KEY_CHECKS=0 command in a query tab before removing the items in the database tab and them remember to set it back to true.
Empty database
You may not be able to set it back to 1 but, well, you're deleting tables after all.
Whatever, removing items can be tricky. Apparently, you also need to remove triggers, procedures and functions in a specific order or you'll get error messages like: SQL Error (1360): Trigger does not exist
Whatever, removing items can be tricky. Apparently, you also need to remove triggers, procedures and functions in a specific order or you'll get error messages like: SQL Error (1360): Trigger does not exist
For triggers, it looks like they get deleted automatically by the server if you delete the associated table. Anyway, that must not mean we never delete triggers, as you should be able to delete a trigger alone. So, first triggers then tables, as said above. Foreign key checks disabled before heals the initial problem. Sticking to the above mentioned order of actions.
Code modification/commit
a19e85a
from ansgar.becker,
14 years ago,
revision 5.1.0.3577
Implement TObjectList comparer which orders items in a way that dropping them does not trap in SQL errors. Also, avoid errors due to foreign key checks. Fixes issue #2193. See also http://www.heidisql.com/forum.php?t=6322
Oh, managed to get one:
date/time : 2010-11-05, 11:50:54, 148ms
computer name : ***********************
user name : *********************** <admin>
registered owner : ***********************
operating system : Windows XP Service Pack 3 build 2600
system language : Spanish
system up time : 8 days 18 hours
program up time : 9 seconds
processors : 2x Intel(R) Pentium(R) 4 CPU 3.00GHz
physical memory : 307/991 MB (free/total)
free disk space : (C:) 5,52 GB (E:) 12,43 GB
display mode : 1280x1024, 32 bit
process id : $660
allocated memory : 13,85 MB
executable : heidisql.exe
exec. date/time : 2010-11-04 17:32
version : 5.1.0.3579
compiled with : Delphi 2010
madExcept version : 3.0k
callstack crc : $23605a31, $5a11123e, $5a11123e
exception number : 1
exception class : EAccessViolation
exception message : Access violation at address 00764C2C in module 'heidisql.exe'. Read of address 00000098.
main thread ($1710):
00764c2c heidisql.exe mysql_connection 2852 +0 TDBObjectDropComparer.Compare
0076cabb heidisql.exe mysql_connection 3132 +0 TArray.QuickSort<mysql_connection.TDBObject>
0076bf7c heidisql.exe mysql_connection 3132 +0 TArray.Sort<mysql_connection.TDBObject>
00766721 heidisql.exe mysql_connection 3132 +0 TList<mysql_connection.TDBObject>.Sort
006c269e heidisql.exe Main 2649 +47 TMainForm.actDropObjectsExecute
00499e77 heidisql.exe Classes TBasicAction.Execute
00555e39 heidisql.exe ActnList TContainedAction.Execute
00556bf4 heidisql.exe ActnList TCustomAction.Execute
00499d3b heidisql.exe Classes TBasicActionLink.Execute
00526cbc heidisql.exe Menus TMenuItem.Click
0052828f heidisql.exe Menus TMenu.DispatchCommand
0052946e heidisql.exe Menus TPopupList.WndProc
0053eac8 heidisql.exe Controls TWinControl.MainWndProc
005293bd heidisql.exe Menus TPopupList.MainWndProc
0049a524 heidisql.exe Classes StdWndProc
7e398a0b USER32.dll DispatchMessageW
0056b229 heidisql.exe Forms TApplication.ProcessMessage
0056b26e heidisql.exe Forms TApplication.HandleMessage
0056b599 heidisql.exe Forms TApplication.Run
007a7742 heidisql.exe heidisql 66 +15 initialization
Yes, can confirm a crash, although with a different callstack. Fuck. Similar one see issue #2224.
Please login to leave a reply, or register at first.