| 1396 | // |
| 1397 | |
| 1398 | static void gen_compile( const act* action) |
| 1399 | { |
| 1400 | const gpre_req* request = action->act_request; |
| 1401 | const gpre_dbb* db = request->req_database; |
| 1402 | const gpre_sym* symbol = db->dbb_name; |
| 1403 | |
| 1404 | // generate automatic ready if appropriate |
| 1405 | |
| 1406 | if (gpreGlob.sw_auto) |
| 1407 | t_start_auto(request, status_vector(action), action, true); |
| 1408 | |
| 1409 | // always generate a compile, a test for the success of the compile, |
| 1410 | // and an end to the 'if not compiled test |
| 1411 | |
| 1412 | // generate an 'if not compiled' |
| 1413 | |
| 1414 | printa(names[COLUMN], false, "IF %s = 0 THEN", request->req_handle); |
| 1415 | |
| 1416 | if (gpreGlob.sw_auto && action->act_error) |
| 1417 | printa(names[COLUMN], false, "IF %s NOT = 0 THEN", request_trans(action, request)); |
| 1418 | // Never use isc_compile_request2 here because if the request is |
| 1419 | // generated in a subprogram and that subprogram is subsequently CANCELed |
| 1420 | // the buffer containing the request handle will be freed. This will cause |
| 1421 | // the main program to abort when detaching from the database. It can also |
| 1422 | // cause other difficult to find memory corruption problems. This implies |
| 1423 | // that the user must issue a RELEASE_REQUESTS request before exiting any |
| 1424 | // subprogram in order to clean up its handles. |
| 1425 | sprintf(output_buffer, "%sCALL \"%s\" USING %s, %s, %s, %d, %s%d\n", |
| 1426 | names[COLUMN], ISC_COMPILE_REQUEST, |
| 1427 | status_vector(action), symbol->sym_string, |
| 1428 | request->req_handle, request->req_length, |
| 1429 | names[isc_a_pos], request->req_ident); |
| 1430 | |
| 1431 | RMC_print_buffer(output_buffer, true); |
| 1432 | if (gpreGlob.sw_auto && action->act_error) |
| 1433 | printa(names[COLUMN], false, "END-IF"); |
| 1434 | |
| 1435 | set_sqlcode(action); |
| 1436 | printa(names[COLUMN], false, "END-IF"); |
| 1437 | |
| 1438 | // If blobs are present, zero out all of the blob handles. After this |
| 1439 | // point, the handles are the user's responsibility |
| 1440 | |
| 1441 | for (const blb* blob = request->req_blobs; blob; blob = blob->blb_next) |
| 1442 | { |
| 1443 | sprintf(output_buffer, "%sMOVE 0 TO %s%d\n", |
| 1444 | names[COLUMN], names[isc_a_pos], blob->blb_ident); |
| 1445 | |
| 1446 | RMC_print_buffer(output_buffer, false); |
| 1447 | } |
| 1448 | } |
| 1449 | |
| 1450 | |
| 1451 | //____________________________________________________________ |
no test coverage detected