mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Revert previous commit. Disabling foreign key checks while deleting rows leaves orphaned rows in foreign tables. Other solution to be discussed.
This commit is contained in:
@ -3680,8 +3680,6 @@ var
|
||||
TableOrView: TDBObject;
|
||||
Objects: TDBObjectList;
|
||||
Names: String;
|
||||
DisableForeignKeys: Boolean;
|
||||
Conn: TDBConnection;
|
||||
begin
|
||||
// Delete rows from selected tables and views
|
||||
|
||||
@ -3702,17 +3700,11 @@ begin
|
||||
mtConfirmation, [mbOk, mbCancel]) = mrOk then begin
|
||||
Screen.Cursor := crHourglass;
|
||||
EnableProgress(Objects.Count);
|
||||
Conn := ActiveConnection;
|
||||
try
|
||||
DisableForeignKeys := (Conn.Parameters.NetTypeGroup = ngMySQL) and (Conn.ServerVersionInt >= 40014);
|
||||
if DisableForeignKeys then
|
||||
Conn.Query('SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0');
|
||||
for TableOrView in Objects do begin
|
||||
TableOrView.Connection.Query(TableOrView.Connection.GetSQLSpecifity(spEmptyTable) + TableOrView.QuotedName);
|
||||
ProgressStep;
|
||||
end;
|
||||
if DisableForeignKeys then
|
||||
Conn.Query('SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS');
|
||||
actRefresh.Execute;
|
||||
except
|
||||
on E:EDatabaseError do begin
|
||||
|
Reference in New Issue
Block a user