void GEN_release() { /************************************** * * G E N _ r e l e a s e * ************************************** * * Functional description * Release any compiled requests following execution or abandonment * of a request. Just recurse around and release requests. * **************************************/ for (; QLI_requests; QLI_requests = QLI_requests->req_next) { if (QLI_requests->req_handle) { ISC_STATUS_ARRAY status_vector; isc_release_request(status_vector, &QLI_requests->req_handle); } qli_rlb* rlb = QLI_requests->req_blr; GEN_rlb_release (rlb); } }
// Since this code appears everywhere, it makes more sense to isolate it // in a function visible to all gbak components. // Given a request, if it's non-zero (compiled), deallocate it but // without caring about a possible error. void MISC_release_request_silent(isc_req_handle& req_handle) { if (req_handle) { ISC_STATUS_ARRAY req_status; isc_release_request(req_status, &req_handle); } }
EXPORT RM_ENTRY(rmc_release_request) { ClearParamPool(); ISC_STATUS *stat = AllocStatusPool(); isc_release_request(stat, (isc_req_handle *)arg_vector[1].a_address); StatusToCobol(&arg_vector[0], stat); return (0); }
static USHORT get_capabilities(ISC_STATUS* user_status) { struct isc_4_struct { short isc_5; /* isc_utility */ } isc_4; struct isc_1_struct { char isc_2 [32]; /* RDB$FIELD_NAME */ char isc_3 [32]; /* RDB$RELATION_NAME */ } isc_1; USHORT capabilities = CAP_none; AliceGlobals* tdgbl = AliceGlobals::getSpecific(); // Look for desired fields in system relations FB_API_HANDLE req = 0; for (const rfr_tab_t* rel_field_table = rfr_table; rel_field_table->relation; rel_field_table++) { /*FOR(REQUEST_HANDLE req) x IN DB.RDB$RELATION_FIELDS WITH x.RDB$RELATION_NAME = rel_field_table->relation AND x.RDB$FIELD_NAME = rel_field_table->field*/ { if (!req) isc_compile_request (isc_status, (FB_API_HANDLE*) &DB, (FB_API_HANDLE*) &req, (short) sizeof(isc_0), (char*) isc_0); isc_vtov ((const char*) rel_field_table->field, (char*) isc_1.isc_2, 32); isc_vtov ((const char*) rel_field_table->relation, (char*) isc_1.isc_3, 32); if (req) isc_start_and_send (isc_status, (FB_API_HANDLE*) &req, (FB_API_HANDLE*) &gds_trans, (short) 0, (short) 64, &isc_1, (short) 0); if (!isc_status [1]) { while (1) { isc_receive (isc_status, (FB_API_HANDLE*) &req, (short) 1, (short) 2, &isc_4, (short) 0); if (!isc_4.isc_5 || isc_status [1]) break; capabilities |= rel_field_table->bit_mask; /*END_FOR*/ } }; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } } isc_release_request(gds_status, &req); if (gds_status[1]) { return_error(user_status); } return capabilities; }
tdr* MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id) { struct isc_9_struct { ISC_QUAD isc_10; /* RDB$TRANSACTION_DESCRIPTION */ short isc_11; /* isc_utility */ } isc_9; struct isc_7_struct { ISC_LONG isc_8; /* RDB$TRANSACTION_ID */ } isc_7; FB_API_HANDLE request = 0; tdr* trans = NULL; AliceGlobals* tdgbl = AliceGlobals::getSpecific(); if (!(DB = handle)) return 0; /*START_TRANSACTION*/ { { isc_start_transaction (isc_status, (FB_API_HANDLE*) &gds_trans, (short) 1, &DB, (short) 0, (char*) 0); }; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } const USHORT capabilities = get_capabilities(user_status); if (capabilities & CAP_transactions) { /*FOR(REQUEST_HANDLE request) TRA IN RDB$TRANSACTIONS WITH TRA.RDB$TRANSACTION_ID = id AND TRA.RDB$TRANSACTION_DESCRIPTION NOT MISSING*/ { if (!request) isc_compile_request (isc_status, (FB_API_HANDLE*) &DB, (FB_API_HANDLE*) &request, (short) sizeof(isc_6), (char*) isc_6); isc_7.isc_8 = id; if (request) isc_start_and_send (isc_status, (FB_API_HANDLE*) &request, (FB_API_HANDLE*) &gds_trans, (short) 0, (short) 4, &isc_7, (short) 0); if (!isc_status [1]) { while (1) { isc_receive (isc_status, (FB_API_HANDLE*) &request, (short) 1, (short) 10, &isc_9, (short) 0); if (!isc_9.isc_11 || isc_status [1]) break; trans = get_description(&/*TRA.RDB$TRANSACTION_DESCRIPTION*/ isc_9.isc_10); /*END_FOR*/ } }; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } isc_release_request(gds_status, &request); if (gds_status[1]) { return_error(user_status); } } /*ROLLBACK*/ { isc_rollback_transaction (isc_status, (FB_API_HANDLE*) &gds_trans);; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } if (trans) trans->tdr_db_caps = capabilities; return trans; }
void MET_get_state(ISC_STATUS* user_status, tdr* trans) { struct isc_15_struct { short isc_16; /* isc_utility */ short isc_17; /* RDB$TRANSACTION_STATE */ } isc_15; struct isc_13_struct { ISC_LONG isc_14; /* RDB$TRANSACTION_ID */ } isc_13; FB_API_HANDLE request = 0; AliceGlobals* tdgbl = AliceGlobals::getSpecific(); if (!(DB = trans->tdr_db_handle) || !(trans->tdr_db_caps & CAP_transactions)) { trans->tdr_state = TRA_unknown; return; } /*START_TRANSACTION*/ { { isc_start_transaction (isc_status, (FB_API_HANDLE*) &gds_trans, (short) 1, &DB, (short) 0, (char*) 0); }; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } /*FOR(REQUEST_HANDLE request) TRA IN RDB$TRANSACTIONS WITH TRA.RDB$TRANSACTION_ID = trans->tdr_id*/ { if (!request) isc_compile_request (isc_status, (FB_API_HANDLE*) &DB, (FB_API_HANDLE*) &request, (short) sizeof(isc_12), (char*) isc_12); isc_13.isc_14 = trans->tdr_id; if (request) isc_start_and_send (isc_status, (FB_API_HANDLE*) &request, (FB_API_HANDLE*) &gds_trans, (short) 0, (short) 4, &isc_13, (short) 0); if (!isc_status [1]) { while (1) { isc_receive (isc_status, (FB_API_HANDLE*) &request, (short) 1, (short) 4, &isc_15, (short) 0); if (!isc_15.isc_16 || isc_status [1]) break; trans->tdr_state = /*TRA.RDB$TRANSACTION_STATE*/ isc_15.isc_17; /*END_FOR*/ } }; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } isc_release_request(gds_status, &request); if (gds_status[1]) { return_error(user_status); } /*ROLLBACK*/ { isc_rollback_transaction (isc_status, (FB_API_HANDLE*) &gds_trans);; /*ON_ERROR*/ if (isc_status [1]) { return_error(user_status); /*END_ERROR;*/ } } }
ISC_STATUS API_ROUTINE gds__release_request(ISC_STATUS * status_vector, FB_API_HANDLE* req_handle) { return isc_release_request(status_vector, req_handle); }