Execute a STORE statement.
| 8151 | |
| 8152 | // Execute a STORE statement. |
| 8153 | const StmtNode* StoreNode::store(thread_db* tdbb, Request* request, WhichTrigger whichTrig) const |
| 8154 | { |
| 8155 | jrd_tra* transaction = request->req_transaction; |
| 8156 | impure_state* impure = request->getImpure<impure_state>(impureOffset); |
| 8157 | |
| 8158 | const StreamType stream = target->getStream(); |
| 8159 | record_param* rpb = &request->req_rpb[stream]; |
| 8160 | jrd_rel* relation = rpb->rpb_relation; |
| 8161 | |
| 8162 | if ((marks & MARK_BULK_INSERT) || request->req_batch_mode) |
| 8163 | rpb->rpb_stream_flags |= RPB_s_bulk; |
| 8164 | |
| 8165 | const auto localTableSource = nodeAs<LocalTableSourceNode>(target); |
| 8166 | const auto localTable = localTableSource ? |
| 8167 | request->getStatement()->localTables[localTableSource->tableNumber] : |
| 8168 | nullptr; |
| 8169 | const auto localTableImpure = localTable ? localTable->getImpure(tdbb, request) : nullptr; |
| 8170 | |
| 8171 | switch (request->req_operation) |
| 8172 | { |
| 8173 | case Request::req_evaluate: |
| 8174 | if (!(marks & MARK_AVOID_COUNTERS)) |
| 8175 | { |
| 8176 | if (!nodeIs<ForNode>(parentStmt)) |
| 8177 | request->req_records_affected.clear(); |
| 8178 | |
| 8179 | request->req_records_affected.bumpModified(false); |
| 8180 | } |
| 8181 | |
| 8182 | impure->sta_state = 0; |
| 8183 | if (relation) |
| 8184 | RLCK_reserve_relation(tdbb, transaction, relation, true); |
| 8185 | break; |
| 8186 | |
| 8187 | case Request::req_return: |
| 8188 | if (!impure->sta_state) |
| 8189 | { |
| 8190 | SavepointChangeMarker scMarker(transaction); |
| 8191 | |
| 8192 | if (relation && relation->rel_pre_store && whichTrig != POST_TRIG) |
| 8193 | { |
| 8194 | EXE_execute_triggers(tdbb, &relation->rel_pre_store, NULL, rpb, |
| 8195 | TRIGGER_INSERT, PRE_TRIG); |
| 8196 | } |
| 8197 | |
| 8198 | if (validations.hasData()) |
| 8199 | validateExpressions(tdbb, validations); |
| 8200 | |
| 8201 | // For optimum on-disk record compression, zero all unassigned |
| 8202 | // fields. In addition, zero the tail of assigned varying fields |
| 8203 | // so that previous remnants don't defeat compression efficiency. |
| 8204 | |
| 8205 | // CVC: The code that was here was moved to its own routine: cleanupRpb() |
| 8206 | // and replaced by the call shown below. |
| 8207 | |
| 8208 | cleanupRpb(tdbb, rpb); |
| 8209 | |
| 8210 | if (localTableSource) |
nothing calls this directly
no test coverage detected