Search code examples
c++databaseuser-interfacezodb

Using ZODB directly from C++. Examples and design hints


I'd like to use ZODB directly from C++ and don't want to write Python code for that. Have you had any experience doing so? If I were to use C++ for GUI and quering/writing data from/to ZODB, how the design should be?


Solution

  • seems like you have 2 choices

    a) work out how to call ZODB python module from c++

    google shows boost has a library, and I am sure python.org will tell you too

    b) work out the file format and write the equivalent code in c++

    Probably not impossible for reading, harder for writing. However you will eventually end up with the impedance mismatch of python->dynamic, c++->static

    I dont know ZODB but I will guess it is tightly matched to the dynamic nature of python's objects and so having a general purpose equivalent for c++ wont work. You would be able to create a particular object schema implementation though. I mean you could have a zodb with Customer, Order, Product and you can create a layer that maps the ZODB data to equivalent C++ objects