mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 00:43: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:
parent
e20c239794
commit
60dc5dd571
@ -3681,8 +3681,6 @@ static RegisterNode<ForNode> regForNode(blr_for);
|
|||||||
DmlNode* ForNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp)
|
DmlNode* ForNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, UCHAR blrOp)
|
||||||
{
|
{
|
||||||
ForNode* node = FB_NEW(pool) ForNode(pool);
|
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)
|
if (csb->csb_blr_reader.peekByte() == (UCHAR) blr_stall)
|
||||||
node->stall = PAR_parse_stmt(tdbb, csb);
|
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)
|
switch (request->req_operation)
|
||||||
{
|
{
|
||||||
case jrd_req::req_evaluate:
|
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);
|
VIO_start_save_point(tdbb, transaction);
|
||||||
const Savepoint* save_point = transaction->tra_save_point;
|
const Savepoint* save_point = transaction->tra_save_point;
|
||||||
@ -3874,9 +3874,10 @@ const StmtNode* ForNode::execute(thread_db* tdbb, jrd_req* request, ExeState* /*
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
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;
|
for (const Savepoint* save_point = transaction->tra_save_point;
|
||||||
save_point && sav_number <= save_point->sav_number;
|
save_point && sav_number <= save_point->sav_number;
|
||||||
save_point = transaction->tra_save_point)
|
save_point = transaction->tra_save_point)
|
||||||
@ -3886,6 +3887,7 @@ const StmtNode* ForNode::execute(thread_db* tdbb, jrd_req* request, ExeState* /*
|
|||||||
}
|
}
|
||||||
cursor->close(tdbb);
|
cursor->close(tdbb);
|
||||||
return parentStmt;
|
return parentStmt;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fb_assert(false); // unreachable code
|
fb_assert(false); // unreachable code
|
||||||
|
@ -707,7 +707,6 @@ public:
|
|||||||
dsqlCursor(NULL),
|
dsqlCursor(NULL),
|
||||||
dsqlLabel(NULL),
|
dsqlLabel(NULL),
|
||||||
dsqlForceSingular(false),
|
dsqlForceSingular(false),
|
||||||
needSavePoint(false),
|
|
||||||
stall(NULL),
|
stall(NULL),
|
||||||
rse(NULL),
|
rse(NULL),
|
||||||
statement(NULL),
|
statement(NULL),
|
||||||
@ -731,7 +730,6 @@ public:
|
|||||||
dsql_nod* dsqlCursor;
|
dsql_nod* dsqlCursor;
|
||||||
dsql_nod* dsqlLabel;
|
dsql_nod* dsqlLabel;
|
||||||
bool dsqlForceSingular;
|
bool dsqlForceSingular;
|
||||||
bool needSavePoint;
|
|
||||||
NestConst<StmtNode> stall;
|
NestConst<StmtNode> stall;
|
||||||
NestConst<RseNode> rse;
|
NestConst<RseNode> rse;
|
||||||
NestConst<StmtNode> statement;
|
NestConst<StmtNode> statement;
|
||||||
|
@ -426,7 +426,6 @@ class CompilerScratch : public pool_alloc<type_csb>
|
|||||||
csb_map_field_info(p),
|
csb_map_field_info(p),
|
||||||
csb_map_item_info(p),
|
csb_map_item_info(p),
|
||||||
csb_domain_validation(domain_validation),
|
csb_domain_validation(domain_validation),
|
||||||
csb_for_nodes(0),
|
|
||||||
csb_rpt(p, len)
|
csb_rpt(p, len)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@ -512,7 +511,6 @@ public:
|
|||||||
USHORT csb_view_stream;
|
USHORT csb_view_stream;
|
||||||
bool csb_validate_expr;
|
bool csb_validate_expr;
|
||||||
USHORT csb_remap_variable;
|
USHORT csb_remap_variable;
|
||||||
int csb_for_nodes;
|
|
||||||
|
|
||||||
struct csb_repeat
|
struct csb_repeat
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user