| 727 | // |
| 728 | |
| 729 | act* PAR_event_init(bool sql) |
| 730 | { |
| 731 | //char req_name[128]; |
| 732 | |
| 733 | // make up statement node |
| 734 | |
| 735 | SQL_resolve_identifier("<identifier>", NULL, MAX_EVENT_SIZE); |
| 736 | //SQL_resolve_identifier("<identifier>", req_name, sizeof(req_name)); |
| 737 | //strcpy(gpreGlob.token_global.tok_string, req_name); Why? It's already done. |
| 738 | gpre_nod* init = MSC_node(nod_event_init, 4); |
| 739 | init->nod_arg[0] = (gpre_nod*) PAR_symbol(SYM_dummy); |
| 740 | init->nod_arg[3] = (gpre_nod*) gpreGlob.isc_databases; |
| 741 | |
| 742 | act* action = MSC_action(0, ACT_event_init); |
| 743 | action->act_object = (ref*) init; |
| 744 | |
| 745 | // parse optional database handle |
| 746 | |
| 747 | if (!MSC_match(KW_LEFT_PAREN)) |
| 748 | { |
| 749 | gpre_sym* symbol = gpreGlob.token_global.tok_symbol; |
| 750 | if (symbol && (symbol->sym_type == SYM_database)) |
| 751 | init->nod_arg[3] = (gpre_nod*) symbol->sym_object; |
| 752 | else |
| 753 | CPR_s_error("left parenthesis or database handle"); |
| 754 | |
| 755 | PAR_get_token(); |
| 756 | if (!MSC_match(KW_LEFT_PAREN)) |
| 757 | CPR_s_error("left parenthesis"); |
| 758 | } |
| 759 | |
| 760 | // eat any number of event strings until a right paren is found, |
| 761 | // pushing the gpreGlob.events onto a stack |
| 762 | |
| 763 | gpre_nod* node; |
| 764 | gpre_lls* stack = NULL; |
| 765 | int count = 0; |
| 766 | |
| 767 | while (true) |
| 768 | { |
| 769 | if (MSC_match(KW_RIGHT_PAREN)) |
| 770 | break; |
| 771 | |
| 772 | const gpre_sym* symbol; |
| 773 | if (!sql && (symbol = gpreGlob.token_global.tok_symbol) && symbol->sym_type == SYM_context) |
| 774 | { |
| 775 | gpre_ctx* context; |
| 776 | gpre_fld* field = EXP_field(&context); |
| 777 | ref* reference = EXP_post_field(field, context, false); |
| 778 | node = MSC_node(nod_field, 1); |
| 779 | node->nod_arg[0] = (gpre_nod*) reference; |
| 780 | } |
| 781 | else |
| 782 | { |
| 783 | node = MSC_node(nod_null, 1); |
| 784 | if (sql) |
| 785 | node->nod_arg[0] = (gpre_nod*) SQL_var_or_string(false); |
| 786 | else |
no test coverage detected