dbTalk Databases Forums  

Re: C++ Objects in DB

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Re: C++ Objects in DB in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris Newcombe
 
Posts: n/a

Default Re: C++ Objects in DB - 08-11-2003 , 12:40 PM






"Bogdan Sarbu" <bcs (AT) sarnet (DOT) dk> wrote

Quote:
What should I do to store C++ objects in the Berkeley DB?
Berkeley DB simply stores arbitrary chunks of binary data, so your
application needs to serialize/marshal your C++ objects into that
form.

There are various ways to do this, each with its own
convenience/speed/data-size/complexity tradeoffs. Or you can roll
your own (we did, as it's such a critical layer). I'd recommend
searching on ASN.1, YAML, XML object persistence, C++ persistence,
etc. Also, I think someone at www.boost.org is working on a
persistence library but I'm not sure if it's done yet or just in the
discussion phase.

Chris


Reply With Quote
  #2  
Old   
Bogdan Sarbu
 
Posts: n/a

Default Re: C++ Objects in DB - 08-11-2003 , 05:57 PM






Chris, thank for your reply.
I´m new to this stuff and want a better understanding.
Just to get this right: I can store records, containing a key/data pair, in
the DB. Where the data item is a binary string of an arbitrary lenght,
right? So I have to serialize my objects to a binary string and save the
string as the data item?

/Bogdan



"Chris Newcombe" <chrisn (AT) valvesoftware (DOT) com> wrote

Quote:
Berkeley DB simply stores arbitrary chunks of binary data, so your
application needs to serialize/marshal your C++ objects into that
form.

There are various ways to do this, each with its own
convenience/speed/data-size/complexity tradeoffs. Or you can roll
your own (we did, as it's such a critical layer). I'd recommend
searching on ASN.1, YAML, XML object persistence, C++ persistence,
etc. Also, I think someone at www.boost.org is working on a
persistence library but I'm not sure if it's done yet or just in the
discussion phase.

Chris



Reply With Quote
  #3  
Old   
Hans-Bernhard Broeker
 
Posts: n/a

Default Re: C++ Objects in DB - 08-12-2003 , 06:11 AM



Bogdan Sarbu <bcs (AT) sarnet (DOT) dk> wrote:

Quote:
So I have to serialize my objects to a binary string and save the
string as the data item?
You don't strictly *have*to* do it that way, but yes, that's the usual
way you would do it.

The task becomes rather "interesting" once you want to serialize
objects that contain pointers to each other. This is a rather
interesting field of its own, but not really the business of this
particular newsgroup.
--
Hans-Bernhard Broeker (broeker (AT) physik (DOT) rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.