用于将C ++对象保存到数据库的库 [英] Library for saving c++ objects to database
问题描述
我目前正在通过Boost序列化将我的对象图保存在xml文件中.该库很棒,它会自动还原对象以及所有成员指针和引用.
I am currently saving my object graph in xml file with boost serialization. The library is great, it automatically restores the objects and all member pointers and references.
问题: 我需要对数据进行随机访问(仅读取一个对象,或仅删除一个对象).使用boost序列化时,场景是这样的:
Problem : I need to have random access to the data ( read just one object, or delete just one object ). With boost serialization the scenario is like this :
-从文件加载所有对象
-使用和修改对象
-写入所有对象以再次存档
-- write all objects to archive again
这样做的缺点是,如果仅更改一个对象,则我只想将那个对象而不是整个庞大的对象图写入存档.
The drawback with this is if only one object changed , I want to write to the archive only that object, and not the entire object graph which is huge.
因此,我正在寻找一种库,该库支持将所有对象存储到数据库,并且还支持boost和stl类型.目前,我正在使用以下增强类型:
So I am looking for library which support storing all objects to database, and which also supports boost and stl types. Currently I am using these boost types:
-
提升多重索引
boost multi-index
智能Ptr(shared_ptr,weak_ptr,scoped_ptr)
Smart Ptr ( shared_ptr,weak_ptr,scoped_ptr)
可选,变体
任何人都知道这样的库或其附近的东西,或者知道如何解决此问题吗?
Anyone knows such library or something close to it, or have idea how to go for resolving this problem?
推荐答案
您是否尝试过ODB? http://www.codesynthesis.com/products/odb/
Have you tried ODB? http://www.codesynthesis.com/products/odb/
这篇关于用于将C ++对象保存到数据库的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!