Bug? : Update does not work when fields are stored by ID

In a message you can store fields by name or ID. They seem to be more or less equivalent methods of identifctaion.

As desicribed int he documentation. we use the ID apporach as it is faster and more efficient.

Also for effeicency I'd like to update field in a message rather than add a new each time.

The documentation says:

If no existing field matches the specifications in the field argument, then this method adds the field to the message.

I dont think that is true for the case where the field is specified and stored by ID.

Here are 2 functions from a Unit-Test, in C++ :

I've marked in bold the important bits of code.

In the first case when name strings are used we can update "A" then "B" no problem.

But if the fields are idetified only as 10 and 20, second bold line calling updateI32("",2, (tibrv_i16) 20) fails.

The getText() returns an error: "Field id conflicts with existing field id".

void UpdateRvFieldsByName() {      TibrvMsg tMsg;      CPPUNIT_ASSERT_EQUAL( tMsg.updateI32("A",1, (tibrv_i16) 0).getText(), TibrvStatus(TIBRV_OK).getText() );      CPPUNIT_ASSERT_EQUAL( tMsg.updateI32("B",2, (tibrv_i16) 0).getText(), TibrvStatus(TIBRV_OK).getText() );      CPPUNIT_ASSERT_EQUAL( tMsg.updateI32("B",3, (tibrv_i16) 0).getText(), TibrvStatus(TIBRV_OK).getText() );        const char* tContent=NULL;      tMsg.convertToString( tContent );      CPPUNIT_ASSERT_EQUAL( std::string("{A=1 B=3}"), std::string(tContent) ); }  void UpdateRvFieldsById() {      TibrvMsg tMsg;      CPPUNIT_ASSERT_EQUAL( tMsg.updateI32("",1, (tibrv_i16) 10).getText(), TibrvStatus(TIBRV_OK).getText() );       // NEXT LINE FAILS       CPPUNIT_ASSERT_EQUAL( tMsg.updateI32("",2, (tibrv_i16) 20).getText(), TibrvStatus(TIBRV_OK).getText() );       CPPUNIT_ASSERT_EQUAL( tMsg.updateI32("",3, (tibrv_i16) 20).getText(), TibrvStatus(TIBRV_OK).getText() );       const char* tContent=NULL;      tMsg.convertToString( tContent );      CPPUNIT_ASSERT_EQUAL( std::string("{[10]=1 [20]=3}"), std::string(tContent) ); } 

So, the question is

  how can I use Update with ID based fields?<

Is this a bug?

Login