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

Function create_del_cascade_trg

src/gpre/cmd.cpp:696–744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

694//
695
696static void create_del_cascade_trg( gpre_req* request, const act* action,
697 cnstrt* constraint)
698{
699 const gpre_rel* relation = (gpre_rel*) action->act_object;
700
701 // stuff a trigger_name of size 0. So the dyn-parser will make one up.
702 put_string(request, isc_dyn_def_trigger, "", (USHORT) 0);
703
704 put_numeric(request, isc_dyn_trg_type, (SSHORT) POST_ERASE_TRIGGER);
705
706 request->add_byte(isc_dyn_sql_object);
707 put_numeric(request, isc_dyn_trg_sequence, (SSHORT) 1);
708 put_numeric(request, isc_dyn_trg_inactive, (SSHORT) 0);
709 put_cstring(request, isc_dyn_rel_name, constraint->cnstrt_referred_rel->str_string);
710
711 // the trigger blr
712 request->add_byte(isc_dyn_trg_blr);
713 const USHORT offset = request->req_blr - request->req_base;
714
715 request->add_word(0);
716 if (request->req_flags & REQ_blr_version4)
717 request->add_byte(blr_version4);
718 else
719 request->add_byte(blr_version5);
720
721 request->add_byte(blr_for);
722 request->add_byte(blr_rse);
723
724 // the context for the prim. key relation
725 request->add_byte(1);
726
727 request->add_byte(blr_relation);
728 put_cstring(request, 0, relation->rel_symbol->sym_string);
729 // the context for the foreign key relation
730 request->add_byte(2);
731
732 create_matching_blr(request, constraint);
733
734 request->add_byte(blr_erase);
735 request->add_byte((SSHORT) 2);
736 request->add_byte(blr_eoc);
737 const USHORT length = request->req_blr - request->req_base - offset - 2;
738 request->req_base[offset] = (UCHAR) length;
739 request->req_base[offset + 1] = (UCHAR) (length >> 8);
740 // end of the blr
741
742 // no trg_source and no trg_description
743 request->add_byte(isc_dyn_end);
744}
745
746
747//____________________________________________________________

Callers 1

create_constraintFunction · 0.85

Calls 6

put_stringFunction · 0.85
put_cstringFunction · 0.85
create_matching_blrFunction · 0.85
put_numericFunction · 0.70
add_byteMethod · 0.45
add_wordMethod · 0.45

Tested by

no test coverage detected