mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 00:43:02 +01:00
Added missed check of field existance like it was in trigger1
This commit is contained in:
parent
f1f2137a8b
commit
732c39b70a
@ -11293,6 +11293,22 @@ static bool checkObjectExist(thread_db* tdbb, jrd_tra* transaction, const MetaNa
|
||||
return rc;
|
||||
}
|
||||
|
||||
static bool checkFieldExist(thread_db* tdbb, jrd_tra* transaction, const MetaName& relation, const MetaName& field)
|
||||
{
|
||||
bool rc = false;
|
||||
|
||||
AutoCacheRequest request(tdbb, drq_rel_field_exist, DYN_REQUESTS);
|
||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction)
|
||||
X IN RDB$RELATION_FIELDS
|
||||
WITH X.RDB$RELATION_NAME EQ relation.c_str() AND
|
||||
X.RDB$FIELD_NAME EQ field.c_str()
|
||||
{
|
||||
rc = true;
|
||||
}
|
||||
END_FOR
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Execute SQL grant/revoke operation.
|
||||
void GrantRevokeNode::grantRevoke(thread_db* tdbb, jrd_tra* transaction, const GranteeClause* object,
|
||||
@ -11412,6 +11428,9 @@ void GrantRevokeNode::grantRevoke(thread_db* tdbb, jrd_tra* transaction, const G
|
||||
case obj_relation:
|
||||
if (!checkObjectExist(tdbb, transaction, objName, objType))
|
||||
status_exception::raise(Arg::PrivateDyn(306) << objName.c_str()); // Table @1 does not exist
|
||||
|
||||
if (field.hasData() && !checkFieldExist(tdbb, transaction, objName, field))
|
||||
status_exception::raise(Arg::PrivateDyn(309) << field.c_str() << objName.c_str()); // Field @1 of table @2 does not exist
|
||||
break;
|
||||
|
||||
case obj_trigger:
|
||||
|
@ -242,6 +242,7 @@ enum drq_type_t
|
||||
drq_rel_exist, // check if relation or view exists
|
||||
drq_exception_exist, // check if exception exists
|
||||
drq_generator_exist, // check if generator exists
|
||||
drq_rel_field_exist, // check if a field of relation or view exists
|
||||
|
||||
drq_MAX
|
||||
};
|
||||
|
@ -6,7 +6,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
|
||||
('2015-01-07 18:01:51', 'GFIX', 3, 134)
|
||||
('1996-11-07 13:39:40', 'GPRE', 4, 1)
|
||||
('2017-02-05 20:37:00', 'DSQL', 7, 41)
|
||||
('2018-01-15 00:15:00', 'DYN', 8, 308)
|
||||
('2018-01-15 00:15:00', 'DYN', 8, 309)
|
||||
('1996-11-07 13:39:40', 'INSTALL', 10, 1)
|
||||
('1996-11-07 13:38:41', 'TEST', 11, 4)
|
||||
('2018-04-26 20:40:00', 'GBAK', 12, 387)
|
||||
|
@ -2089,6 +2089,7 @@ COMMIT WORK;
|
||||
(NULL, 'GrantRevokeNode::grantRevoke', 'DdlNodes.epp', NULL, 8, 306, NULL, 'Table @1 does not exist', NULL, NULL);
|
||||
(NULL, 'GrantRevokeNode::grantRevoke', 'DdlNodes.epp', NULL, 8, 307, NULL, 'Exception @1 does not exist', NULL, NULL);
|
||||
(NULL, 'GrantRevokeNode::grantRevoke', 'DdlNodes.epp', NULL, 8, 308, NULL, 'Generator/Sequence @1 does not exist', NULL, NULL);
|
||||
(NULL, 'GrantRevokeNode::grantRevoke', 'DdlNodes.epp', NULL, 8, 309, NULL, 'Field @1 of table @2 does not exist', NULL, NULL);
|
||||
COMMIT WORK;
|
||||
-- TEST
|
||||
(NULL, 'main', 'test.c', NULL, 11, 0, NULL, 'This is a modified text message', NULL, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user