| 832 | |
| 833 | |
| 834 | void EXE_start(thread_db* tdbb, Request* request, jrd_tra* transaction) |
| 835 | { |
| 836 | /************************************** |
| 837 | * |
| 838 | * E X E _ s t a r t |
| 839 | * |
| 840 | ************************************** |
| 841 | * |
| 842 | * Functional description |
| 843 | * Start an execution running. |
| 844 | * |
| 845 | **************************************/ |
| 846 | SET_TDBB(tdbb); |
| 847 | |
| 848 | BLKCHK(request, type_req); |
| 849 | BLKCHK(transaction, type_tra); |
| 850 | |
| 851 | if (request->req_flags & req_active) |
| 852 | ERR_post(Arg::Gds(isc_req_sync) << Arg::Gds(isc_reqinuse)); |
| 853 | |
| 854 | if (transaction->tra_flags & TRA_prepared) |
| 855 | ERR_post(Arg::Gds(isc_req_no_trans)); |
| 856 | |
| 857 | const auto dbb = tdbb->getDatabase(); |
| 858 | const auto statement = request->getStatement(); |
| 859 | |
| 860 | // Generate request id. |
| 861 | request->setRequestId( |
| 862 | request->isRequestIdUnassigned() && request->isRoot() ? |
| 863 | statement->getStatementId() : |
| 864 | dbb->generateStatementId()); |
| 865 | |
| 866 | /* Post resources to transaction block. In particular, the interest locks |
| 867 | on relations/indices are copied to the transaction, which is very |
| 868 | important for (short-lived) dynamically compiled requests. This will |
| 869 | provide transaction stability by preventing a relation from being |
| 870 | dropped after it has been referenced from an active transaction. */ |
| 871 | |
| 872 | TRA_post_resources(tdbb, transaction, statement->resources); |
| 873 | |
| 874 | TRA_attach_request(transaction, request); |
| 875 | request->req_flags &= req_in_use | req_restart_ready; |
| 876 | request->req_flags |= req_active; |
| 877 | request->req_flags &= ~req_reserved; |
| 878 | |
| 879 | // set up to count records affected by request |
| 880 | |
| 881 | request->req_records_selected = 0; |
| 882 | request->req_records_updated = 0; |
| 883 | request->req_records_inserted = 0; |
| 884 | request->req_records_deleted = 0; |
| 885 | |
| 886 | request->req_records_affected.clear(); |
| 887 | |
| 888 | for (auto& rpb : request->req_rpb) |
| 889 | rpb.rpb_runtime_flags = 0; |
| 890 | |
| 891 | request->req_profiler_ticks = 0; |
no test coverage detected