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

Fixed CORE-1811. A solution is to move the validation code from GEN to PASS1 in order to catch bad things earlier. This differs from the SAS solution, but hopefully it's more generic.

This commit is contained in:
dimitr 2008-04-01 06:11:29 +00:00
parent 8812aecf19
commit 30f7cce178
2 changed files with 13 additions and 8 deletions

View File

@ -161,14 +161,6 @@ void GEN_expr( dsql_req* request, dsql_nod* node)
return;
case nod_dom_value:
if ((request->req_type != REQ_DDL) ||
!(ddl_node = request->req_ddl_node) ||
!(ddl_node->nod_type == nod_def_domain ||
ddl_node->nod_type == nod_mod_domain))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 901,
isc_arg_gds, isc_dsql_domain_err, 0);
}
stuff(request, blr_fid);
stuff(request, 0); // Context
stuff_word(request, 0); // Field id

View File

@ -1044,6 +1044,17 @@ dsql_nod* PASS1_node(dsql_req* request, dsql_nod* input, bool proc_flag)
return node;
case nod_dom_value:
{
const dsql_nod* const ddl_node =
(request->req_type == REQ_DDL) ? request->req_ddl_node : NULL;
if (!ddl_node ||
!(ddl_node->nod_type == nod_def_domain ||
ddl_node->nod_type == nod_mod_domain))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 901,
isc_arg_gds, isc_dsql_domain_err, 0);
}
}
node = MAKE_node(input->nod_type, input->nod_count);
node->nod_desc = input->nod_desc;
return node;
@ -1054,9 +1065,11 @@ dsql_nod* PASS1_node(dsql_req* request, dsql_nod* input, bool proc_flag)
*reinterpret_cast<internal_info_id*>(input->nod_arg[0]->nod_desc.dsc_address);
USHORT req_mask = InternalInfo::getMask(id);
if (req_mask && !(request->req_flags & req_mask))
{
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
isc_arg_gds, isc_token_err, // Token unknown
isc_arg_gds, isc_random, isc_arg_string, InternalInfo::getAlias(id), 0);
}
}
break;