Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  26 Apr 2017, Konstantin Olchanski, Info, added db_get_value_string() 
    Reply  26 Apr 2017, Stefan Ritt, Info, added db_get_value_string() 
       Reply  02 May 2017, Konstantin Olchanski, Info, added db_get_value_string() 
    Reply  02 May 2017, Konstantin Olchanski, Info, added db_resize_string() 
Message ID: 1280     Entry time: 26 Apr 2017     Reply to this: 1282   1284
Author: Konstantin Olchanski 
Topic: Info 
Subject: added db_get_value_string() 
Since we have been regularly running into problems with db_get_xxx(TID_STRING) and string buffers of mismatched size,
I now implemented db_get_value_string(hdb, hkey, key_name, index, &string, create).

It works the same as db_get_value(TID_STRING), except that the string value is returned into an std::string object,
memory allocation is handled by std::string and there is no string length limit (other than std::string limits).

Accessing string arrays is done explicitly via an "index" parameter, if index is bigger than odb array size DB_OUT_OF_RANGE is returned
without logging an error message (e.g. db_get_data_index() will log an error). This makes is safe to iterate over array entries with a simple
loop of index from 0 and up until db_get returns an error.

As before, if the odb entry does not exist, it will be created (if create==true) and initialized with the value of the string parameter (zero-terminated in odb).

There is also newly added db_set_value_string() and cm_get_path_string(). if you want more of these, please ask, or send patches.

K.O.
ELOG V3.1.4-2e1708b5