in reply to Not a DBengine Question.
Sorry.
In fact I came up with an interesting cautionary example.
Consider DB_File. It allows you to create (among other things) a hash or BTree with a custom hashing or comparison function. Well one of the nice things about a BTree is that it is trivial to get keys to come back in sorted order. So use the following neat order:
What does this do? It sorts in a locale-specific order. So if you are in Europe and have a few characters not in ASCII, it sorts them correctly.sub { use locale; $_[0] cmp $_[1]; }
Now the point? There is no external tool which can guess this binary format. In fact all of the standard tools from Sleepycat will mess up on this. And better than that, if some user changes their locale then edits the data? Instant undetectible database corruption!
(This is not just a problem for BerkeleyDB of course, many programs with binary formats are susceptible to the same problem. For instance a C++ program using the Roguewave string library can hit similar issues.)
Which goes to show why it is important to make sure that you have backups of data in a *portable* format...
|
|---|