diff --git a/modules/conop/pymod/export_compound.cc b/modules/conop/pymod/export_compound.cc index b0c6e11d59655283b781ce5d34ff6d2cda3daba1..379f2059832561f9aef461589378e0571950b193 100644 --- a/modules/conop/pymod/export_compound.cc +++ b/modules/conop/pymod/export_compound.cc @@ -51,7 +51,7 @@ void export_Compound() { register_ptr_to_python<CompoundPtr>(); class_<CompoundLib>("CompoundLib", no_init) - .def("Load", &CompoundLib::Load).staticmethod("Load") + .def("Load", &CompoundLib::Load, arg("readonly")=true).staticmethod("Load") .def("FindCompound", &CompoundLib::FindCompound) .def("ClearCache", &CompoundLib::ClearCache) ; diff --git a/modules/conop/src/compound_lib.cc b/modules/conop/src/compound_lib.cc index 10e46b16ba0dabe90274699accd01d8c832c548b..b1878a973fd1c75913dbae05d6acca2cac9162d2 100644 --- a/modules/conop/src/compound_lib.cc +++ b/modules/conop/src/compound_lib.cc @@ -237,10 +237,11 @@ CompoundLibPtr CompoundLib::Create(const String& database) } -CompoundLibPtr CompoundLib::Load(const String& database) +CompoundLibPtr CompoundLib::Load(const String& database, bool readonly) { + int flags=readonly ? SQLITE_OPEN_READONLY : SQLITE_OPEN_READWRITE; CompoundLibPtr lib(new CompoundLib); - int retval=sqlite3_open(database.c_str(), &lib->conn_); + int retval=sqlite3_open_v2(database.c_str(), &lib->conn_, flags, NULL); if (SQLITE_OK==retval) { return lib; } diff --git a/modules/conop/src/compound_lib.hh b/modules/conop/src/compound_lib.hh index 8948e3479585f61e0fd9fa3d8b4b5c747fa97ccf..3d642d512c6d50ae4c0c92ae6ee9edbbae7bdedc 100644 --- a/modules/conop/src/compound_lib.hh +++ b/modules/conop/src/compound_lib.hh @@ -37,7 +37,7 @@ typedef std::map<String, CompoundPtr> CompoundMap; class DLLEXPORT_OST_CONOP CompoundLib { public: - static CompoundLibPtr Load(const String& database); + static CompoundLibPtr Load(const String& database, bool readonly=true); static CompoundLibPtr Create(const String& database); ~CompoundLib();