mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Safety fixes:
- Only generate COLLATE in CREATE DATABASE if CHARACTER SET was not empty. - Surround CHARACTER SET + COLLATE in version conditional comment.
This commit is contained in:
@ -191,9 +191,12 @@ begin
|
||||
begin
|
||||
sql := 'CREATE DATABASE ' + Mainform.Childwin.mask( editDBName.Text );
|
||||
if comboCharset.Enabled and (comboCharset.Text <> '') then
|
||||
sql := sql + ' CHARACTER SET ' + comboCharset.Text;
|
||||
begin
|
||||
sql := sql + ' /*!40100 CHARACTER SET ' + comboCharset.Text;
|
||||
if comboCollation.Enabled and (comboCollation.Text <> '') then
|
||||
sql := sql + ' COLLATE ' + comboCollation.Text;
|
||||
sql := sql + ' */';
|
||||
end;
|
||||
Try
|
||||
Mainform.Childwin.ExecUpdateQuery( sql );
|
||||
// Close form
|
||||
@ -207,9 +210,11 @@ begin
|
||||
else begin
|
||||
sql := 'ALTER DATABASE ' + Mainform.Childwin.mask( modifyDB );
|
||||
if comboCharset.Enabled and (comboCharset.Text <> '') then
|
||||
begin
|
||||
sql := sql + ' CHARACTER SET ' + comboCharset.Text;
|
||||
if comboCollation.Enabled and (comboCollation.Text <> '') then
|
||||
sql := sql + ' COLLATE ' + comboCollation.Text;
|
||||
end;
|
||||
Try
|
||||
Mainform.Childwin.ExecUpdateQuery( sql );
|
||||
if modifyDB <> editDBName.Text then
|
||||
|
Reference in New Issue
Block a user