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

Function gen_event_init

src/gpre/languages/ada.cpp:1728–1781  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1726//
1727
1728static void gen_event_init( const act* action, int column)
1729{
1730 const TEXT* pattern1 =
1731 "isc_%N1l := firebird.event_block (%RFisc_%N1a'address, %RFisc_%N1b'address, isc_%N1c, %RFisc_%N1v);";
1732 const TEXT *pattern2 =
1733 "firebird.event_wait (%V1 %RF%DH, isc_%N1l, isc_%N1a, isc_%N1b);";
1734 const TEXT* pattern3 =
1735 "firebird.event_counts (isc_events, isc_%N1l, isc_%N1a, isc_%N1b);";
1736
1737 if (action->act_error)
1738 begin(column);
1739 begin(column);
1740
1741 gpre_nod* init = (gpre_nod*) action->act_object;
1742 gpre_nod* event_list = init->nod_arg[1];
1743
1744 PAT args;
1745 args.pat_database = (gpre_dbb*) init->nod_arg[3];
1746 args.pat_vector1 = status_vector(action);
1747 args.pat_value1 = (int)(IPTR) init->nod_arg[2];
1748
1749 // generate call to dynamically generate event blocks
1750
1751 TEXT variable[MAX_REF_SIZE];
1752 USHORT count = 0;
1753 gpre_nod** ptr = event_list->nod_arg;
1754 for (gpre_nod** const end = ptr + event_list->nod_count; ptr < end; ++ptr)
1755 {
1756 count++;
1757 const gpre_nod* node = *ptr;
1758 if (node->nod_type == nod_field)
1759 {
1760 const ref* reference = (ref*) node->nod_arg[0];
1761 gen_name(variable, reference, true);
1762 printa(column, "isc_%dv(%d) := %s'address;", args.pat_value1, count, variable);
1763 }
1764 else
1765 printa(column, "isc_%dv(%d) := %s'address;", args.pat_value1, count, node->nod_arg[0]);
1766 }
1767
1768 printa(column, "isc_%dc := %d;", args.pat_value1, (int) event_list->nod_count);
1769 PATTERN_expand(column, pattern1, &args);
1770
1771 // generate actual call to event_wait
1772
1773 PATTERN_expand(column, pattern2, &args);
1774
1775 // get change in event counts, copying event parameter block for reuse
1776
1777 PATTERN_expand(column, pattern3, &args);
1778
1779 endp(column);
1780 set_sqlcode(action, column);
1781}
1782
1783
1784//____________________________________________________________

Callers 1

ADA_actionFunction · 0.70

Calls 7

PATTERN_expandFunction · 0.85
beginFunction · 0.70
status_vectorFunction · 0.70
gen_nameFunction · 0.70
printaFunction · 0.70
endpFunction · 0.70
set_sqlcodeFunction · 0.70

Tested by

no test coverage detected