| 1787 | // |
| 1788 | |
| 1789 | static void gen_event_wait( const act* action, int column) |
| 1790 | { |
| 1791 | const TEXT* pattern1 = "firebird.event_wait (%V1 %RF%DH, isc_%N1l, isc_%N1a, isc_%N1b);"; |
| 1792 | const TEXT* pattern2 = "firebird.event_counts (isc_events, isc_%N1l, isc_%N1a, isc_%N1b);"; |
| 1793 | |
| 1794 | if (action->act_error) |
| 1795 | begin(column); |
| 1796 | begin(column); |
| 1797 | |
| 1798 | gpre_sym* event_name = (gpre_sym*) action->act_object; |
| 1799 | |
| 1800 | // go through the stack of gpreGlob.events, checking to see if the |
| 1801 | // event has been initialized and getting the event identifier |
| 1802 | |
| 1803 | int ident = -1; |
| 1804 | const gpre_dbb* database = NULL; |
| 1805 | for (gpre_lls* stack_ptr = gpreGlob.events; stack_ptr; stack_ptr = stack_ptr->lls_next) |
| 1806 | { |
| 1807 | const act* event_action = (const act*) stack_ptr->lls_object; |
| 1808 | gpre_nod* event_init = (gpre_nod*) event_action->act_object; |
| 1809 | gpre_sym* stack_name = (gpre_sym*) event_init->nod_arg[0]; |
| 1810 | if (!strcmp(event_name->sym_string, stack_name->sym_string)) |
| 1811 | { |
| 1812 | ident = (int)(IPTR) event_init->nod_arg[2]; |
| 1813 | database = (gpre_dbb*) event_init->nod_arg[3]; |
| 1814 | } |
| 1815 | } |
| 1816 | |
| 1817 | if (ident < 0) |
| 1818 | { |
| 1819 | TEXT s[64]; |
| 1820 | sprintf(s, "event handle \"%s\" not found", event_name->sym_string); |
| 1821 | CPR_error(s); |
| 1822 | return; |
| 1823 | } |
| 1824 | |
| 1825 | PAT args; |
| 1826 | args.pat_database = database; |
| 1827 | args.pat_vector1 = status_vector(action); |
| 1828 | args.pat_value1 = ident; |
| 1829 | |
| 1830 | // generate calls to wait on the event and to fill out the gpreGlob.events array |
| 1831 | |
| 1832 | PATTERN_expand(column, pattern1, &args); |
| 1833 | PATTERN_expand(column, pattern2, &args); |
| 1834 | |
| 1835 | endp(column); |
| 1836 | set_sqlcode(action, column); |
| 1837 | } |
| 1838 | |
| 1839 | |
| 1840 |
no test coverage detected