| 3223 | // |
| 3224 | |
| 3225 | static void gen_s_start( const act* action) |
| 3226 | { |
| 3227 | const gpre_req* request = action->act_request; |
| 3228 | |
| 3229 | gen_compile(action); |
| 3230 | |
| 3231 | const gpre_port* port = request->req_vport; |
| 3232 | if (port) |
| 3233 | asgn_from(action, port->por_references); |
| 3234 | |
| 3235 | if (action->act_type == ACT_open) |
| 3236 | gen_cursor_open(action, request); |
| 3237 | |
| 3238 | // Do not call "gen_start" in case if "gen_compile" failed |
| 3239 | |
| 3240 | if (action->act_error || (action->act_flags & ACT_sql)) |
| 3241 | { |
| 3242 | if (gpreGlob.sw_auto) |
| 3243 | printa(names[COLUMN], false, "IF %s NOT = 0 AND %s NOT = 0 THEN", |
| 3244 | request_trans(action, request), request->req_handle); |
| 3245 | else |
| 3246 | printa(names[COLUMN], false, "IF %s NOT = 0 THEN", request->req_handle); |
| 3247 | } |
| 3248 | |
| 3249 | gen_start(action, port); |
| 3250 | set_sqlcode(action); |
| 3251 | |
| 3252 | if (action->act_error || (action->act_flags & ACT_sql)) |
| 3253 | printa(names[COLUMN], false, "END-IF"); |
| 3254 | |
| 3255 | if (request->req_type == REQ_insert && (request->req_flags & REQ_sql_returning)) |
| 3256 | { |
| 3257 | printa(names[COLUMN], false, "IF SQLCODE NOT = 0 THEN"); |
| 3258 | gen_receive(action, request->req_primary); |
| 3259 | printa(names[COLUMN], false, "END-IF"); |
| 3260 | |
| 3261 | printa(names[COLUMN], false, "IF SQLCODE NOT = 0 THEN"); |
| 3262 | |
| 3263 | gpre_nod* var_list = (gpre_nod*) action->act_object; |
| 3264 | for (int i = 0; var_list && i < var_list->nod_count; i++) |
| 3265 | { |
| 3266 | asgn_to(action, (ref*) (var_list->nod_arg[i])); |
| 3267 | } |
| 3268 | |
| 3269 | printa(names[COLUMN], false, "END-IF"); |
| 3270 | } |
| 3271 | |
| 3272 | if (action->act_type == ACT_open) |
| 3273 | { |
| 3274 | printa(names[COLUMN], false, "END-IF"); |
| 3275 | printa(names[COLUMN], false, "END-IF"); |
| 3276 | if (gpreGlob.sw_auto) |
| 3277 | printa(names[COLUMN], false, "END-IF"); |
| 3278 | printa(names[COLUMN], false, "END-IF"); |
| 3279 | } |
| 3280 | } |
| 3281 | |
| 3282 |
no test coverage detected