dbTalk Databases Forums  

Converting between 64 and 32 bit data

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


Discuss Converting between 64 and 32 bit data in the comp.databases.berkeley-db forum.



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

Default Converting between 64 and 32 bit data - 07-12-2005 , 02:18 AM






Hi, I use BDB in my app and it works fine on both 32 and 64 bit
architecture. The same code compiles and runs without trouble on both
platforms.

Is there a way to convert data produced on the 64 bit machine with the
64 bit version into data that can be used by the 32 bit version on the
32 bit platform? Some utility or whatever? Or is there a painless way
to tweak the 64 bit version so that it produces data compatible with a
32 bit platform?

Thanks,
Erik


Reply With Quote
  #2  
Old   
ErikArner
 
Posts: n/a

Default Re: Converting between 64 and 32 bit data - 07-12-2005 , 02:39 AM






Sorry, I guess I wasn't RTFM properly... I should be able to use
db_dump and db_load for this problem, right?

Thanks,
Erik


Reply With Quote
  #3  
Old   
Patrick Schaaf
 
Posts: n/a

Default Re: Converting between 64 and 32 bit data - 07-12-2005 , 03:24 AM



"ErikArner" <erik_arner (AT) hotmail (DOT) com> writes:

Quote:
Is there a way to convert data produced on the 64 bit machine with the
64 bit version into data that can be used by the 32 bit version on the
32 bit platform?
Data is solely your responsibility. As it were if you were implementing
networking between a 32 bit and a 64 bit machine. Proceed in the same
way: standarize on a format for the external representation, and
write conversion code of that representation into native format.

External representations can be chosen in a variety of ways.
I think the most modern one is XML, if you don't care much
about conversion efficiency. The lazy approach is to use
the 32-bit struct format, and write a single (bothway)
conversion function, used solely on the 64-bit system.

As far as I know, none of this is "automatic", i.e. you have to
write the correct code before you ->put, and after you ->get,
from the database.

Of course, suitable modularization and/or class structure can hide
all conversions under the rug.

Quote:
Or is there a painless way to tweak the 64 bit version so that it
produces data compatible with a 32 bit platform?
If your data is any kind of structured thing: no.

best regards
Patrick


Reply With Quote
  #4  
Old   
ErikArner
 
Posts: n/a

Default Re: Converting between 64 and 32 bit data - 07-12-2005 , 04:36 AM



Thanks!

Actually I don't need to store any 64 bit data, it's just that I want
the DB files to work on both systems regardless of where they were
created. So I tweaked the code to only store 32 bit data and now
everything works like a charm.

Cheers,
Erik


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.