|
@@ -312,7 +312,7 @@ end;
|
|
function TdmSysTables.ScriptCheckConstraints(dbIndex: Integer; List: TStrings
|
|
function TdmSysTables.ScriptCheckConstraints(dbIndex: Integer; List: TStrings
|
|
): boolean;
|
|
): boolean;
|
|
const
|
|
const
|
|
- Template='select '+
|
|
|
|
|
|
+ QueryTemplate='select '+
|
|
'rc.rdb$relation_name, t.rdb$trigger_source '+
|
|
'rc.rdb$relation_name, t.rdb$trigger_source '+
|
|
'from rdb$check_constraints cc '+
|
|
'from rdb$check_constraints cc '+
|
|
'inner join rdb$relation_constraints rc '+
|
|
'inner join rdb$relation_constraints rc '+
|
|
@@ -328,7 +328,7 @@ begin
|
|
try
|
|
try
|
|
Init(dbIndex);
|
|
Init(dbIndex);
|
|
sqQuery.Close;
|
|
sqQuery.Close;
|
|
- sqQuery.SQL.Text:= Template;
|
|
|
|
|
|
+ sqQuery.SQL.Text:= QueryTemplate;
|
|
sqQuery.Open;
|
|
sqQuery.Open;
|
|
while not sqQuery.EOF do
|
|
while not sqQuery.EOF do
|
|
begin
|
|
begin
|
|
@@ -389,7 +389,7 @@ const
|
|
// Note that this query differs from the way constraints are
|
|
// Note that this query differs from the way constraints are
|
|
// presented in GetConstraintsOfTable.
|
|
// presented in GetConstraintsOfTable.
|
|
// to do: find out what the differences are and indicate better in code/comments
|
|
// to do: find out what the differences are and indicate better in code/comments
|
|
- Template='select '+
|
|
|
|
|
|
+ QueryTemplate='select '+
|
|
'trim(rc.rdb$constraint_name) as ConstName, '+
|
|
'trim(rc.rdb$constraint_name) as ConstName, '+
|
|
'trim(rfc.rdb$const_name_uq) as KeyName, '+
|
|
'trim(rfc.rdb$const_name_uq) as KeyName, '+
|
|
'trim(rc2.rdb$relation_name) as OtherTableName, '+
|
|
'trim(rc2.rdb$relation_name) as OtherTableName, '+
|
|
@@ -409,7 +409,7 @@ const
|
|
'order by rc.rdb$constraint_name, flds_fk.rdb$field_position ';
|
|
'order by rc.rdb$constraint_name, flds_fk.rdb$field_position ';
|
|
begin
|
|
begin
|
|
SqlQuery.Close;
|
|
SqlQuery.Close;
|
|
- SQLQuery.SQL.Text:= format(Template, [UpperCase(ATableName)]);
|
|
|
|
|
|
+ SQLQuery.SQL.Text:= format(QueryTemplate, [UpperCase(ATableName)]);
|
|
SqlQuery.Open;
|
|
SqlQuery.Open;
|
|
Result:= SqlQuery.RecordCount > 0;
|
|
Result:= SqlQuery.RecordCount > 0;
|
|
with SqlQuery do
|
|
with SqlQuery do
|
|
@@ -638,7 +638,7 @@ procedure TdmSysTables.GetDomainInfo(dbIndex: Integer; DomainName: string; var D
|
|
const
|
|
const
|
|
// Select domain and associated collation (if text type domain)
|
|
// Select domain and associated collation (if text type domain)
|
|
// note weird double join fields required...
|
|
// note weird double join fields required...
|
|
- Template= 'select f.*, '+
|
|
|
|
|
|
+ QueryTemplate= 'select f.*, '+
|
|
'c.rdb$collation_name '+
|
|
'c.rdb$collation_name '+
|
|
'from rdb$fields as f '+
|
|
'from rdb$fields as f '+
|
|
'left join rdb$collations as c on '+
|
|
'left join rdb$collations as c on '+
|
|
@@ -648,7 +648,7 @@ const
|
|
begin
|
|
begin
|
|
Init(dbIndex);
|
|
Init(dbIndex);
|
|
sqQuery.Close;
|
|
sqQuery.Close;
|
|
- sqQuery.SQL.Text:= format(Template, [UpperCase(DomainName)]);
|
|
|
|
|
|
+ sqQuery.SQL.Text:= format(QueryTemplate, [UpperCase(DomainName)]);
|
|
sqQuery.Open;
|
|
sqQuery.Open;
|
|
|
|
|
|
if sqQuery.RecordCount > 0 then
|
|
if sqQuery.RecordCount > 0 then
|