mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Support length of "max" in data types. Used in MSSQL.
This commit is contained in:
@ -1831,7 +1831,7 @@ end;
|
|||||||
function TAdoDBConnection.GetCreateCode(Database, Schema, Name: String; NodeType: TListNodeType): String;
|
function TAdoDBConnection.GetCreateCode(Database, Schema, Name: String; NodeType: TListNodeType): String;
|
||||||
var
|
var
|
||||||
Cols, Keys: TDBQuery;
|
Cols, Keys: TDBQuery;
|
||||||
ConstraintName: String;
|
ConstraintName, MaxLen: String;
|
||||||
ColNames: TStringList;
|
ColNames: TStringList;
|
||||||
|
|
||||||
// Return fitting schema clause for queries in IS.TABLES, IS.ROUTINES etc.
|
// Return fitting schema clause for queries in IS.TABLES, IS.ROUTINES etc.
|
||||||
@ -1857,8 +1857,13 @@ begin
|
|||||||
);
|
);
|
||||||
while not Cols.Eof do begin
|
while not Cols.Eof do begin
|
||||||
Result := Result + CRLF + #9 + QuoteIdent(Cols.Col('COLUMN_NAME')) + ' ' + UpperCase(Cols.Col('DATA_TYPE'));
|
Result := Result + CRLF + #9 + QuoteIdent(Cols.Col('COLUMN_NAME')) + ' ' + UpperCase(Cols.Col('DATA_TYPE'));
|
||||||
if not Cols.IsNull('CHARACTER_MAXIMUM_LENGTH') then
|
if not Cols.IsNull('CHARACTER_MAXIMUM_LENGTH') then begin
|
||||||
Result := Result + '(' + Cols.Col('CHARACTER_MAXIMUM_LENGTH') + ')';
|
MaxLen := Cols.Col('CHARACTER_MAXIMUM_LENGTH');
|
||||||
|
if MaxLen = '-1' then
|
||||||
|
Result := Result + '(max)'
|
||||||
|
else
|
||||||
|
Result := Result + '(' + MaxLen + ')';
|
||||||
|
end;
|
||||||
if Cols.Col('IS_NULLABLE') = 'NO' then
|
if Cols.Col('IS_NULLABLE') = 'NO' then
|
||||||
Result := Result + ' NOT';
|
Result := Result + ' NOT';
|
||||||
Result := Result + ' NULL';
|
Result := Result + ' NULL';
|
||||||
|
Reference in New Issue
Block a user