[odb-users] AW: ODB compiler crash
Marcel Nehring
mne at qosmotec.com
Thu Sep 18 11:14:36 EDT 2014
Hi Boris,
Thank you for your answer.
Ad 1)
I will use the database name prefixes. I had already written code to map my custom types to their corresponding database types.
Ad 2)
I saw the --schema-version-table <name> option but it looked a bit too complicated for what I was trying to do. So I think I will stick to the default name. But just for curiosity, what is the rationale to force case-sensitive table names etc. in Oracle DDLs? Some tools seem to have problems with case-sensitive names.
Ad 3)
Hmm, a few days back when I tried it, it gave me an error for a non-persistent class. However, now it seems to work so this error was probably unrelated to this topic.
In addition to these three things I ran into some other problems:
4) When I persist a map ODB will generate a separate table for this mapping. But if the surrounding class is solely a wrapper around the map for insertion, deletion etc. and also a singleton I do not need a separate table. Is it somehow possible to avoid ending up with three different tables here? Two should suffice from a database point of view I think.
5) I have problems persisting nested containers. For example a map of maps. A member like std::map<int, std::map<std::string, double>> results in an ODB error message similar to: unable to map C++ type '::MyClass::MyMapTypeDef::mapped_type' used in data member 'm_member' to a Oracle database type
6) Additionally it looks like I did not yet fully understand the whole template class workaround you proposed a few messages earlier. Let's suppose I have two template classes. OuterTemplate<T> and InnerTemplate<T>. Furthermore I want OuterTemplate<T> to have a member of type std::shared_ptr<InnerTemplate<T>>. I have added typedefs for all template instantiations for both classes and each typedef has the corresponding pragmas. When running the ODB compiler for OuterTemplate.h I get the error: unable to map C++ type '::std::shared_ptr< ::InnerTemplate< int > >' used in data member 'm_member' to a Oracle database type. How can I tell ODB how to persist this class?
7) The source code attached below produces several compile errors in Visual Studio when I try to compile the code generated by ODB. Did I make a mistake or is this a bug? Looks like it can be solved by renaming the member variables to not have the same name.
Thank you very much for the support.
Regards,
Marcel
#pragma db value
class InnerValueType
{
public:
#pragma db column("")
int m_number;
};
#pragma db value
class OuterValueType
{
public:
#pragma db column("VALUE")
InnerValueType m_value;
};
#pragma db object
class PersistentObj
{
public:
#pragma db id auto
long id;
#pragma db column("")
OuterValueType m_value;
};
More information about the odb-users
mailing list