8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:03:03 +01:00

Field check constraints are now deleted automatically

This commit is contained in:
skidder 2002-10-02 17:56:08 +00:00
parent b38c50a1ae
commit 06ca13ebe0
2 changed files with 173 additions and 75 deletions

View File

@ -553,6 +553,29 @@ for idx in RDB$INDICES cross
else
erase cnst;
end_for;
for cnst in RDB$RELATION_CONSTRAINTS cross
chk in RDB$CHECK_CONSTRAINTS over RDB$CONSTRAINT_NAME cross
dep in RDB$DEPENDENCIES with
cnst.RDB$RELATION_NAME = old.RDB$RELATION_NAME and
cnst.RDB$CONSTRAINT_TYPE = 'CHECK' and
chk.RDB$TRIGGER_NAME = dep.RDB$DEPENDENT_NAME and
dep.RDB$DEPENDENT_TYPE = 2 and
dep.RDB$DEPENDED_ON_TYPE = 0 and
dep.RDB$DEPENDED_ON_NAME = old.RDB$RELATION_NAME and
dep.RDB$FIELD_NAME = old.RDB$FIELD_NAME
if any dep1 in RDB$DEPENDENCIES with
dep1.RDB$DEPENDENT_NAME = chk.RDB$TRIGGER_NAME and
dep1.RDB$DEPENDENT_TYPE = 2 and
dep1.RDB$DEPENDED_ON_TYPE = 0 and
dep1.RDB$DEPENDED_ON_NAME = old.RDB$RELATION_NAME and
dep1.RDB$FIELD_NAME NE old.RDB$FIELD_NAME
abort 1
else
erase cnst;
end_for;
end;
end_trigger
message 1: "Cannot delete field being used in an integrity constraint.";

View File

