mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Move code from helpers.GetColumnDefaultClause into dbconnection.TTableColumn.SQLCode. Support microseconds part in DEFAULT CURRENT_TIMESTAMP clause. Fixes issue #3506.
This commit is contained in:
@ -306,7 +306,6 @@ type
|
||||
function StringListCompareAnythingDesc(List: TStringList; Index1, Index2: Integer): Integer;
|
||||
function StringListCompareByValue(List: TStringList; Index1, Index2: Integer): Integer;
|
||||
function GetColumnDefaultType(var Text: String): TColumnDefaultType;
|
||||
function GetColumnDefaultClause(DefaultType: TColumnDefaultType; DataTypeIndex: TDBDatatypeIndex; Text: String): String;
|
||||
function GetImageLinkTimeStamp(const FileName: string): TDateTime;
|
||||
function IsEmpty(Str: String): Boolean;
|
||||
function IsNotEmpty(Str: String): Boolean;
|
||||
@ -2148,25 +2147,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function GetColumnDefaultClause(DefaultType: TColumnDefaultType; DataTypeIndex: TDBDatatypeIndex; Text: String): String;
|
||||
begin
|
||||
Text := esc(Text);
|
||||
// Support BIT syntax in MySQL
|
||||
if DataTypeIndex = dtBit then
|
||||
Text := 'b'+Text;
|
||||
case DefaultType of
|
||||
cdtNothing: Result := '';
|
||||
cdtText: Result := 'DEFAULT '+Text;
|
||||
cdtTextUpdateTS: Result := 'DEFAULT '+Text+' ON UPDATE CURRENT_TIMESTAMP';
|
||||
cdtNull: Result := 'DEFAULT NULL';
|
||||
cdtNullUpdateTS: Result := 'DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP';
|
||||
cdtCurTS: Result := 'DEFAULT CURRENT_TIMESTAMP';
|
||||
cdtCurTSUpdateTS: Result := 'DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP';
|
||||
cdtAutoInc: Result := 'AUTO_INCREMENT';
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{**
|
||||
Return compile date/time from passed .exe name
|
||||
Code taken and modified from Michael Puff
|
||||
|
Reference in New Issue
Block a user