[odb-users] Composing object view attribute

Boris Kolpackov boris at codesynthesis.com
Wed Apr 15 08:27:23 EDT 2015


Hi Roman,

Roman Shametko <shametko.roman at gmail.com> writes:

> So I can call A->m_parent->getPath() which gonna result in
> "/home/username/Documents/". This is the path I want to get
> in view. But I don't really understand how can I achieve this.

Neither do I. What would be an SQL SELECT-list expression that
would return such a path? If you can come up with one, then you
can embed it into the view. Obviously, an SQL database cannot
just "call" A->m_parent->getPath() ;-).


> Basically I'd be happy with following view:
> 
> #pragma db view /*some other objects*/  object(AdjacencyListItem)
> class View {
> public:
>     ...
>      std::shared_ptr<AdjacencyListItem> m_parent;
> };
> 
> But as far as I understand it's impossible to get one.

Why not? Since 2.4.0 there is support for object loading
views (Section 10.2).

Boris



More information about the odb-users mailing list