| 3676 | // |
| 3677 | |
| 3678 | static act* act_openclose(act_t type) |
| 3679 | { |
| 3680 | const TEXT* transaction = 0; |
| 3681 | |
| 3682 | if (type == ACT_open) |
| 3683 | par_options(&transaction); |
| 3684 | |
| 3685 | // Handle dynamic SQL statement, if appropriate |
| 3686 | |
| 3687 | dyn* cursor = par_dynamic_cursor(); |
| 3688 | if (cursor) |
| 3689 | { |
| 3690 | dyn* statement = (dyn*) MSC_alloc(DYN_LEN); |
| 3691 | statement->dyn_statement_name = cursor->dyn_statement_name; |
| 3692 | statement->dyn_cursor_name = cursor->dyn_cursor_name; |
| 3693 | act* action = (act*) MSC_alloc(ACT_LEN); |
| 3694 | action->act_object = (ref*) statement; |
| 3695 | action->act_whenever = gen_whenever(); |
| 3696 | if (type == ACT_open) |
| 3697 | { |
| 3698 | action->act_type = ACT_dyn_open; |
| 3699 | statement->dyn_trans = transaction; |
| 3700 | par_using(statement); |
| 3701 | if (statement->dyn_using) |
| 3702 | PAR_error("Using host-variable list not supported."); |
| 3703 | par_into(statement); |
| 3704 | } |
| 3705 | else |
| 3706 | action->act_type = ACT_dyn_close; |
| 3707 | return action; |
| 3708 | } |
| 3709 | |
| 3710 | // Statement is static SQL |
| 3711 | |
| 3712 | gpre_sym* symbol = NULL; |
| 3713 | gpre_req* request = par_cursor(&symbol); |
| 3714 | |
| 3715 | act* action = MSC_action(request, type); |
| 3716 | if (type == ACT_open) |
| 3717 | { |
| 3718 | open_cursor* open = (open_cursor*) MSC_alloc(OPN_LEN); |
| 3719 | open->opn_trans = transaction; |
| 3720 | open->opn_cursor = symbol; |
| 3721 | action->act_object = (ref*) open; |
| 3722 | if (transaction != NULL) |
| 3723 | request->req_trans = transaction; |
| 3724 | if (request->req_flags & (REQ_sql_blob_open | REQ_sql_blob_create)) |
| 3725 | { |
| 3726 | if (request->req_flags & REQ_sql_blob_open) |
| 3727 | { |
| 3728 | if (!MSC_match(KW_USING)) |
| 3729 | CPR_s_error("USING"); |
| 3730 | } |
| 3731 | else if (!MSC_match(KW_INTO)) |
| 3732 | CPR_s_error("INTO"); |
| 3733 | ref* opn_using = (ref*) SQE_variable(NULL, false, NULL, NULL); |
| 3734 | open->opn_using = opn_using; |
| 3735 | opn_using->ref_next = request->req_blobs->blb_reference; |
no test coverage detected