Home Help Center

Freeze, Berkeley DB and SQL

Nis BaggesenNis Baggesen Member ✭✭✭
Freeze is a nice persistence tool which definately very easy to use.

However I've seen in another thread that Freeze/Berkeley DB is not suitable for any kind of advance searches etc. which is fair enough.

I assume that there is no way to make Freeze use another database format that would allow directly for such searches?

So for the actual question - There are at least some version of MySQL that use Berkely DB as their underlying storage format, so I was wondering if it would be possibly to use such a MySQL frontend to examine and search the databases generated by Freeze. I assume not, but I thought I might as well ask.

I know I could simply not use freeze and make my own database persistence engine, but the I would loose all the benefits of being able to use the slice data defintions I already have, and would have to maintain two seperate data definitions etc.

mvh

Nis Haller Baggesen

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    A version of Freeze that uses SQL databases (including MySQL) is on our todo list. However, I can't give you any release date yet. If you have an urgent (commercial) need for Freeze/SQL, please contact us at [email protected].
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    I also depends what you mean by "advance searches".

    You can associate indices with Freeze Evictors and Freeze Maps, which provides efficient lookups using secondary keys (one key at a time). More sophisticated searches would probably require a query language, such as the JDO Query Language.

    The format used by MySQL and Freeze are different, so you could not read Berkeley DB files created by Freeze with MySQL.

    Cheers,
    Bernard
  • Nis BaggesenNis Baggesen Member ✭✭✭
    Thanks for the answers. I think secondary keys and FreezeScript work for us for now, but we may contact you regarding the SQL version of Freeze.

    I have another question regarding Freeze.

    Say I have:

    class A {...}

    dictionary<string,A> DictA

    class B {
    DictA dict
    .....
    }

    And some FreezeMaps map<string,B> called dbB and map<string,A> called dbA - Ie I want databases both for Bs (which may contain As) and for As alone.

    Is there any way (It may involve extending the definitions of the maps or A or B, or whatever it may take), to make sure that B.dict is somehow stored in, and loaded from, dbA rather than being 'hidden' somewhere inside dbB.

    Just to clarify - When I store a B object using Freeze, it automatically stores the contained A object. Very nice and useful. However I would like to 1) have direct access to the A object, ie. be able to load is without having to load the B object (Preferably without even knowing which B object it is contained in), and 2) be able to modify the A object on its own, store it, and have the changes present when i load the B object again.

    Is any of this even remotely possible?

    mvh

    NHB
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Freeze is a pretty simple mechanism: your objects are just streamed (using the Ice encoding) and stored in a Berkeley DB database (think map sequence of octet to sequence of octet). There is no way to store a subobject in another Freeze dictionary.

    However, did you consider doing:

    class A {...}

    dictionary<string,A> DictA

    class B {
    StringSeq stringSet;
    ....
    }

    Each element of stringSet refers to an A that you can lookup in dbA.

    Cheers,
    Bernard
  • Nis BaggesenNis Baggesen Member ✭✭✭
    bernard wrote:
    Freeze is a pretty simple mechanism: your objects are just streamed (using the Ice encoding) and stored in a Berkeley DB database (think map sequence of octet to sequence of octet). There is no way to store a subobject in another Freeze dictionary.

    Well, I expected as much, but I thought there was no harm in asking.
    bernard wrote:
    However, did you consider doing:

    class A {...}

    dictionary<string,A> DictA

    class B {
    StringSeq stringSet;
    ....
    }

    Each element of stringSet refers to an A that you can lookup in dbA.

    Cheers,
    Bernard

    Yes I did consider that, and it may be what we end up doing: I just wanted to check the other option first, as it seemed more elegant to me. Because sometimes I do want to send the B object with all the contained A objects already loaded. Ofcourse then I could have both the StringSeq and the DictA but that would be double bookkeeping, and so on. I'll figure out what is best, just wanted to know my options.

    Thanks for the quick reply.

    mvh

    Nis
Sign In or Register to comment.