mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #1800: wrap column default expression in parentheses on MySQL v8.0.13+ when altering a table
This commit is contained in:
@ -10524,14 +10524,24 @@ begin
|
||||
cdtText: Result := Result + 'DEFAULT '+FConnection.EscapeString(DefaultText);
|
||||
cdtNull: Result := Result + 'DEFAULT NULL';
|
||||
cdtAutoInc: Result := Result + 'AUTO_INCREMENT';
|
||||
cdtExpression: Result := Result + 'DEFAULT '+DefaultText;
|
||||
cdtExpression: begin
|
||||
if FConnection.Parameters.IsMySQL(True) and (FConnection.ServerVersionInt >= 80013) then
|
||||
Result := Result + 'DEFAULT ('+DefaultText+')'
|
||||
else
|
||||
Result := Result + 'DEFAULT '+DefaultText;
|
||||
end;
|
||||
end;
|
||||
case OnUpdateType of
|
||||
// cdtNothing: leave out whole clause
|
||||
// cdtText: not supported, but may be valid in MariaDB?
|
||||
// cdtNull: not supported, but may be valid in MariaDB?
|
||||
// cdtAutoInc: not valid in ON UPDATE
|
||||
cdtExpression: Result := Result + ' ON UPDATE '+OnUpdateText;
|
||||
cdtExpression: begin
|
||||
if FConnection.Parameters.IsMySQL(True) and (FConnection.ServerVersionInt >= 80013) then
|
||||
Result := Result + ' ON UPDATE ('+OnUpdateText+')'
|
||||
else
|
||||
Result := Result + ' ON UPDATE '+OnUpdateText;
|
||||
end;
|
||||
end;
|
||||
Result := Result + ' ';
|
||||
end;
|
||||
|
Reference in New Issue
Block a user