mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 15:23:02 +01:00
Better and simpler fix for bug CORE-1884.
This commit is contained in:
parent
70bfdb36dd
commit
5f8774827c
@ -188,6 +188,27 @@ bool CMP_clone_is_active(const jrd_req* request)
|
||||
|
||||
jrd_nod* CMP_clone_node(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* C M P _ c l o n e _ n o d e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Clone a node.
|
||||
*
|
||||
**************************************/
|
||||
SET_TDBB(tdbb);
|
||||
|
||||
DEV_BLKCHK(csb, type_csb);
|
||||
DEV_BLKCHK(node, type_nod);
|
||||
|
||||
return copy(tdbb, csb, node, NULL, 0, NULL, false);
|
||||
}
|
||||
|
||||
|
||||
jrd_nod* CMP_clone_node_opt(thread_db* tdbb, CompilerScratch* csb, jrd_nod* node)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* C M P _ c l o n e _ n o d e
|
||||
@ -2003,20 +2024,7 @@ jrd_req* CMP_make_request(thread_db* tdbb, CompilerScratch* csb, bool internal_f
|
||||
|
||||
found = csb->csb_map_field_info.getNext();
|
||||
}
|
||||
{ // scope
|
||||
jrd_nod ***ptr = csb->csb_to_clone.begin();
|
||||
jrd_nod **const *const end = csb->csb_to_clone.end();
|
||||
for (; ptr < end; ptr++)
|
||||
{
|
||||
UCHAR local_map[MAP_LENGTH];
|
||||
|
||||
jrd_nod *node = **ptr;
|
||||
node = copy(tdbb, csb, node, local_map, 0, NULL, false);
|
||||
node = pass1(tdbb, csb, node, NULL, 0, false);
|
||||
**ptr = node;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
csb->csb_impure = REQ_SIZE + REQ_TAIL * MAX(csb->csb_n_stream, 1);
|
||||
csb->csb_exec_sta.clear();
|
||||
|
||||
@ -2033,16 +2041,7 @@ jrd_req* CMP_make_request(thread_db* tdbb, CompilerScratch* csb, bool internal_f
|
||||
|
||||
found = csb->csb_map_field_info.getNext();
|
||||
}
|
||||
{ // scope
|
||||
jrd_nod ***ptr = csb->csb_to_clone.begin();
|
||||
jrd_nod **const *const end = csb->csb_to_clone.end();
|
||||
for (; ptr < end; ptr++)
|
||||
{
|
||||
jrd_nod *node = **ptr;
|
||||
pass2(tdbb, csb, node, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (csb->csb_impure > MAX_REQUEST_SIZE) {
|
||||
IBERROR(226); // msg 226 request size limit exceeded
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "../jrd/scl.h"
|
||||
|
||||
bool CMP_clone_is_active(const Jrd::jrd_req*);
|
||||
Jrd::jrd_nod* CMP_clone_node_opt(Jrd::thread_db*, Jrd::CompilerScratch*, Jrd::jrd_nod*);
|
||||
Jrd::jrd_nod* CMP_clone_node(Jrd::thread_db*, Jrd::CompilerScratch*, Jrd::jrd_nod*);
|
||||
Jrd::jrd_req* CMP_clone_request(Jrd::thread_db*, Jrd::jrd_req*, USHORT, bool);
|
||||
Jrd::jrd_req* CMP_compile2(Jrd::thread_db*, const UCHAR*, USHORT, USHORT = 0, const UCHAR* = NULL);
|
||||
|
@ -814,7 +814,6 @@ public:
|
||||
csb_map_field_info(p),
|
||||
csb_map_item_info(p),
|
||||
csb_domain_validation(domain_validation),
|
||||
csb_to_clone(p),
|
||||
csb_rpt(p, len)
|
||||
{}
|
||||
|
||||
@ -856,7 +855,6 @@ public:
|
||||
MapFieldInfo csb_map_field_info; // Map field name to field info
|
||||
MapItemInfo csb_map_item_info; // Map item to item info
|
||||
Firebird::MetaName csb_domain_validation; // Parsing domain constraint in PSQL
|
||||
Firebird::Array<jrd_nod**> csb_to_clone; // default values for procedure, requires cloning and processing
|
||||
|
||||
struct csb_repeat
|
||||
{
|
||||
|
@ -2039,7 +2039,7 @@ static SLONG decompose(thread_db* tdbb,
|
||||
}
|
||||
jrd_nod* node = OPT_make_binary_node(nod_geq, arg, boolean_node->nod_arg[1], true);
|
||||
stack.push(node);
|
||||
arg = CMP_clone_node(tdbb, csb, arg);
|
||||
arg = CMP_clone_node_opt(tdbb, csb, arg);
|
||||
node = OPT_make_binary_node(nod_leq, arg, boolean_node->nod_arg[2], true);
|
||||
stack.push(node);
|
||||
return 2;
|
||||
@ -6384,11 +6384,11 @@ static jrd_nod* make_inference_node(CompilerScratch* csb, jrd_nod* boolean,
|
||||
// If provisions above change the line below will have to be modified
|
||||
node->nod_flags = boolean->nod_flags;
|
||||
/* But substitute new values for some of the predicate arguments */
|
||||
node->nod_arg[0] = CMP_clone_node(tdbb, csb, arg1);
|
||||
node->nod_arg[1] = CMP_clone_node(tdbb, csb, arg2);
|
||||
node->nod_arg[0] = CMP_clone_node_opt(tdbb, csb, arg1);
|
||||
node->nod_arg[1] = CMP_clone_node_opt(tdbb, csb, arg2);
|
||||
/* Arguments after the first two are just cloned (eg: LIKE ESCAPE clause) */
|
||||
for (USHORT n = 2; n < boolean->nod_count; n++)
|
||||
node->nod_arg[n] = CMP_clone_node(tdbb, csb, boolean->nod_arg[n]);
|
||||
node->nod_arg[n] = CMP_clone_node_opt(tdbb, csb, boolean->nod_arg[n]);
|
||||
// Share impure area for cached invariant value used to hold pre-compiled
|
||||
// pattern for new LIKE and CONTAINING algorithms.
|
||||
// Proper cloning of impure area for this node would require careful accounting
|
||||
|
@ -2213,8 +2213,7 @@ static void par_procedure_parms(
|
||||
// default value for parameter
|
||||
if ((count <= 0) && input_flag) {
|
||||
Parameter* parameter = (*procedure->prc_input_fields)[procedure->prc_inputs - n];
|
||||
asgn->nod_arg[asgn_arg1] = parameter->prm_default_value;
|
||||
csb->csb_to_clone.add(&asgn->nod_arg[asgn_arg1]);
|
||||
asgn->nod_arg[asgn_arg1] = CMP_clone_node(tdbb, csb, parameter->prm_default_value);
|
||||
}
|
||||
else {
|
||||
asgn->nod_arg[asgn_arg1] = parse(tdbb, csb, VALUE);
|
||||
|
Loading…
Reference in New Issue
Block a user