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

Fixed the INSERT INTO ... SELECT bug reported by Ivan Prenosil in fb-devel.

This commit is contained in:
asfernandes 2011-07-25 01:40:29 +00:00
parent c1da0c0e8a
commit 93aa34bddb
2 changed files with 25 additions and 0 deletions

View File

@ -199,6 +199,30 @@ namespace Firebird {
Stack<Object, Capacity>& stack;
};
// Restore the stack when we go out of scope.
class AutoRestore
{
public:
AutoRestore(Stack<Object, Capacity>& s)
: stack(s),
count(s.getCount())
{
}
~AutoRestore()
{
size_t currentCount = stack.getCount();
fb_assert(currentCount >= count);
while (currentCount-- > count)
stack.pop();
}
private:
Stack<Object, Capacity>& stack;
size_t count;
};
class iterator;
friend class iterator;

View File

@ -5497,6 +5497,7 @@ DmlNode* StoreNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* cs
StmtNode* StoreNode::internalDsqlPass(DsqlCompilerScratch* dsqlScratch, bool updateOrInsert)
{
thread_db* tdbb = JRD_get_thread_data();
DsqlContextStack::AutoRestore autoContext(*dsqlScratch->context);
dsqlScratch->getStatement()->setType(DsqlCompiledStatement::TYPE_INSERT);