|
@@ -308,6 +308,7 @@ var
|
|
SPOwner: string;
|
|
SPOwner: string;
|
|
ModuleName, EntryPoint, Params: string;
|
|
ModuleName, EntryPoint, Params: string;
|
|
Line: string;
|
|
Line: string;
|
|
|
|
+ CheckConstraint: string; //for domain check constraints
|
|
Collation: string;
|
|
Collation: string;
|
|
DomainType, DefaultValue: string;
|
|
DomainType, DefaultValue: string;
|
|
DomainSize: Integer;
|
|
DomainSize: Integer;
|
|
@@ -437,8 +438,8 @@ begin
|
|
if (x = 8) and cxDomains.Checked then // Domains
|
|
if (x = 8) and cxDomains.Checked then // Domains
|
|
for i:= 0 to dbObjectsList[x].Count - 1 do
|
|
for i:= 0 to dbObjectsList[x].Count - 1 do
|
|
begin
|
|
begin
|
|
- dmSysTables.GetDomainInfo(fdbIndex, dbObjectsList[x].Strings[i], DomainType, DomainSize, DefaultValue, Collation);
|
|
|
|
- //todo: add support for collations and character sets.
|
|
|
|
|
|
+ dmSysTables.GetDomainInfo(fdbIndex, dbObjectsList[x].Strings[i], DomainType, DomainSize, DefaultValue, CheckConstraint, Collation);
|
|
|
|
+ //todo: add support for collations and character sets and check constraints
|
|
|
|
|
|
Line:= 'Create Domain ' + dbObjectsList[x].Strings[i] + ' as ' + DomainType;
|
|
Line:= 'Create Domain ' + dbObjectsList[x].Strings[i] + ' as ' + DomainType;
|
|
if Pos('CHAR', DomainType) > 0 then
|
|
if Pos('CHAR', DomainType) > 0 then
|
|
@@ -978,10 +979,10 @@ end;
|
|
procedure TfmComparison.CheckModifiedDomains;
|
|
procedure TfmComparison.CheckModifiedDomains;
|
|
var
|
|
var
|
|
i: Integer;
|
|
i: Integer;
|
|
- Collation: string;
|
|
|
|
|
|
+ CheckConstraint, Collation: string;
|
|
DomainName: string;
|
|
DomainName: string;
|
|
DomainType, DefaultValue: string;
|
|
DomainType, DefaultValue: string;
|
|
- CCollation: string;
|
|
|
|
|
|
+ CCheckConstraint, CCollation: string;
|
|
CDomainType, CDefaultValue: string;
|
|
CDomainType, CDefaultValue: string;
|
|
DomainSize, CDomainSize: Integer;
|
|
DomainSize, CDomainSize: Integer;
|
|
begin
|
|
begin
|
|
@@ -991,7 +992,7 @@ begin
|
|
|
|
|
|
for i:= 0 to dbExistingObjectsList[8].Count - 1 do
|
|
for i:= 0 to dbExistingObjectsList[8].Count - 1 do
|
|
begin
|
|
begin
|
|
- // Check for cancel button press
|
|
|
|
|
|
+ // Check for pressed cancel button
|
|
Application.ProcessMessages;
|
|
Application.ProcessMessages;
|
|
if fCanceled then
|
|
if fCanceled then
|
|
Exit;
|
|
Exit;
|
|
@@ -999,13 +1000,14 @@ begin
|
|
DomainName:= dbExistingObjectsList[8][i];
|
|
DomainName:= dbExistingObjectsList[8][i];
|
|
|
|
|
|
// Read all domain properties
|
|
// Read all domain properties
|
|
- dmSysTables.GetDomainInfo(fdbIndex, DomainName, DomainType, DomainSize, DefaultValue, Collation);
|
|
|
|
- dmSysTables.GetDomainInfo(cbComparedDatabase.ItemIndex, DomainName, CDomainType, CDomainSize, CDefaultValue,CCollation);
|
|
|
|
|
|
+ dmSysTables.GetDomainInfo(fdbIndex, DomainName, DomainType, DomainSize, DefaultValue, CheckConstraint, Collation);
|
|
|
|
+ dmSysTables.GetDomainInfo(cbComparedDatabase.ItemIndex, DomainName, CDomainType, CDomainSize, CDefaultValue, CCheckConstraint, CCollation);
|
|
|
|
|
|
// Compare
|
|
// Compare
|
|
if (DomainType <> CDomainType) or
|
|
if (DomainType <> CDomainType) or
|
|
(DomainSize <> CDomainSize) or
|
|
(DomainSize <> CDomainSize) or
|
|
(DefaultValue <> CDefaultValue) or
|
|
(DefaultValue <> CDefaultValue) or
|
|
|
|
+ (CheckConstraint <> CCheckConstraint) or
|
|
(Collation <> CCollation) then
|
|
(Collation <> CCollation) then
|
|
begin
|
|
begin
|
|
meLog.Lines.Add(' ' + DomainName);
|
|
meLog.Lines.Add(' ' + DomainName);
|
|
@@ -1512,7 +1514,7 @@ end;
|
|
procedure TfmComparison.ScriptModifiedDomains;
|
|
procedure TfmComparison.ScriptModifiedDomains;
|
|
var
|
|
var
|
|
i: Integer;
|
|
i: Integer;
|
|
- Collation: string;
|
|
|
|
|
|
+ CheckConstraint, Collation: string;
|
|
DomainName: string;
|
|
DomainName: string;
|
|
DomainType, DefaultValue: string;
|
|
DomainType, DefaultValue: string;
|
|
DomainSize: Integer;
|
|
DomainSize: Integer;
|
|
@@ -1528,13 +1530,17 @@ begin
|
|
for i:= 0 to ModifiedDomainsList.Count - 1 do
|
|
for i:= 0 to ModifiedDomainsList.Count - 1 do
|
|
begin
|
|
begin
|
|
DomainName:= ModifiedDomainsList[i];
|
|
DomainName:= ModifiedDomainsList[i];
|
|
- dmSysTables.GetDomainInfo(fdbIndex, DomainName, DomainType, domainSize, DefaultValue, Collation);
|
|
|
|
|
|
+ dmSysTables.GetDomainInfo(fdbIndex, DomainName, DomainType, domainSize, DefaultValue, CheckConstraint, Collation);
|
|
fQueryWindow.meQuery.Lines.Add('');
|
|
fQueryWindow.meQuery.Lines.Add('');
|
|
Line:= 'Alter DOMAIN ' + DomainName + ' type ' + DomainType;
|
|
Line:= 'Alter DOMAIN ' + DomainName + ' type ' + DomainType;
|
|
if Pos('char', LowerCase(DomainType)) > 0 then
|
|
if Pos('char', LowerCase(DomainType)) > 0 then
|
|
Line:= Line + '(' + IntToStr(DomainSize) + ')';
|
|
Line:= Line + '(' + IntToStr(DomainSize) + ')';
|
|
fQueryWindow.meQuery.Lines.Add(Line);
|
|
fQueryWindow.meQuery.Lines.Add(Line);
|
|
|
|
|
|
|
|
+ // todo: verify if this check constraint clause works correctly
|
|
|
|
+ if Trim(CheckConstraint) <> '' then
|
|
|
|
+ FQueryWindow.meQuery.Lines.Add(Trim(CheckConstraint));
|
|
|
|
+
|
|
// todo: verify if this collation clause works correctly
|
|
// todo: verify if this collation clause works correctly
|
|
if Trim(Collation) <> '' then
|
|
if Trim(Collation) <> '' then
|
|
FQueryWindow.meQuery.Lines.Add('collation '+Trim(Collation));
|
|
FQueryWindow.meQuery.Lines.Add('collation '+Trim(Collation));
|