@@ -3534,8 +3534,9 @@ ValueExprNode* CastNode::pass1(thread_db* tdbb, CompilerScratch* csb)
35343534 // Are we using a collation?
35353535 if (TTYPE_TO_COLLATION (ttype) != 0 )
35363536 {
3537- CMP_post_resource (&csb->csb_resources , INTL_texttype_lookup (tdbb, ttype),
3538- Resource::rsc_collation, ttype);
3537+ Collation* collation = csb->csb_resources .registerResource (tdbb, Resource::rsc_collation,
3538+ INTL_texttype_lookup (tdbb, ttype), ttype);
3539+ csb->csb_resources .postResource (tdbb, Resource::rsc_collation, collation, ttype);
35393540 }
35403541
35413542 return this ;
@@ -4837,7 +4838,8 @@ DmlNode* DefaultNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch*
48374838 if (csb->csb_g_flags & csb_get_dependencies)
48384839 {
48394840 CompilerScratch::Dependency dependency (obj_relation);
4840- dependency.relation = MetadataCache::lookup_relation (tdbb, relationName).unsafePointer ();
4841+ auto rel = MetadataCache::lookup_relation (tdbb, relationName);
4842+ dependency.relation = csb->csb_resources .registerResource (tdbb, Resource::rsc_relation, rel, rel->rel_id );
48414843 dependency.subName = FB_NEW_POOL (pool) MetaName (fieldName);
48424844 csb->csb_dependencies .push (dependency);
48434845 }
@@ -4846,11 +4848,11 @@ DmlNode* DefaultNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch*
48464848
48474849 while (true )
48484850 {
4849- HazardPtr<jrd_rel> relation = MetadataCache::lookup_relation (tdbb, relationName);
4851+ auto relation = MetadataCache::lookup_relation (tdbb, relationName);
48504852
48514853 if (relation && relation->rel_fields )
48524854 {
4853- int fieldId = MET_lookup_field (tdbb, relation.unsafePointer (), fieldName);
4855+ int fieldId = MET_lookup_field (tdbb, relation.getPointer (), fieldName);
48544856
48554857 if (fieldId >= 0 )
48564858 {
@@ -6579,7 +6581,8 @@ ValueExprNode* FieldNode::pass1(thread_db* tdbb, CompilerScratch* csb)
65796581 try
65806582 {
65816583 ThreadStatusGuard local_status (tdbb);
6582- collation = INTL_texttype_lookup (tdbb, ttype);
6584+ collation = csb->csb_resources .registerResource (tdbb, Resource::rsc_collation,
6585+ INTL_texttype_lookup (tdbb, ttype), ttype);
65836586 }
65846587 catch (Exception&)
65856588 {
@@ -6590,7 +6593,7 @@ ValueExprNode* FieldNode::pass1(thread_db* tdbb, CompilerScratch* csb)
65906593 }
65916594
65926595 if (collation)
6593- CMP_post_resource (& csb->csb_resources , collation, Resource::rsc_collation, ttype);
6596+ csb->csb_resources . postResource (tdbb, Resource::rsc_collation, collation , ttype);
65946597 }
65956598
65966599 // if this is a modify or store, check REFERENCES access to any foreign keys
@@ -10691,9 +10694,10 @@ dsc* StrCaseNode::execute(thread_db* tdbb, Request* request) const
1069110694 if (request->req_flags & req_null)
1069210695 return NULL ;
1069310696
10694- TextType* textType = INTL_texttype_lookup (tdbb, value->getTextType ());
10697+ HazardPtr<Collation> textType = INTL_texttype_lookup (tdbb, value->getTextType ());
1069510698 CharSet* charSet = textType->getCharSet ();
10696- auto intlFunction = (blrOp == blr_lowcase ? &TextType::str_to_lower : &TextType::str_to_upper);
10699+ // auto intlFunction = (blrOp == blr_lowcase ? &TextType::str_to_lower : &TextType::str_to_upper);
10700+ auto intlFunction = (blrOp == blr_lowcase ? &Collation::str_to_lower : &Collation::str_to_upper);
1069710701
1069810702 if (value->isBlob ())
1069910703 {
@@ -10723,7 +10727,7 @@ dsc* StrCaseNode::execute(thread_db* tdbb, Request* request) const
1072310727
1072410728 if (len)
1072510729 {
10726- len = (textType->*intlFunction)(len, buffer.begin (), buffer.getCapacity (), buffer.begin ());
10730+ len = (textType. getPointer () ->*intlFunction)(len, buffer.begin (), buffer.getCapacity (), buffer.begin ());
1072710731 newBlob->BLB_put_data (tdbb, buffer.begin (), len);
1072810732 }
1072910733 }
@@ -10745,7 +10749,7 @@ dsc* StrCaseNode::execute(thread_db* tdbb, Request* request) const
1074510749 desc.setTextType (ttype);
1074610750 EVL_make_value (tdbb, &desc, impure);
1074710751
10748- len = (textType->*intlFunction)(len, ptr, desc.dsc_length , impure->vlu_desc .dsc_address );
10752+ len = (textType. getPointer () ->*intlFunction)(len, ptr, desc.dsc_length , impure->vlu_desc .dsc_address );
1074910753
1075010754 if (len == INTL_BAD_STR_LENGTH)
1075110755 status_exception::raise (Arg::Gds (isc_arith_except));
@@ -11999,7 +12003,7 @@ dsc* SubstringSimilarNode::execute(thread_db* tdbb, Request* request) const
1199912003 return NULL ;
1200012004
1200112005 USHORT textType = exprDesc->getTextType ();
12002- Collation* collation = INTL_texttype_lookup (tdbb, textType);
12006+ HazardPtr< Collation> collation = INTL_texttype_lookup (tdbb, textType);
1200312007 CharSet* charSet = collation->getCharSet ();
1200412008
1200512009 MoveBuffer exprBuffer;
@@ -12561,7 +12565,7 @@ dsc* TrimNode::execute(thread_db* tdbb, Request* request) const
1256112565 return NULL ;
1256212566
1256312567 USHORT ttype = INTL_TEXT_TYPE (*valueDesc);
12564- TextType* tt = INTL_texttype_lookup (tdbb, ttype);
12568+ HazardPtr<Collation> tt = INTL_texttype_lookup (tdbb, ttype);
1256512569 CharSet* cs = tt->getCharSet ();
1256612570
1256712571 const UCHAR* charactersAddress;
@@ -12757,8 +12761,9 @@ DmlNode* UdfCallNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch*
1275712761 HazardPtr<Function> func;
1275812762 if (!node->function )
1275912763 {
12760- func = Function::lookup (tdbb, name, false ); // !!!!!!!!!!!!!!!!!!! resource
12761- node->function = func.unsafePointer ();
12764+ func = Function::lookup (tdbb, name, false );
12765+ if (func)
12766+ node->function = csb->csb_resources .registerResource (tdbb, Resource::rsc_function, func, func->getId ());
1276212767 }
1276312768
1276412769 Function* function = node->function ;
@@ -12883,8 +12888,8 @@ ValueExprNode* UdfCallNode::copy(thread_db* tdbb, NodeCopier& copier) const
1288312888 node->function = function;
1288412889 else
1288512890 {
12886- HazardPtr<Function> func = Function::lookup (tdbb, name, false ); // !!!!!!!!!!!!!!!!!!! resource
12887- node->function = func. unsafePointer ( );
12891+ HazardPtr<Function> func = Function::lookup (tdbb, name, false );
12892+ node->function = copier. csb -> csb_resources . registerResource (tdbb, Resource::rsc_function, func, func-> getId () );
1288812893 }
1288912894 return node;
1289012895}
@@ -12944,7 +12949,7 @@ ValueExprNode* UdfCallNode::pass1(thread_db* tdbb, CompilerScratch* csb)
1294412949 csb->csb_external .insert (idx, temp);
1294512950 }
1294612951
12947- CMP_post_resource (& csb->csb_resources , function, Resource::rsc_function, function->getId ());
12952+ csb->csb_resources . postResource (tdbb, Resource::rsc_function, function. getObject () , function->getId ());
1294812953 }
1294912954
1295012955 return this ;
0 commit comments