Skip to content

Commit 2c322e6

Browse files
committed
Bug #29402443: COLLECTIONMODIFY METHODS CAUSE RE-PREPARE IN 1ST EXECUTE.
Fix table.update().set() calling to same field.
1 parent 457a6fc commit 2c322e6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

common/op_impl.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2315,13 +2315,15 @@ class Op_collection_modify
23152315
void add_operation(typename Impl::Operation op,
23162316
const string &field) override
23172317
{
2318+
set_prepare_state(PS_EXECUTE);
23182319
m_update.emplace_back(op, field);
23192320
}
23202321

23212322
void add_operation(typename Impl::Operation op,
23222323
const string &field,
23232324
const Value &val) override
23242325
{
2326+
set_prepare_state(PS_EXECUTE);
23252327
m_update.emplace_back(op, field, val);
23262328
}
23272329

@@ -2334,12 +2336,15 @@ class Op_collection_modify
23342336
const string &field,
23352337
cdk::Expression &expr)
23362338
{
2339+
set_prepare_state(PS_EXECUTE);
23372340
m_update.emplace_back(op, field, expr);
23382341
}
23392342

23402343

23412344
void clear_modifications() override
23422345
{
2346+
if (m_update.size() != 0)
2347+
set_prepare_state(PS_EXECUTE);
23432348
m_update.clear();
23442349
}
23452350

@@ -2742,7 +2747,12 @@ class Op_table_update
27422747

27432748
void add_set(const string &field, const Value &val) override
27442749
{
2745-
m_set_values.emplace(field, val);
2750+
auto el = m_set_values.emplace(field, val);
2751+
//substitute if exists
2752+
if (!el.second)
2753+
{
2754+
el.first->second = val;
2755+
}
27462756
Base::set_prepare_state(PS_EXECUTE);
27472757
}
27482758

0 commit comments

Comments
 (0)