8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 21:23:03 +01:00

Additional patch for CORE-3362 : Cursors should ignore changes made by the same statement

Better (i hope) fix for implicit cursors stability in PSQL
This commit is contained in:
hvlad 2011-03-08 09:05:28 +00:00
parent e20c239794
commit 60dc5dd571
3 changed files with 7 additions and 9 deletions

View File

@ -3681,8 +3681,6 @@ static RegisterNode<ForNode> regForNode(blr_for);
DmlNode* ForNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp)
{
ForNode* node = FB_NEW(pool) ForNode(pool);
csb->csb_for_nodes++;
node->needSavePoint = (csb->csb_for_nodes > 1);
if (csb->csb_blr_reader.peekByte() == (UCHAR) blr_stall)
node->stall = PAR_parse_stmt(tdbb, csb);
@ -3834,7 +3832,9 @@ const StmtNode* ForNode::execute(thread_db* tdbb, jrd_req* request, ExeState* /*
switch (request->req_operation)
{
case jrd_req::req_evaluate:
if (needSavePoint && (transaction != sysTransaction))
*request->getImpure<SLONG>(impureOffset) = 0;
if (transaction != sysTransaction &&
transaction->tra_save_point && transaction->tra_save_point->sav_verb_actions)
{
VIO_start_save_point(tdbb, transaction);
const Savepoint* save_point = transaction->tra_save_point;
@ -3874,9 +3874,10 @@ const StmtNode* ForNode::execute(thread_db* tdbb, jrd_req* request, ExeState* /*
}
default:
if (needSavePoint && (transaction != sysTransaction))
{
const SLONG sav_number = *request->getImpure<SLONG>(impureOffset);
if (sav_number)
{
const SLONG sav_number = *request->getImpure<SLONG>(impureOffset);
for (const Savepoint* save_point = transaction->tra_save_point;
save_point && sav_number <= save_point->sav_number;
save_point = transaction->tra_save_point)
@ -3886,6 +3887,7 @@ const StmtNode* ForNode::execute(thread_db* tdbb, jrd_req* request, ExeState* /*
}
cursor->close(tdbb);
return parentStmt;
}
}
fb_assert(false); // unreachable code

View File

@ -707,7 +707,6 @@ public:
dsqlCursor(NULL),
dsqlLabel(NULL),
dsqlForceSingular(false),
needSavePoint(false),
stall(NULL),
rse(NULL),
statement(NULL),
@ -731,7 +730,6 @@ public:
dsql_nod* dsqlCursor;
dsql_nod* dsqlLabel;
bool dsqlForceSingular;
bool needSavePoint;
NestConst<StmtNode> stall;
NestConst<RseNode> rse;
NestConst<StmtNode> statement;

View File

@ -426,7 +426,6 @@ class CompilerScratch : public pool_alloc<type_csb>
csb_map_field_info(p),
csb_map_item_info(p),
csb_domain_validation(domain_validation),
csb_for_nodes(0),
csb_rpt(p, len)
{}
@ -512,7 +511,6 @@ public:
USHORT csb_view_stream;
bool csb_validate_expr;
USHORT csb_remap_variable;
int csb_for_nodes;
struct csb_repeat
{