MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / compile

Method compile

src/jrd/jrd.cpp:888–966  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

886}
887
888void Trigger::compile(thread_db* tdbb)
889{
890 SET_TDBB(tdbb);
891
892 Database* dbb = tdbb->getDatabase();
893 Jrd::Attachment* const att = tdbb->getAttachment();
894
895 if (extTrigger)
896 return;
897
898 if (!statement)
899 {
900 // Allocate statement memory pool
901 MemoryPool* new_pool = att->createPool();
902
903 // Trigger request is not compiled yet. Lets do it now
904 USHORT par_flags = (USHORT) (flags & TRG_ignore_perm) ? csb_ignore_perm : 0;
905
906 if (type & 1)
907 par_flags |= csb_pre_trigger;
908 else
909 par_flags |= csb_post_trigger;
910
911 try
912 {
913 Jrd::ContextPoolHolder context(tdbb, new_pool);
914
915 AutoPtr<CompilerScratch> auto_csb(FB_NEW_POOL(*new_pool) CompilerScratch(*new_pool));
916 CompilerScratch* csb = auto_csb;
917
918 csb->csb_g_flags |= par_flags;
919
920 if (engine.isEmpty())
921 {
922 TraceTrigCompile trace(tdbb, this);
923
924 if (debugInfo.hasData())
925 {
926 DBG_parse_debug_info((ULONG) debugInfo.getCount(), debugInfo.begin(),
927 *csb->csb_dbg_info);
928 }
929
930 PAR_blr(tdbb, relation, blr.begin(), (ULONG) blr.getCount(), NULL, &csb, &statement,
931 (relation ? true : false), par_flags);
932
933 trace.finish(statement, ITracePlugin::RESULT_SUCCESS);
934 }
935 else
936 {
937 dbb->dbb_extManager->makeTrigger(tdbb, csb, this, engine, entryPoint, extBody.c_str(),
938 (relation ?
939 (type & 1 ? IExternalTrigger::TYPE_BEFORE : IExternalTrigger::TYPE_AFTER) :
940 IExternalTrigger::TYPE_DATABASE));
941 }
942 }
943 catch (const Exception&)
944 {
945 if (statement)

Callers 3

EXE_execute_triggersFunction · 0.45
verifyTriggerAccessMethod · 0.45

Calls 15

SET_TDBBFunction · 0.85
DBG_parse_debug_infoFunction · 0.85
PAR_blrFunction · 0.85
getDatabaseMethod · 0.80
orElseMethod · 0.80
getUserIdMethod · 0.80
getAttachmentMethod · 0.45
createPoolMethod · 0.45
isEmptyMethod · 0.45
hasDataMethod · 0.45
getCountMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected