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

Make WITH LOCK work with window functions

This commit is contained in:
asfernandes 2009-12-11 14:47:41 +00:00
parent 1772ea1c22
commit fe95abee91

View File

@ -7975,10 +7975,12 @@ static dsql_nod* pass1_rse_impl( CompiledStatement* statement, dsql_nod* input,
fb_assert(input->nod_count > 1); fb_assert(input->nod_count > 1);
if (update_lock) if (update_lock)
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
// Token unknown // Token unknown
Arg::Gds(isc_token_err) << Arg::Gds(isc_token_err) <<
Arg::Gds(isc_random) << Arg::Str("WITH LOCK")); Arg::Gds(isc_random) << Arg::Str("WITH LOCK"));
}
return pass1_union(statement, input, order, rows, flags); return pass1_union(statement, input, order, rows, flags);
} }
@ -8310,15 +8312,6 @@ static dsql_nod* pass1_rse_impl( CompiledStatement* statement, dsql_nod* input,
if ((rse->nod_arg[e_rse_items] && aggregate_found(statement, rse->nod_arg[e_rse_items], true)) || if ((rse->nod_arg[e_rse_items] && aggregate_found(statement, rse->nod_arg[e_rse_items], true)) ||
sortWindow) sortWindow)
{ {
// Don't allow WITH LOCK
if (update_lock)
{
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
// Token unknown
Arg::Gds(isc_token_err) <<
Arg::Gds(isc_random) << Arg::Str("WITH LOCK"));
}
parent_context = FB_NEW(*tdbb->getDefaultPool()) dsql_ctx(*tdbb->getDefaultPool()); parent_context = FB_NEW(*tdbb->getDefaultPool()) dsql_ctx(*tdbb->getDefaultPool());
parent_context->ctx_context = statement->req_context_number++; parent_context->ctx_context = statement->req_context_number++;
parent_context->ctx_scope_level = statement->req_scope_level; parent_context->ctx_scope_level = statement->req_scope_level;
@ -8330,6 +8323,12 @@ static dsql_nod* pass1_rse_impl( CompiledStatement* statement, dsql_nod* input,
parent_rse->nod_arg[e_rse_streams] = list = MAKE_node(nod_list, 1); parent_rse->nod_arg[e_rse_streams] = list = MAKE_node(nod_list, 1);
list->nod_arg[0] = window; list->nod_arg[0] = window;
if (rse->nod_arg[e_rse_lock])
{
parent_rse->nod_arg[e_rse_lock] = rse->nod_arg[e_rse_lock];
rse->nod_arg[e_rse_lock] = NULL;
}
if (rse->nod_arg[e_rse_first]) if (rse->nod_arg[e_rse_first])
{ {
parent_rse->nod_arg[e_rse_first] = rse->nod_arg[e_rse_first]; parent_rse->nod_arg[e_rse_first] = rse->nod_arg[e_rse_first];