Skip to content

Commit a765044

Browse files
committed
fix: ignore failing timezone and SQL mode reset after table tools export
1 parent 5ea5461 commit a765044

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

‎source/tabletools.pas‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,10 +1056,22 @@ procedure TfrmTableTools.Execute(Sender: TObject);
10561056
UpdateResultGrid;
10571057
end;
10581058

1059-
// Activate ansi mode or whatever again, locally
1060-
Conn.Query('/*!40101 SET SQL_MODE=IFNULL(@OLD_LOCAL_SQL_MODE, '''') */');
1059+
// Activate ansi mode or whatever again, locally. Some servers or proxies
1060+
// reject these restore statements, e.g. MySQL error 1298 on the TIME_ZONE one.
1061+
// Logging instead of raising, as we do not want to abort the export with it.
1062+
try
1063+
Conn.Query('/*!40101 SET SQL_MODE=IFNULL(@OLD_LOCAL_SQL_MODE, '''') */');
1064+
except
1065+
on E:EDbError do
1066+
Conn.Log(lcError, E.Message);
1067+
end;
10611068
// Reset timezone for reading to previous value
1062-
Conn.Query('/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, ''system'') */');
1069+
try
1070+
Conn.Query('/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, ''system'') */');
1071+
except
1072+
on E:EDbError do
1073+
Conn.Log(lcError, E.Message);
1074+
end;
10631075
end;
10641076
ExportLastDatabase := '';
10651077

0 commit comments

Comments
 (0)