[odb-users] Persist Google's Protocol Buffers...

Alon Moshayov alon.moshayov at myheritage.com
Tue Jan 28 10:18:57 EST 2014


Boris,
Thanks a lot for your response ...

I'm now trying to compile a protocol buffer source header with ODB complier
and facing several mapping issues of:

   - ::google::protobuf::UnknownFieldSet
   - ::std::string*
   - ::google::protobuf::RepeatedPtrField
   - ::google::protobuf::uint32 _has_bits_[(9 + 31) / 32]


How should I map these types into ODB (SQLite) corresponding ones
Alon...




On Tue, Jan 28, 2014 at 6:32 AM, Boris Kolpackov <boris at codesynthesis.com>wrote:

> Hi Alon,
>
> Alon Moshayov <alon.moshayov at myheritage.com> writes:
>
> > I'm looking for an ability to persist Google's Protocol Buffers with
> > ODB to SQLite database.
> > Does ODB capable to accept protocol classes and generate corresponding
> > database support code?
>
> I believe several people tried this and it is possible. You will need
> to map the generated protobuffer classes for ODB. That is, specify
> which classes are persistent, what are their ids, etc. This can be
> done completely unintrusively (so you don't need to modify the
> generated files), as described at the beginning of Chapter 14,
> "ODB Pragma Language".
>
> Also, the recently added support for automatic discovery of suitable
> accessors and modifiers should make this mapping really easy. In most
> cases I would expect all you need to do is have two pragmas like these
> for each persistent class:
>
> #pragma db object(Foo)
> #pragma db member(Foo:id) id
>
> Also, here is a previous thread on the same topic with some more
> background information (note that the virtual data members feature
> mentioned there is now supported):
>
> http://www.codesynthesis.com/pipermail/odb-users/2011-October/000352.html
>
> Boris
>


More information about the odb-users mailing list