diff --git a/src/jrd/met.epp b/src/jrd/met.epp index 2bf1e6e1ea..b33660f716 100644 --- a/src/jrd/met.epp +++ b/src/jrd/met.epp @@ -124,7 +124,6 @@ static void get_trigger(thread_db*, jrd_rel*, bid*, bid*, trig_vec**, const TEXT static bool get_type(thread_db*, USHORT*, const UCHAR*, const TEXT*); static void lookup_view_contexts(thread_db*, jrd_rel*); static void make_relation_scope_name(const TEXT*, const USHORT, Firebird::string& str); -static jrd_nod* parse_param_blr(thread_db*, jrd_prc*, bid*, CompilerScratch*); static jrd_nod* parse_procedure_blr(thread_db*, jrd_prc*, bid*, CompilerScratch*); static bool par_messages(thread_db*, const UCHAR*, USHORT, jrd_prc*, CompilerScratch*); static bool resolve_charset_and_collation(thread_db*, USHORT*, const UCHAR*, @@ -3077,21 +3076,25 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags) (fb_utils::implicit_domain(F.RDB$FIELD_NAME) && !F.RDB$DEFAULT_VALUE.NULL))) { procedure->prc_defaults++; - Jrd::ContextPoolHolder context(tdbb, JrdMemoryPool::createPool()); - CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5); + JrdMemoryPool *pool = JrdMemoryPool::createPool(); + Jrd::ContextPoolHolder context(tdbb, pool); - if (!pa_default_value_null) + if (pa_default_value_null) + pa_default_value = F.RDB$DEFAULT_VALUE; + + try { parameter->prm_default_value = - parse_param_blr(tdbb, procedure, &pa_default_value, csb); + MET_parse_blob(tdbb, NULL, &pa_default_value, NULL, NULL, false); } - else + catch(const Firebird::Exception&) { - parameter->prm_default_value = - parse_param_blr(tdbb, procedure, &F.RDB$DEFAULT_VALUE, csb); - } + // Here we loose pools created for previous defaults. + // Probably we should use common pool for defaults and procedure itself. - delete csb; + JrdMemoryPool::deletePool(pool); + throw; + } } END_FOR; @@ -4350,27 +4353,6 @@ static void make_relation_scope_name(const TEXT* rel_name, } -static jrd_nod* parse_param_blr(thread_db* tdbb, - jrd_prc* procedure, bid* blob_id, CompilerScratch* csb) -{ - SET_TDBB(tdbb); - Database* dbb = tdbb->getDatabase(); - - blb* blob = BLB_open(tdbb, dbb->dbb_sys_trans, blob_id); - SLONG length = blob->blb_length + 10; - Firebird::HalfStaticArray temp; - - BLB_get_data(tdbb, blob, temp.getBuffer(length), length); - csb->csb_blr = temp.begin(); - - jrd_nod* node = - PAR_blr(tdbb, NULL, temp.begin(), NULL, &csb, - &procedure->prc_request, false, 0); - csb->csb_blr = 0; - - return node; -} - static jrd_nod* parse_procedure_blr( thread_db* tdbb, jrd_prc* procedure, bid* blob_id, CompilerScratch* csb)