[odb-users] Inconsistent column names?

Marcel Nehring mne at qosmotec.com
Mon Aug 24 08:32:37 EDT 2015


Hi,

as of the ODB manual I can specify custom column names for composite value types (see chapter 7.2.2). The examples provided in this chapter also show that if I provide a custom prefix and want it to be separated from the suffix I would have to provide the separator (e.g. if I want my column to be named "person_first_name" my prefix need to be "person_"). However, if the corresponding value type inherits members from a parent class ODB automatically appends an underscore to my prefix for that inherited member but not for the other members.

Don't get me wrong, this does not cause any problems in the resulting code. Also I don't end up with a double underscore if I provide one in my custom prefix. However this behavior does look a bit odd so I thought I would report it in case it is not what ODB is supposed to do.

As always example code is attached below. It will produce column names as "PREFIXINNER_VALUE" and "PREFIX_PARENT".

Regards,
                Marcel



#pragma db value
class InnerValue
{
public:
    int m_value;
};

#pragma db value
class ParentOuter
{
public:
    int parent;
};

#pragma db value
class OuterValue : public ParentOuter
{
public:
    InnerValue m_inner;
};

#pragma db object
class Object
{
public:
    #pragma db id
    int m_id;

    #pragma db column("PREFIX")
    OuterValue m_outer;
};


More information about the odb-users mailing list