@ -1819,81 +1819,156 @@ static CONST TEXT trigger_23_msg_0 [] = "Cannot delete field being used in an in
static CONST UCHAR FAR_VARIABLE trigger23[] = {
blr_version5,
blr_begin,
blr_for,
blr_rse, 3,
blr_relation, 11, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'I', 'C', 'E', 'S',
3,
blr_relation, 24, 'R', 'D', 'B', '$', 'R', 'E', 'L', 'A', 'T', 'I', 'O',
'N', '_', 'C', 'O', 'N', 'S', 'T', 'R', 'A', 'I', 'N', 'T', 'S', 4,
blr_relation, 18, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'E', 'X', '_', 'S',
'E', 'G', 'M', 'E', 'N', 'T', 'S', 5,
blr_boolean,
blr_and,
blr_eql,
blr_field, 3, 17, 'R', 'D', 'B', '$', 'R', 'E', 'L', 'A', 'T', 'I', 'O',
'N', '_', 'N', 'A', 'M', 'E',
blr_field, 0, 17, 'R', 'D', 'B', '$', 'R', 'E', 'L', 'A', 'T', 'I', 'O',
'N', '_', 'N', 'A', 'M', 'E',
blr_and,
blr_eql,
blr_field, 3, 14, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'E', 'X', '_', 'N',
'A', 'M', 'E',
blr_field, 5, 14, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'E', 'X', '_', 'N',
'A', 'M', 'E',
blr_and,
blr_eql,
blr_field, 4, 14, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'E', 'X', '_', 'N',
'A', 'M', 'E',
blr_field, 5, 14, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'E', 'X', '_', 'N',
'A', 'M', 'E',
blr_and,
blr_eql,
blr_field, 5, 14, 'R', 'D', 'B', '$', 'F', 'I', 'E', 'L', 'D', '_', 'N',
'A', 'M', 'E',
blr_field, 0, 14, 'R', 'D', 'B', '$', 'F', 'I', 'E', 'L', 'D', '_', 'N',
'A', 'M', 'E',
blr_or,
blr_eql,
blr_field, 4, 19, 'R', 'D', 'B', '$', 'C', 'O', 'N', 'S', 'T', 'R', 'A',
'I', 'N', 'T', '_', 'T', 'Y', 'P', 'E',
blr_literal, blr_text, 6, 0, 'U', 'N', 'I', 'Q', 'U', 'E',
blr_or,
blr_eql,
blr_field, 4, 19, 'R', 'D', 'B', '$', 'C', 'O', 'N', 'S', 'T', 'R', 'A',
'I', 'N', 'T', '_', 'T', 'Y', 'P', 'E',
blr_literal, blr_text, 11, 0, 'F', 'O', 'R', 'E', 'I', 'G', 'N', 32, 'K',
'E', 'Y',
blr_eql,
blr_field, 4, 19, 'R', 'D', 'B', '$', 'C', 'O', 'N', 'S', 'T', 'R', 'A',
'I', 'N', 'T', '_', 'T', 'Y', 'P', 'E',
blr_literal, blr_text, 11, 0, 'P', 'R', 'I', 'M', 'A', 'R', 'Y', 32, 'K',
'E', 'Y',
blr_end,
blr_begin,
blr_if,
blr_any,
blr_rse, 1,
blr_relation, 18, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'E', 'X', '_', 'S',
'E', 'G', 'M', 'E', 'N', 'T', 'S', 6,
blr_boolean,
blr_and,
blr_eql,
blr_field, 6, 14, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'E', 'X', '_', 'N',
'A', 'M', 'E',
blr_field, 5, 14, 'R', 'D', 'B', '$', 'I', 'N', 'D', 'E', 'X', '_', 'N',
'A', 'M', 'E',
blr_neq,
blr_field, 6, 14, 'R', 'D', 'B', '$', 'F', 'I', 'E', 'L', 'D', '_', 'N',
'A', 'M', 'E',
blr_field, 0, 14, 'R', 'D', 'B', '$', 'F', 'I', 'E', 'L', 'D', '_', 'N',
'A', 'M', 'E',
blr_end,
blr_leave, 1,
blr_erase, 4,
blr_end,
blr_end,
blr_eoc,
blr_begin,
blr_for,
blr_rse, 3,
blr_relation, 11, 'R','D','B','$','I','N','D','I','C','E','S', 3,
blr_relation, 24, 'R','D','B','$','R','E','L','A','T','I','O','N','_','C',
'O','N','S','T','R','A','I','N','T','S', 4,
blr_relation, 18, 'R','D','B','$','I','N','D','E','X','_','S','E','G','M',
'E','N','T','S', 5,
blr_boolean,
blr_and,
blr_eql,
blr_field, 3, 17, 'R','D','B','$','R','E','L','A','T','I','O','N','_','N',
'A','M','E',
blr_field, 0, 17, 'R','D','B','$','R','E','L','A','T','I','O','N','_','N',
'A','M','E',
blr_and,
blr_eql,
blr_field, 3, 14, 'R','D','B','$','I','N','D','E','X','_','N','A','M','E',
blr_field, 5, 14, 'R','D','B','$','I','N','D','E','X','_','N','A','M','E',
blr_and,
blr_eql,
blr_field, 4, 14, 'R','D','B','$','I','N','D','E','X','_','N','A','M','E',
blr_field, 5, 14, 'R','D','B','$','I','N','D','E','X','_','N','A','M','E',
blr_and,
blr_eql,
blr_field, 5, 14, 'R','D','B','$','F','I','E','L','D','_','N','A','M','E',
blr_field, 0, 14, 'R','D','B','$','F','I','E','L','D','_','N','A','M','E',
blr_or,
blr_eql,
blr_field, 4, 19, 'R','D','B','$','C','O','N','S','T','R','A','I','N','T',
'_','T','Y','P','E',
blr_literal, blr_text, 6,0, 'U','N','I','Q','U','E',
blr_or,
blr_eql,
blr_field, 4, 19, 'R','D','B','$','C','O','N','S','T','R','A','I','N','T',
'_','T','Y','P','E',
blr_literal, blr_text, 11,0, 'F','O','R','E','I','G','N',32,'K','E','Y',
blr_eql,
blr_field, 4, 19, 'R','D','B','$','C','O','N','S','T','R','A','I','N','T',
'_','T','Y','P','E',
blr_literal, blr_text, 11,0, 'P','R','I','M','A','R','Y',32,'K','E','Y',
blr_end,
blr_begin,
blr_if,
blr_any,
blr_rse, 1,
blr_relation, 18, 'R','D','B','$','I','N','D','E','X','_','S','E','G','M',
'E','N','T','S', 6,
blr_boolean,
blr_and,
blr_eql,
blr_field, 6, 14, 'R','D','B','$','I','N','D','E','X','_','N','A','M','E',
blr_field, 5, 14, 'R','D','B','$','I','N','D','E','X','_','N','A','M','E',
blr_neq,
blr_field, 6, 14, 'R','D','B','$','F','I','E','L','D','_','N','A','M','E',
blr_field, 0, 14, 'R','D','B','$','F','I','E','L','D','_','N','A','M','E',
blr_end,
blr_leave, 1,
blr_erase, 4,
blr_end,
blr_for,
blr_rse, 3,
blr_relation, 24, 'R','D','B','$','R','E','L','A','T','I','O','N','_','C',
'O','N','S','T','R','A','I','N','T','S', 7,
blr_relation, 21, 'R','D','B','$','C','H','E','C','K','_','C','O','N','S',
'T','R','A','I','N','T','S', 8,
blr_relation, 16, 'R','D','B','$','D','E','P','E','N','D','E','N','C','I',
'E','S', 9,
blr_boolean,
blr_and,
blr_and,
blr_eql,
blr_field, 7, 17, 'R','D','B','$','R','E','L','A','T','I','O','N','_','N',
'A','M','E',
blr_field, 0, 17, 'R','D','B','$','R','E','L','A','T','I','O','N','_','N',
'A','M','E',
blr_and,
blr_eql,
blr_field, 7, 19, 'R','D','B','$','C','O','N','S','T','R','A','I','N','T',
'_','T','Y','P','E',
blr_literal, blr_text, 5,0, 'C','H','E','C','K',
blr_and,
blr_eql,
blr_field, 8, 16, 'R','D','B','$','T','R','I','G','G','E','R','_','N','A',
'M','E',
blr_field, 9, 18, 'R','D','B','$','D','E','P','E','N','D','E','N','T','_',
'N','A','M','E',
blr_and,
blr_eql,
blr_field, 9, 18, 'R','D','B','$','D','E','P','E','N','D','E','N','T','_',
'T','Y','P','E',
blr_literal, blr_long, 0, 2,0,0,0,
blr_and,
blr_eql,
blr_field, 9, 20, 'R','D','B','$','D','E','P','E','N','D','E','D','_','O',
'N','_','T','Y','P','E',
blr_literal, blr_long, 0, 0,0,0,0,
blr_and,
blr_eql,
blr_field, 9, 20, 'R','D','B','$','D','E','P','E','N','D','E','D','_','O',
'N','_','N','A','M','E',
blr_field, 0, 17, 'R','D','B','$','R','E','L','A','T','I','O','N','_','N',
'A','M','E',
blr_eql,
blr_field, 9, 14, 'R','D','B','$','F','I','E','L','D','_','N','A','M','E',
blr_field, 0, 14, 'R','D','B','$','F','I','E','L','D','_','N','A','M','E',
blr_eql,
blr_field, 8, 19, 'R','D','B','$','C','O','N','S','T','R','A','I','N','T',
'_','N','A','M','E',
blr_field, 7, 19, 'R','D','B','$','C','O','N','S','T','R','A','I','N','T',
'_','N','A','M','E',
blr_end,
blr_begin,
blr_if,
blr_any,
blr_rse, 1,
blr_relation, 16, 'R','D','B','$','D','E','P','E','N','D','E','N','C','I',
'E','S', 10,
blr_boolean,
blr_and,
blr_eql,
blr_field, 10, 18, 'R','D','B','$','D','E','P','E','N','D','E','N','T','_',
'N','A','M','E',
blr_field, 8, 16, 'R','D','B','$','T','R','I','G','G','E','R','_','N','A',
'M','E',
blr_and,
blr_eql,
blr_field, 10, 18, 'R','D','B','$','D','E','P','E','N','D','E','N','T','_',
'T','Y','P','E',
blr_literal, blr_long, 0, 2,0,0,0,
blr_and,
blr_eql,
blr_field, 10, 20, 'R','D','B','$','D','E','P','E','N','D','E','D','_','O',
'N','_','T','Y','P','E',
blr_literal, blr_long, 0, 0,0,0,0,
blr_and,
blr_eql,
blr_field, 10, 20, 'R','D','B','$','D','E','P','E','N','D','E','D','_','O',
'N','_','N','A','M','E',
blr_field, 0, 17, 'R','D','B','$','R','E','L','A','T','I','O','N','_','N',
'A','M','E',
blr_neq,
blr_field, 10, 14, 'R','D','B','$','F','I','E','L','D','_','N','A','M','E',
blr_field, 0, 14, 'R','D','B','$','F','I','E','L','D','_','N','A','M','E',
blr_end,
blr_leave, 1,
blr_erase, 7,
blr_end,
blr_end,
blr_eoc,
};