mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 07:23:04 +01:00
This should fix CORE-5241 (Affected rows are not counted for some update
operations with views). Old hacks are not actual these days.
This commit is contained in:
parent
1b73df27fc
commit
9f3a0095e7
@ -2426,23 +2426,7 @@ const StmtNode* EraseNode::erase(thread_db* tdbb, jrd_req* request, WhichTrigger
|
||||
if (!relation->rel_file && !relation->rel_view_rse && !relation->isVirtual())
|
||||
IDX_erase(tdbb, rpb, transaction);
|
||||
|
||||
// CVC: Increment the counter only if we called VIO/EXT_erase() and we were successful.
|
||||
if (!(request->req_view_flags & req_first_erase_return))
|
||||
{
|
||||
request->req_view_flags |= req_first_erase_return;
|
||||
if (relation->rel_view_rse)
|
||||
request->req_top_view_erase = relation;
|
||||
}
|
||||
|
||||
if (relation == request->req_top_view_erase)
|
||||
{
|
||||
if (whichTrig == ALL_TRIGS || whichTrig == POST_TRIG)
|
||||
{
|
||||
request->req_records_deleted++;
|
||||
request->req_records_affected.bumpModified(true);
|
||||
}
|
||||
}
|
||||
else if (relation->rel_file || !relation->rel_view_rse)
|
||||
if (!relation->rel_view_rse || (whichTrig == ALL_TRIGS || whichTrig == POST_TRIG))
|
||||
{
|
||||
request->req_records_deleted++;
|
||||
request->req_records_affected.bumpModified(true);
|
||||
@ -6175,25 +6159,8 @@ const StmtNode* ModifyNode::modify(thread_db* tdbb, jrd_req* request, WhichTrigg
|
||||
if (!relation->rel_file && !relation->rel_view_rse && !relation->isVirtual())
|
||||
IDX_modify_check_constraints(tdbb, orgRpb, newRpb, transaction);
|
||||
|
||||
// CVC: Increment the counter only if we called VIO/EXT_modify() and
|
||||
// we were successful.
|
||||
if (!(request->req_view_flags & req_first_modify_return))
|
||||
{
|
||||
request->req_view_flags |= req_first_modify_return;
|
||||
|
||||
if (relation->rel_view_rse)
|
||||
request->req_top_view_modify = relation;
|
||||
}
|
||||
|
||||
if (relation == request->req_top_view_modify)
|
||||
{
|
||||
if (!subMod && (whichTrig == ALL_TRIGS || whichTrig == POST_TRIG))
|
||||
{
|
||||
request->req_records_updated++;
|
||||
request->req_records_affected.bumpModified(true);
|
||||
}
|
||||
}
|
||||
else if (relation->rel_file || !relation->rel_view_rse)
|
||||
if (!relation->rel_view_rse ||
|
||||
(!subMod && (whichTrig == ALL_TRIGS || whichTrig == POST_TRIG)))
|
||||
{
|
||||
request->req_records_updated++;
|
||||
request->req_records_affected.bumpModified(true);
|
||||
@ -7013,23 +6980,8 @@ const StmtNode* StoreNode::store(thread_db* tdbb, jrd_req* request, WhichTrigger
|
||||
TRIGGER_INSERT, POST_TRIG);
|
||||
}
|
||||
|
||||
// CVC: Increment the counter only if we called VIO/EXT_store() and we were successful.
|
||||
if (!(request->req_view_flags & req_first_store_return))
|
||||
{
|
||||
request->req_view_flags |= req_first_store_return;
|
||||
if (relation->rel_view_rse)
|
||||
request->req_top_view_store = relation;
|
||||
}
|
||||
|
||||
if (relation == request->req_top_view_store)
|
||||
{
|
||||
if (!subStore && (whichTrig == ALL_TRIGS || whichTrig == POST_TRIG))
|
||||
{
|
||||
request->req_records_inserted++;
|
||||
request->req_records_affected.bumpModified(true);
|
||||
}
|
||||
}
|
||||
else if (relation->rel_file || !relation->rel_view_rse)
|
||||
if (!relation->rel_view_rse ||
|
||||
(!subStore && (whichTrig == ALL_TRIGS || whichTrig == POST_TRIG)))
|
||||
{
|
||||
request->req_records_inserted++;
|
||||
request->req_records_affected.bumpModified(true);
|
||||
|
@ -888,13 +888,6 @@ void EXE_start(thread_db* tdbb, jrd_req* request, jrd_tra* transaction)
|
||||
|
||||
request->req_records_affected.clear();
|
||||
|
||||
// CVC: set up to count virtual operations on SQL views.
|
||||
|
||||
request->req_view_flags = 0;
|
||||
request->req_top_view_store = NULL;
|
||||
request->req_top_view_modify = NULL;
|
||||
request->req_top_view_erase = NULL;
|
||||
|
||||
// Store request start time for timestamp work
|
||||
request->req_timestamp.validate();
|
||||
|
||||
|
@ -240,11 +240,6 @@ public:
|
||||
RuntimeStatistics req_base_stats;
|
||||
AffectedRows req_records_affected; // records affected by the last statement
|
||||
|
||||
USHORT req_view_flags; // special flags for virtual ops on views
|
||||
jrd_rel* req_top_view_store; // the top view in store(), if any
|
||||
jrd_rel* req_top_view_modify; // the top view in modify(), if any
|
||||
jrd_rel* req_top_view_erase; // the top view in erase(), if any
|
||||
|
||||
const StmtNode* req_next; // next node for execution
|
||||
EDS::Statement* req_ext_stmt; // head of list of active dynamic statements
|
||||
Firebird::Array<const Cursor*> req_cursors; // named cursors
|
||||
@ -311,13 +306,6 @@ const ULONG req_proc_fetch = 0x200L; // Fetch from procedure in progress
|
||||
const ULONG req_same_tx_upd = 0x400L; // record was updated by same transaction
|
||||
const ULONG req_reserved = 0x800L; // Request reserved for client
|
||||
|
||||
// Flags for req_view_flags
|
||||
enum {
|
||||
req_first_store_return = 0x1,
|
||||
req_first_modify_return = 0x2,
|
||||
req_first_erase_return = 0x4
|
||||
};
|
||||
|
||||
|
||||
// Index lock block
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user