Prevent "Variable 'sql_notes' can't be set to the value of 'NULL'", via IFNULL() wrap. Saw that in the crash reports with the latest release. Related to issue #756.

This commit is contained in:
Ansgar Becker
2020-12-13 14:18:12 +01:00
parent 37cd83410b
commit c09d93e642

View File

@ -178,9 +178,9 @@ uses main, dbstructures;
const
STRSKIPPED: String = 'Skipped - ';
EXPORT_FILE_FOOTER = '/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '''') */;'+CRLF+
'/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;'+CRLF+
'/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;'+CRLF+
'/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;'+CRLF+
'/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;'+CRLF;
'/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;'+CRLF;
var
OUTPUT_FILE,
@ -792,9 +792,9 @@ begin
// For output to file or directory:
Output(EXPORT_FILE_FOOTER, False, True, False, False, False);
// For direct output to database or server:
Output('/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */', True, False, False, True, True);
Output('/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */', True, False, False, True, True);
Output('/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '''') */', True, False, False, True, True);
Output('/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */', True, False, False, True, True);
Output('/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */', True, False, False, True, True);
if comboExportOutputType.Text = OUTPUT_CLIPBOARD then
StreamToClipboard(ExportStream, nil, false);