From boris at codesynthesis.com Fri Nov 1 11:06:39 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Nov 1 11:07:27 2019 Subject: [odb-users] How to cache the queried object pointer? In-Reply-To: References: Message-ID: Justin Huang writes: > typedef odb::result result; > result all_modules (db->query ()); > > int count = 0; > for (result::iterator i(all_modules.begin()); i != all_modules.end(); ++i) { > auto ptr = i.operator->(); > modules.push_back(ptr); You should use result::iterator::load() (i.load()) to load an object from a query result. See Section 4.4, "Query Result" for details. From boris at codesynthesis.com Fri Nov 1 11:12:36 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Nov 1 11:13:25 2019 Subject: [odb-users] Is that possible to order the child objects based on some specific column In-Reply-To: References: Message-ID: ???? writes: > Say i have two tables, A and B of 1:N relationship, B is eager loaded. > > > #pragma db object > class A > { > ........ > vector> b_; > > } > > > class B > { > ....... > int column_C; > } > > > i want the B objects was ordered by column_C in the vector. Is that > possible to do that? i use odb 2.4.0. There is no built-in support at the ODB level for this. You can check if it's possible at the database level for the database that you use (i.e., some kind of a default sort order). Alternatively, you can use an ODB view (probably an object-loading view) with an ORDER BY clause to manually load the vector (say from a database callback). From sean.clarke at sec-consulting.co.uk Sat Nov 2 12:27:24 2019 From: sean.clarke at sec-consulting.co.uk (Sean Clarke) Date: Sat Nov 2 12:28:33 2019 Subject: [odb-users] ETA for ODB 2.5.0 (RC or release) packages Message-ID: Hi, is there a timeline for when we can expect some official distro packages for ODB 2.5.0? - it seems to have been in development and beta for a very long time. I have previously battled with build2 and it produced some working output, however these could not be readily used on a vanilla Debian Buster or Ubuntu platform as build2 pulled in its dependencies at different revisions from the distro platforms. Regards Sean From per.edin at sequence-point.se Sat Nov 2 15:12:44 2019 From: per.edin at sequence-point.se (Per Edin) Date: Mon Nov 4 09:10:26 2019 Subject: [odb-users] ETA for ODB 2.5.0 (RC or release) packages In-Reply-To: References: Message-ID: Hi! On Sat, Nov 2, 2019 at 5:28 PM Sean Clarke wrote: > I have previously battled with build2 and it produced > some working output, however these could not be readily used on a > vanilla Debian Buster or Ubuntu platform as build2 pulled in its > dependencies at different revisions from the distro platforms. > I can't say anything about when 2.5.0 will be released, but I'm curious about the problems you're having with build2. I'm myself using ODB and build2 on multiple machines (Ubuntu, Debian and macOS) and I haven't yet experienced any problems related to system installed packages. // Per From boris at codesynthesis.com Tue Nov 5 09:28:56 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Nov 5 09:29:59 2019 Subject: [odb-users] ETA for ODB 2.5.0 (RC or release) packages In-Reply-To: References: Message-ID: Sean Clarke writes: > is there a timeline for when we can expect some official distro > packages for ODB 2.5.0? Uh, I don't think anyone can predict when (or even if) the next release of ODB (once released) will appear in official distribution package repositories -- this is done by volunteers and depends on each distribution's policies/priorities/etc. As an example, there was bug 1588330[1] in an Ubuntu LTS release where libodb and the rest of the database runtime libraries were compiled with different versions of GCC which happened to have different ABIs (so the fix was to just rebuild all the ODB packages with the same version of GCC). Guess how long it took to fix? Almost a year (reported on 2016-06-02, fixed on 2017-02-09). And during that time there would be an email on odb-users every week or two complaining about the issue. And I had to keep replying, and explaining, and telling people there is nothing I can do until Ubuntu decides this problem is worthy of their attention. So we started build2 where everything builds exactly the same no matter the platform (even on Windows) and where we actually have the ability to fix things when they break. I am not denying that using build2 is probably less convenient than using your distribution's package manager, at least initially. But it's a tradeoff: in return we can fix issues and make them available to you in a matter of minutes. > [...] - it seems to have been in development and beta for > a very long time. The ODB itself is fairly mature and at this stage of the 2.5.0 cycle we mostly fix bugs. So the code itself could be released tomorrow, except that the build system support is not finished yet. Specifically, we need to finish two major things: 1. Implement the ODB code generation module for build2. 2. With that support, port odb-tests packages to build2. The good news is in the upcoming release of build2 we have support for build system modules so we can make progress on (1). > I have previously battled with build2 and it produced some > working output, however these could not be readily used on a > vanilla Debian Buster or Ubuntu platform as build2 pulled in its > dependencies at different revisions from the distro platforms. I would be happy to help you with this if you can provide more details. In particular, you can instruct build2 to use system- installed libraries for any of the dependencies. The installation instructions[2] mention this explicitly: "Note that by default the underlying database libraries (libsqlite3, libmysqlclient, and libpq) will be built from source packages. If you would prefer to use the system-installed versions, adjust the corresponding build commands as follows:" $ bpkg build libodb-sqlite ?sys:libsqlite3 $ bpkg build libodb-pgsql ?sys:libpq $ bpkg build libodb-mysql ?sys:libmysqlclient [1] https://bugs.launchpad.net/ubuntu/+source/libodb/+bug/1588330 [2] https://codesynthesis.com/products/odb/doc/install-build2.xhtml From yohuang at nvidia.com Mon Nov 4 21:47:13 2019 From: yohuang at nvidia.com (Justin Huang) Date: Tue Nov 5 09:36:08 2019 Subject: [odb-users] How to cache the queried object pointer? In-Reply-To: References: Message-ID: Hi Boris, Thanks. It works. But I saw a weird issue when I use i.load() to query data members. Below I have a Module class, Instance class and Port class. I persisted the ports() and instances() of Module object, and confirmed that they were persisted in sqlite3 DB. I tried to use i.load() pointer to access ports(), the returned ports() size is 0, but size of instances() is not 0. session s; db = std::unique_ptr(create_database (argc, argv)); // load modules { odb::transaction t (db->begin()); typedef odb::result result; result all_modules (db->query ()); int count = 0; for (result::iterator i(all_modules.begin()); i != all_modules.end(); ++i) { std::shared_ptr p (i.load()); std::cout << "loading module: " << p->name() << std::endl; std::cout << "ports size: " << p->ports().size() << std::endl; std::cout << "instances size: " << p->instances().size() << std::endl; for (auto port: p->ports()) std::cout << "loading module port: " << port->name() << std::endl; for (auto inst: p->instances()) std::cout << "loading module inst: " << inst->name() << std::endl; } Any suggestions to debug this? Thanks. ------------------------------------------------------- # Module, Port, Instance class declaration ------------------------------------------------------- #pragma db object class Module: public NamedHessObject { public: Module(std::string name); ~Module(); std::vector& ports(); std::vector& instances(); std::vector& connections(); std::string as_string(); static Module* find_by_name(std::string name); public: #pragma db transient static std::map modules_; static size_t count; private: friend class odb::access; Module(); private: std::vector ports_; std::vector instances_; std::vector connections_; }; // class Module #pragma db object class Instance: public NamedHessObject { public: Instance(std::string name); ~Instance(); Module* module(); void module(Module* module); Module* owner(); void owner(Module* owner); std::vector& portrefs(); std::string as_string(); public: static size_t count; private: friend class odb::access; Instance(); private: Module* owner_; // owner module Module* module_; // instantiated module std::vector portrefs_; }; // class Instance #pragma db object class Port: public NamedHessObject { public: Port(std::string name); Port(); ~Port(); std::string direction(); void direction(std::string direction); Module* owner(); void owner(Module* owner); Interface* interface(); void interface(Interface* interface); std::vector& connections(); std::string as_string(); public: static size_t count; private: friend class odb::access; private: std::string direction_; Module* owner_; // module this port belongs to. Interface* interface_; // instantiated interface. std::vector connections_; // channels connected to this port inside the owner_ module }; // class Port -----Original Message----- From: Boris Kolpackov Sent: Friday, November 1, 2019 11:07 PM To: Justin Huang Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] How to cache the queried object pointer? Justin Huang writes: > typedef odb::result result; > result all_modules (db->query ()); > > int count = 0; > for (result::iterator i(all_modules.begin()); i != all_modules.end(); ++i) { > auto ptr = i.operator->(); > modules.push_back(ptr); You should use result::iterator::load() (i.load()) to load an object from a query result. See Section 4.4, "Query Result" for details. ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From yohuang at nvidia.com Mon Nov 4 23:56:24 2019 From: yohuang at nvidia.com (Justin Huang) Date: Tue Nov 5 09:36:08 2019 Subject: [odb-users] How to cache the queried object pointer? In-Reply-To: References: Message-ID: It is weird that there was no Module_ports table when I loaded the sqlite3 DB. -----Original Message----- From: Justin Huang Sent: Tuesday, November 5, 2019 10:47 AM To: odb-users@codesynthesis.com Subject: RE: [odb-users] How to cache the queried object pointer? Hi Boris, Thanks. It works. But I saw a weird issue when I use i.load() to query data members. Below I have a Module class, Instance class and Port class. I persisted the ports() and instances() of Module object, and confirmed that they were persisted in sqlite3 DB. I tried to use i.load() pointer to access ports(), the returned ports() size is 0, but size of instances() is not 0. session s; db = std::unique_ptr(create_database (argc, argv)); // load modules { odb::transaction t (db->begin()); typedef odb::result result; result all_modules (db->query ()); int count = 0; for (result::iterator i(all_modules.begin()); i != all_modules.end(); ++i) { std::shared_ptr p (i.load()); std::cout << "loading module: " << p->name() << std::endl; std::cout << "ports size: " << p->ports().size() << std::endl; std::cout << "instances size: " << p->instances().size() << std::endl; for (auto port: p->ports()) std::cout << "loading module port: " << port->name() << std::endl; for (auto inst: p->instances()) std::cout << "loading module inst: " << inst->name() << std::endl; } Any suggestions to debug this? Thanks. ------------------------------------------------------- # Module, Port, Instance class declaration ------------------------------------------------------- #pragma db object class Module: public NamedHessObject { public: Module(std::string name); ~Module(); std::vector& ports(); std::vector& instances(); std::vector& connections(); std::string as_string(); static Module* find_by_name(std::string name); public: #pragma db transient static std::map modules_; static size_t count; private: friend class odb::access; Module(); private: std::vector ports_; std::vector instances_; std::vector connections_; }; // class Module #pragma db object class Instance: public NamedHessObject { public: Instance(std::string name); ~Instance(); Module* module(); void module(Module* module); Module* owner(); void owner(Module* owner); std::vector& portrefs(); std::string as_string(); public: static size_t count; private: friend class odb::access; Instance(); private: Module* owner_; // owner module Module* module_; // instantiated module std::vector portrefs_; }; // class Instance #pragma db object class Port: public NamedHessObject { public: Port(std::string name); Port(); ~Port(); std::string direction(); void direction(std::string direction); Module* owner(); void owner(Module* owner); Interface* interface(); void interface(Interface* interface); std::vector& connections(); std::string as_string(); public: static size_t count; private: friend class odb::access; private: std::string direction_; Module* owner_; // module this port belongs to. Interface* interface_; // instantiated interface. std::vector connections_; // channels connected to this port inside the owner_ module }; // class Port -----Original Message----- From: Boris Kolpackov Sent: Friday, November 1, 2019 11:07 PM To: Justin Huang Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] How to cache the queried object pointer? Justin Huang writes: > typedef odb::result result; > result all_modules (db->query ()); > > int count = 0; > for (result::iterator i(all_modules.begin()); i != all_modules.end(); ++i) { > auto ptr = i.operator->(); > modules.push_back(ptr); You should use result::iterator::load() (i.load()) to load an object from a query result. See Section 4.4, "Query Result" for details. ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From yohuang at nvidia.com Tue Nov 5 00:25:40 2019 From: yohuang at nvidia.com (Justin Huang) Date: Tue Nov 5 09:36:09 2019 Subject: [odb-users] How to cache the queried object pointer? In-Reply-To: References: Message-ID: It is quite weird that if I reorder the declaration of ports_, instances_ and connections_ data members of Module class, ODB would always do not create table for the first one. In below example, there is no 'CREATE TABLE' statement for Modulel_ports. If I move instances_ up above ports_, then ODB would not generate CREATE TABLE statement for Module_instances. I can't understand what is going wrong here. class Module .. { private: std::vector ports_; std::vector instances_; std::vector connections_; }; // class Module -----Original Message----- From: Justin Huang Sent: Tuesday, November 5, 2019 12:56 PM To: odb-users@codesynthesis.com Subject: RE: [odb-users] How to cache the queried object pointer? It is weird that there was no Module_ports table when I loaded the sqlite3 DB. -----Original Message----- From: Justin Huang Sent: Tuesday, November 5, 2019 10:47 AM To: odb-users@codesynthesis.com Subject: RE: [odb-users] How to cache the queried object pointer? Hi Boris, Thanks. It works. But I saw a weird issue when I use i.load() to query data members. Below I have a Module class, Instance class and Port class. I persisted the ports() and instances() of Module object, and confirmed that they were persisted in sqlite3 DB. I tried to use i.load() pointer to access ports(), the returned ports() size is 0, but size of instances() is not 0. session s; db = std::unique_ptr(create_database (argc, argv)); // load modules { odb::transaction t (db->begin()); typedef odb::result result; result all_modules (db->query ()); int count = 0; for (result::iterator i(all_modules.begin()); i != all_modules.end(); ++i) { std::shared_ptr p (i.load()); std::cout << "loading module: " << p->name() << std::endl; std::cout << "ports size: " << p->ports().size() << std::endl; std::cout << "instances size: " << p->instances().size() << std::endl; for (auto port: p->ports()) std::cout << "loading module port: " << port->name() << std::endl; for (auto inst: p->instances()) std::cout << "loading module inst: " << inst->name() << std::endl; } Any suggestions to debug this? Thanks. ------------------------------------------------------- # Module, Port, Instance class declaration ------------------------------------------------------- #pragma db object class Module: public NamedHessObject { public: Module(std::string name); ~Module(); std::vector& ports(); std::vector& instances(); std::vector& connections(); std::string as_string(); static Module* find_by_name(std::string name); public: #pragma db transient static std::map modules_; static size_t count; private: friend class odb::access; Module(); private: std::vector ports_; std::vector instances_; std::vector connections_; }; // class Module #pragma db object class Instance: public NamedHessObject { public: Instance(std::string name); ~Instance(); Module* module(); void module(Module* module); Module* owner(); void owner(Module* owner); std::vector& portrefs(); std::string as_string(); public: static size_t count; private: friend class odb::access; Instance(); private: Module* owner_; // owner module Module* module_; // instantiated module std::vector portrefs_; }; // class Instance #pragma db object class Port: public NamedHessObject { public: Port(std::string name); Port(); ~Port(); std::string direction(); void direction(std::string direction); Module* owner(); void owner(Module* owner); Interface* interface(); void interface(Interface* interface); std::vector& connections(); std::string as_string(); public: static size_t count; private: friend class odb::access; private: std::string direction_; Module* owner_; // module this port belongs to. Interface* interface_; // instantiated interface. std::vector connections_; // channels connected to this port inside the owner_ module }; // class Port -----Original Message----- From: Boris Kolpackov Sent: Friday, November 1, 2019 11:07 PM To: Justin Huang Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] How to cache the queried object pointer? Justin Huang writes: > typedef odb::result result; > result all_modules (db->query ()); > > int count = 0; > for (result::iterator i(all_modules.begin()); i != all_modules.end(); ++i) { > auto ptr = i.operator->(); > modules.push_back(ptr); You should use result::iterator::load() (i.load()) to load an object from a query result. See Section 4.4, "Query Result" for details. ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From boris at codesynthesis.com Tue Nov 5 09:38:12 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Nov 5 09:39:13 2019 Subject: [odb-users] How to cache the queried object pointer? In-Reply-To: References: Message-ID: Justin Huang writes: > public: > #pragma db transient > static std::map modules_; > static size_t count; > > private: > std::vector ports_; > std::vector instances_; > std::vector connections_; You don't need to mark static data members as transient. And I think what happens here is that db transient pragma applies to the first non-static data member, which is ports_. From yohuang at nvidia.com Tue Nov 5 10:15:42 2019 From: yohuang at nvidia.com (Justin Huang) Date: Wed Nov 6 06:30:18 2019 Subject: [odb-users] How to cache the queried object pointer? In-Reply-To: References: Message-ID: Hi Boris, You root caused it so quickly. Thanks very much! The Module_ports table is now created when I commented out #pragma db transient. I spent a lot of time to find a workaround, i.e., I added a dummy data member before ports_. Now I can remove it. Maybe this can be documented in the manual html page. Thanks, Justin -----Original Message----- From: Boris Kolpackov Sent: Tuesday, November 5, 2019 10:38 PM To: Justin Huang Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] How to cache the queried object pointer? Justin Huang writes: > public: > #pragma db transient > static std::map modules_; > static size_t count; > > private: > std::vector ports_; > std::vector instances_; > std::vector connections_; You don't need to mark static data members as transient. And I think what happens here is that db transient pragma applies to the first non-static data member, which is ports_. ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ----------------------------------------------------------------------------------- From sean.clarke at sec-consulting.co.uk Fri Nov 8 01:56:05 2019 From: sean.clarke at sec-consulting.co.uk (Sean Clarke) Date: Fri Nov 8 01:57:37 2019 Subject: [odb-users] ETA for ODB 2.5.0 (RC or release) packages In-Reply-To: References: Message-ID: On Tue, 5 Nov 2019 at 14:29, Boris Kolpackov wrote: > Sean Clarke writes: > > > is there a timeline for when we can expect some official distro > > packages for ODB 2.5.0? > > Uh, I don't think anyone can predict when (or even if) the next release > of ODB (once released) will appear in official distribution package > repositories -- this is done by volunteers and depends on each > distribution's policies/priorities/etc. > Sorry, I should have been clearer - I was referring to the debian packages available on your website.. I gave up on the distros distributed version long ago for the reasons you give. > I am not denying that using build2 is probably less convenient than > using your distribution's package manager, at least initially. But > it's a tradeoff: in return we can fix issues and make them available > to you in a matter of minutes. > It looks OK for development, not so great for production where you do not want compilers etc. installed, I would be happy to help you with this if you can provide more > details. In particular, you can instruct build2 to use system- > installed libraries for any of the dependencies. The installation > instructions[2] mention this explicitly: > > "Note that by default the underlying database libraries (libsqlite3, > libmysqlclient, and libpq) will be built from source packages. If you would > prefer to use the system-installed versions, adjust the corresponding build > commands as follows:" > > $ bpkg build libodb-sqlite ?sys:libsqlite3 > $ bpkg build libodb-pgsql ?sys:libpq > $ bpkg build libodb-mysql ?sys:libmysqlclient > Yes, this was my issue - build2 pulled in and built against later versions than the platforms are distributed with. Now CMake is cross platform (fully supported in WIndows VS) what does build2 give you over and above CMake or Cmake + Conan (or similiar). Regards Sean From boris at codesynthesis.com Mon Nov 11 10:42:42 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Nov 11 10:44:01 2019 Subject: [odb-users] ETA for ODB 2.5.0 (RC or release) packages In-Reply-To: References: Message-ID: Sean Clarke writes: > Sorry, I should have been clearer - I was referring to the debian packages > available on your website.. I gave up on the distros distributed version > long ago for the reasons you give. We have no plans to provide those after 2.4.0: building version- independent (i.e., statically-linked) distribution packages is more of a brittle hack than a long-term solution. And providing version-specific package is beyond our capacity. > It looks OK for development, not so great for production where you do not > want compilers etc. installed, If you don't want to build from source in production (understandably), then provided your development (or build) machine is the same as your production, you can build there, install everything into a separate directory (see also config.install.chroot) and then ship the binaries (either as simple .tar.?z or even custom deb/rpm/etc). > Yes, this was my issue - build2 pulled in and built against later versions > than the platforms are distributed with. I don't think there is a general solution to this "my development platform does not match my deployment" problem. With build2, if you use the above method and build everything from source (as opposed to using system-installed dependencies), you can probably get away with it as long as your libc/libstdc++ are the same or ABI-compatible (which is normally the case). From ruffian_hy at 126.com Fri Nov 15 00:07:32 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Fri Nov 15 00:09:36 2019 Subject: [odb-users] How to use the lazy_weak_ptr? Message-ID: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> I currently have two odb model like below: A.hpp class A { ... private: odb::lazy_shared_ptr m_b; ... }; #pragma db object(A) pointer(std::shared_ptr) #pragma db member(m_b) B.hpp class B { ... private: odb::lazy_shared_ptr m_a; ... }; #pragma db object(B) pointer(std::shared_ptr) #pragma db member(m_a) They obviously have circular reference, and I want to use lazy_weak_ptr to fix it by the codes below: A.hpp class A { ... private: odb::lazy_shared_ptr m_b; ... }; #pragma db object(A) pointer(std::shared_ptr) #pragma db member(m_b) B.hpp class B { ... private: #pragma db inverse(m_b) odb::lazy_weak_ptr m_a; ... }; #pragma db object(B) pointer(std::shared_ptr) #pragma db member(m_a) But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. It seems like I use the lazy_weak_ptr in a wrong way, is there anyone can help me? From boris at codesynthesis.com Fri Nov 15 13:52:50 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Nov 15 13:54:24 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> Message-ID: ?? writes: > class B > { > ... > private: > #pragma db inverse(m_b) > > odb::lazy_weak_ptr m_a; > ... > }; > #pragma db object(B) pointer(std::shared_ptr) > #pragma db member(m_a) > > But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. Try to move inverse to the member(m_a) pragma: #pragma db member(m_a) inverse(m_b) Also, dealing with circular relationship is tricky, especially when spread over multiple headers; see "Circular Relationships" in the manual for details: https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From ruffian_hy at 126.com Fri Nov 15 20:31:56 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Fri Nov 15 20:33:43 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> Message-ID: <3351360e.6a2.16e71d68b9d.Coremail.ruffian_hy@126.com> I add #inlcude "B" and move inverse to the member(m_a) pragma, but I still get the same error of ?error: object data member ? m_a' specified in db pragma column is inverse?. At 2019-11-16 02:52:50, "Boris Kolpackov" wrote: >?? writes: > >> class B >> { >> ... >> private: >> #pragma db inverse(m_b) >> >> odb::lazy_weak_ptr m_a; >> ... >> }; >> #pragma db object(B) pointer(std::shared_ptr) >> #pragma db member(m_a) >> >> But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. > >Try to move inverse to the member(m_a) pragma: > >#pragma db member(m_a) inverse(m_b) > >Also, dealing with circular relationship is tricky, especially when >spread over multiple headers; see "Circular Relationships" in the >manual for details: > >https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From ruffian_hy at 126.com Fri Nov 15 20:51:34 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Fri Nov 15 20:53:10 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> Message-ID: <6210e617.81f.16e71e884f5.Coremail.ruffian_hy@126.com> I add #inlcude "B" and move inverse to the member(m_a) pragma, but I still get the same error of ?error: object data member ? m_a' specified in db pragma column is inverse?. BTW, m_a also belong to a view join by this two class class C { public: ... int64_t a; ... }; #pragma db view(C) pointer(std::shared_ptr) object(B) object(A: B::m_a == A::m_id) #pragma db member(C::a) column(B::m_a) At 2019-11-16 02:52:50, "Boris Kolpackov" wrote: >?? writes: > >> class B >> { >> ... >> private: >> #pragma db inverse(m_b) >> >> odb::lazy_weak_ptr m_a; >> ... >> }; >> #pragma db object(B) pointer(std::shared_ptr) >> #pragma db member(m_a) >> >> But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. > >Try to move inverse to the member(m_a) pragma: > >#pragma db member(m_a) inverse(m_b) > >Also, dealing with circular relationship is tricky, especially when >spread over multiple headers; see "Circular Relationships" in the >manual for details: > >https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From ruffian_hy at 126.com Fri Nov 15 21:22:36 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Fri Nov 15 21:24:08 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> Message-ID: <710eacab.a49.16e7204ee60.Coremail.ruffian_hy@126.com> I add #inlcude "B" and move inverse to the member(m_a) pragma, but I still get the same error of ?error: object data member ? m_a' specified in db pragma column is inverse?. BTW, m_a also belong to a view join by this two class class C { public: ... int64_t a; ... }; #pragma db view(C) pointer(std::shared_ptr) object(B) object(A: B::m_a == A::m_id) #pragma db member(C::a) column(B::m_a) At 2019-11-16 02:52:50, "Boris Kolpackov" wrote: >?? writes: > >> class B >> { >> ... >> private: >> #pragma db inverse(m_b) >> >> odb::lazy_weak_ptr m_a; >> ... >> }; >> #pragma db object(B) pointer(std::shared_ptr) >> #pragma db member(m_a) >> >> But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. > >Try to move inverse to the member(m_a) pragma: > >#pragma db member(m_a) inverse(m_b) > >Also, dealing with circular relationship is tricky, especially when >spread over multiple headers; see "Circular Relationships" in the >manual for details: > >https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From ruffian_hy at 126.com Fri Nov 15 21:27:29 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Fri Nov 15 21:29:03 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: <710eacab.a49.16e7204ee60.Coremail.ruffian_hy@126.com> References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> <710eacab.a49.16e7204ee60.Coremail.ruffian_hy@126.com> Message-ID: <43f218e9.aa5.16e72096744.Coremail.ruffian_hy@126.com> I move #pragma db member(C::a) column(B::m_a) to "#pragma db member(C::a) column(A::m_id) " But I get this below in the update schema: case 2: { db.execute ("UPDATE \"B\"\n" " SET \"a\" = NULL"); db.execute ("UPDATE \"schema_version\"\n" " SET \"migration\" = 0\n" " WHERE \"name\" = ''"); return false; It will lost the existed data in db, right? At 2019-11-16 10:22:36, "??" wrote: I add #inlcude "B" and move inverse to the member(m_a) pragma, but I still get the same error of ?error: object data member ? m_a' specified in db pragma column is inverse?. BTW, m_a also belong to a view join by this two class class C { public: ... int64_t a; ... }; #pragma db view(C) pointer(std::shared_ptr) object(B) object(A: B::m_a == A::m_id) #pragma db member(C::a) column(B::m_a) At 2019-11-16 02:52:50, "Boris Kolpackov" wrote: >?? writes: > >> class B >> { >> ... >> private: >> #pragma db inverse(m_b) >> >> odb::lazy_weak_ptr m_a; >> ... >> }; >> #pragma db object(B) pointer(std::shared_ptr) >> #pragma db member(m_a) >> >> But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. > >Try to move inverse to the member(m_a) pragma: > >#pragma db member(m_a) inverse(m_b) > >Also, dealing with circular relationship is tricky, especially when >spread over multiple headers; see "Circular Relationships" in the >manual for details: > >https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From ruffian_hy at 126.com Fri Nov 15 21:34:24 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Fri Nov 15 21:35:56 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: <710eacab.a49.16e7204ee60.Coremail.ruffian_hy@126.com> References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> <710eacab.a49.16e7204ee60.Coremail.ruffian_hy@126.com> Message-ID: <396ad71a.b1f.16e720fbbb6.Coremail.ruffian_hy@126.com> At 2019-11-16 10:22:36, "??" wrote: I add #inlcude "B" and move inverse to the member(m_a) pragma, but I still get the same error of ?error: object data member ? m_a' specified in db pragma column is inverse?. BTW, m_a also belong to a view join by this two class class C { public: ... int64_t a; ... }; #pragma db view(C) pointer(std::shared_ptr) object(B) object(A: B::m_a == A::m_id) #pragma db member(C::a) column(B::m_a) At 2019-11-16 02:52:50, "Boris Kolpackov" wrote: >?? writes: > >> class B >> { >> ... >> private: >> #pragma db inverse(m_b) >> >> odb::lazy_weak_ptr m_a; >> ... >> }; >> #pragma db object(B) pointer(std::shared_ptr) >> #pragma db member(m_a) >> >> But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. > >Try to move inverse to the member(m_a) pragma: > >#pragma db member(m_a) inverse(m_b) > >Also, dealing with circular relationship is tricky, especially when >spread over multiple headers; see "Circular Relationships" in the >manual for details: > >https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From ruffian_hy at 126.com Sat Nov 16 00:30:08 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Sat Nov 16 00:31:41 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> Message-ID: <18408b3.14ad.16e72b0a075.Coremail.ruffian_hy@126.com> I found that I can not use inverse in our project, But if I remove ?#pragma db inverse(m_b)?, all the function below will get a nullptr if(m_a.loaded()) auto post = m_a.get_eager().lock(); auto post1=m_a.get_eager(); auto post2 = m_a.load(); auto post3 = m_a.lock(); auto post4 = post3.load(); auto post5 = post3.get_eager(); } How can I get the object from lazy_weak_ptr? At 2019-11-16 02:52:50, "Boris Kolpackov" wrote: >?? writes: > >> class B >> { >> ... >> private: >> #pragma db inverse(m_b) >> >> odb::lazy_weak_ptr m_a; >> ... >> }; >> #pragma db object(B) pointer(std::shared_ptr) >> #pragma db member(m_a) >> >> But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. > >Try to move inverse to the member(m_a) pragma: > >#pragma db member(m_a) inverse(m_b) > >Also, dealing with circular relationship is tricky, especially when >spread over multiple headers; see "Circular Relationships" in the >manual for details: > >https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From ruffian_hy at 126.com Sat Nov 16 00:49:48 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Sat Nov 16 00:51:21 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: <18408b3.14ad.16e72b0a075.Coremail.ruffian_hy@126.com> References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> <18408b3.14ad.16e72b0a075.Coremail.ruffian_hy@126.com> Message-ID: <57a8ae47.15c5.16e72c2a08a.Coremail.ruffian_hy@126.com> Actually, we have class Group and class Post, Group and Post is one to many relationship. But we only need a most recent Post ptr for Group object. Currently, we have odb::lazy_shared_ptr for each object, like below: class Group { odb::lazy_shared_ptr mostRecentPost; }; class Post { odb::lazy_shared_ptr group; } How can I break the ownership cycles for this scenario, and prevent db upgrade incompatibility issues. At 2019-11-16 13:30:08, "??" wrote: I found that I can not use inverse in our project, But if I remove ?#pragma db inverse(m_b)?, all the function below will get a nullptr if(m_a.loaded()) auto post = m_a.get_eager().lock(); auto post1=m_a.get_eager(); auto post2 = m_a.load(); auto post3 = m_a.lock(); auto post4 = post3.load(); auto post5 = post3.get_eager(); } How can I get the object from lazy_weak_ptr? At 2019-11-16 02:52:50, "Boris Kolpackov" wrote: >?? writes: > >> class B >> { >> ... >> private: >> #pragma db inverse(m_b) >> >> odb::lazy_weak_ptr m_a; >> ... >> }; >> #pragma db object(B) pointer(std::shared_ptr) >> #pragma db member(m_a) >> >> But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. > >Try to move inverse to the member(m_a) pragma: > >#pragma db member(m_a) inverse(m_b) > >Also, dealing with circular relationship is tricky, especially when >spread over multiple headers; see "Circular Relationships" in the >manual for details: > >https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From ruffian_hy at 126.com Sat Nov 16 01:05:18 2019 From: ruffian_hy at 126.com (=?GBK?B?u8beyA==?=) Date: Sat Nov 16 01:06:57 2019 Subject: [odb-users] How to use the lazy_weak_ptr? In-Reply-To: <18408b3.14ad.16e72b0a075.Coremail.ruffian_hy@126.com> References: <3c8a0ec3.39ff.16e6d759335.Coremail.ruffian_hy@126.com> <18408b3.14ad.16e72b0a075.Coremail.ruffian_hy@126.com> Message-ID: <6262e420.1712.16e72d0d38c.Coremail.ruffian_hy@126.com> Actually, we have class Group and class Post, Group and Post is one to many relationship. But we only need a most recent Post ptr for Group object. Currently, we have odb::lazy_shared_ptr for each object, like below: class Group { odb::lazy_shared_ptr mostRecentPost; }; class Post { odb::lazy_shared_ptr group; } How can I break the ownership cycles for this scenario, and prevent db upgrade incompatibility issues. At 2019-11-16 13:30:08, "??" wrote: I found that I can not use inverse in our project, But if I remove ?#pragma db inverse(m_b)?, all the function below will get a nullptr if(m_a.loaded()) auto post = m_a.get_eager().lock(); //auto post1=m_a.get_eager(); auto post2 = m_a.load(); auto post3 = m_a.lock(); auto post4 = post3.load(); auto post5 = post3.get_eager(); } How can I get the object from lazy_weak_ptr? At 2019-11-16 02:52:50, "Boris Kolpackov" wrote: >?? writes: > >> class B >> { >> ... >> private: >> #pragma db inverse(m_b) >> >> odb::lazy_weak_ptr m_a; >> ... >> }; >> #pragma db object(B) pointer(std::shared_ptr) >> #pragma db member(m_a) >> >> But I get the error of ?error: object data member ? m_a' specified in db pragma column is inverse?. > >Try to move inverse to the member(m_a) pragma: > >#pragma db member(m_a) inverse(m_b) > >Also, dealing with circular relationship is tricky, especially when >spread over multiple headers; see "Circular Relationships" in the >manual for details: > >https://codesynthesis.com/products/odb/doc/manual.xhtml#6.3 From chere.loque at gmail.com Fri Nov 22 09:10:43 2019 From: chere.loque at gmail.com (Vincent) Date: Fri Nov 22 09:31:05 2019 Subject: [odb-users] Dependency issue with build2 0.12 and odb 2.5 Message-ID: Hello! I am facing a dependency issue when building odb beta 2.5 with build2 0.12.0. Everything worked correctly with build2 0.11.0, until I upgraded to build2 0.12.0, which was required since I started to get this error 2 days ago: [...] + bpkg-stage --fetch-timeout 600 build --for install --yes --plan= build2 bpkg bdep error: unable to satisfy constraint (build2 >= 0.12.0) for package build2 info: available build2 version is 0.11.0 info: while satisfying build2/0.12.0 Installed build2 like this: $ build2.sh --uninstall --yes $ curl -o build2.sh -sSfO https://download.build2.org/0.12.0/build2-install-0.12.0.sh $ shasum -a 256 -b build2.sh $ sh build2.sh --no-check --trust yes --yes [...] About to download, build, and install build2 toolchain 0.12.0 (public). From: https://download.build2.org Using: g++-8 [...] Successfully installed build2 toolchain 0.12.0 (public). Then, tried to install odb beta (2.5.0-b.17) : $ bpkg create -d odb-build2/ cc config.cxx=g++ config.cc.coptions=-O3 config.bin.rpath=my/local/lib/ config.install.root=my/local --wipe $ cd odb-build2/ $ bpkg build --yes --trust-yes odb@https://pkg.cppget.org/1/beta fetching pkg:cppget.org/beta fetching pkg:cppget.org/testing (complements pkg:cppget.org/beta) fetching pkg:cppget.org/stable (complements pkg:cppget.org/testing) error: unable to satisfy constraint (build2 >= 0.11.0) for package odb info: available build2 version is 0.10.0 info: while satisfying odb/2.5.0-b.17 Also tried with "/1/alpha" without success. Thank you for your assistance! Vincent From boris at codesynthesis.com Fri Nov 22 09:37:45 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Nov 22 09:39:39 2019 Subject: [odb-users] Dependency issue with build2 0.12 and odb 2.5 In-Reply-To: References: Message-ID: Vincent writes: > $ bpkg create -d odb-build2/ cc config.cxx=g++ config.cc.coptions=-O3 > config.bin.rpath=my/local/lib/ config.install.root=my/local --wipe > $ cd odb-build2/ > $ bpkg build --yes --trust-yes odb@https://pkg.cppget.org/1/beta > fetching pkg:cppget.org/beta > fetching pkg:cppget.org/testing (complements pkg:cppget.org/beta) > fetching pkg:cppget.org/stable (complements pkg:cppget.org/testing) > error: unable to satisfy constraint (build2 >= 0.11.0) for package odb > info: available build2 version is 0.10.0 > info: while satisfying odb/2.5.0-b.17 Hm, interesting. What do these commands print in the same terminal: $ where bpkg $ bpkg --version $ where b $ b --version BTW, thanks for providing the detailed transcript, makes figuring this out much easier. From chere.loque at gmail.com Fri Nov 22 11:00:05 2019 From: chere.loque at gmail.com (Vincent) Date: Fri Nov 22 11:30:35 2019 Subject: [odb-users] Dependency issue with build2 0.12 and odb 2.5 In-Reply-To: References: Message-ID: <4fb546f8-1ad3-2902-d04f-cc3b22c8e8ab@gmail.com> Thanks to your instructions, I managed to find out what happened! We build/install build2 and odb libs in a subdirectory of our Jenkins workspace, and all the calls to 'bpkg' from the makefiles use the absolute path (I have not mentioned in my transcript for the sake of clarity). However, I found out that we also had 'bpkg' and 'b' binaries version 0.10 installed in the /usr/local/bin directory of the build machine. Removing them solved the issue. So, it seems that calling 'bpkg' in a specific path stills make uses/calls of binaries installed at the system level (on the PATH), somehow. Here is a full transcript of a test I made to reproduce the issue: $ cd /home/vincent/my_project $ cat ./build/dev-tools/build2/install_build2.sh SCRIPT_DIR=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) sh ${SCRIPT_DIR}/build2.sh --uninstall --yes curl -o ${SCRIPT_DIR}/build2.sh -sSfO https://download.build2.org/0.12.0/build2-install-0.12.0.sh shasum -a 256 -b ${SCRIPT_DIR}/build2.sh sh ${SCRIPT_DIR}/build2.sh --no-check --trust yes --yes ${SCRIPT_DIR} $ ./build/dev-tools/build2/install_build2.sh About to uninstall build2 toolchain 0.11.0 (public). Install directory: /home/vincent/my_project/build/dev-tools/build2/ Build directory: /home/vincent/my_project/ [...] Successfully uninstalled build2 toolchain 0.11.0 (public). da35b527aac3427b449ca7525e97f81faba776ae7680179521963b90a21fba12 */home/vincent/my_project/build/dev-tools/build2/build2.sh ------------------------------------------------------------------------- About to download, build, and install build2 toolchain 0.12.0 (public). [...] Install directory: /home/vincent/my_project/build/dev-tools/build2/ Build directory: /home/vincent/my_project/ Package repository: https://pkg.cppget.org/1/alpha [...] Successfully installed build2 toolchain 0.12.0 (public). Install directory: /home/vincent/my_project/build/dev-tools/build2/ Build configuration: build2-toolchain-0.12/ Testing version installed in build directory: $ ./build/dev-tools/build2/bin/bpkg --version bpkg 0.12.0 libbpkg 0.12.0 libbutl 0.12.0 Copyright (c) 2014-2019 Code Synthesis Ltd This is free software released under the MIT license. $ ./build/dev-tools/build2/bin/b --version build2 0.12.0 libbutl 0.12.0 host x86_64-linux-gnu Copyright (c) 2014-2019 Code Synthesis Ltd This is free software released under the MIT license. And in system directory (/usr/local/bin): $ bpkg --version bpkg 0.10.0 libbpkg 0.10.0 libbutl 0.10.0 Copyright (c) 2014-2019 Code Synthesis Ltd This is free software released under the MIT license. $ b --version build2 0.10.0 libbutl 0.10.0 host x86_64-linux-gnu Copyright (c) 2014-2019 Code Synthesis Ltd This is free software released under the MIT license. Then, trying the actual build of odb: $ cd /home/vincent/my_project $ mkdir _build $ cd _build $ mkdir local $ mkdir odb-build2 $ cd odb-build2 $ ../../build/dev-tools/build2/bin/bpkg create -d . cc config.cxx=g++ config.cc.coptions=-O3 config.bin.rpath=../local/lib/ config.install.root=../local --wipe created new configuration in /home/vincent/my_project/_build/odb-build2/ $ ../../build/dev-tools/build2/bin/bpkg build --yes --trust-yes odb@https://pkg.cppget.org/1/beta added pkg:cppget.org/beta fetching pkg:cppget.org/beta fetching pkg:cppget.org/testing (complements pkg:cppget.org/beta) fetching pkg:cppget.org/stable (complements pkg:cppget.org/testing) error: unable to satisfy constraint (build2 >= 0.11.0) for package odb info: available build2 version is 0.10.0 info: while satisfying odb/2.5.0-b.17 Is there any way to specify a "home path" for build2 binaries? Vincent From boris at codesynthesis.com Fri Nov 22 11:35:55 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Nov 22 11:37:50 2019 Subject: [odb-users] Dependency issue with build2 0.12 and odb 2.5 In-Reply-To: <4fb546f8-1ad3-2902-d04f-cc3b22c8e8ab@gmail.com> References: <4fb546f8-1ad3-2902-d04f-cc3b22c8e8ab@gmail.com> Message-ID: Vincent writes: > So, it seems that calling 'bpkg' in a specific path stills make > uses/calls of binaries installed at the system level (on the PATH), somehow. > > [...] > > $ ../../build/dev-tools/build2/bin/bpkg create -d . cc config.cxx=g++ > config.cc.coptions=-O3 config.bin.rpath=../local/lib/ > config.install.root=../local --wipe > created new configuration in /home/vincent/my_project/_build/odb-build2/ > $ ../../build/dev-tools/build2/bin/bpkg build --yes --trust-yes > odb@https://pkg.cppget.org/1/beta > added pkg:cppget.org/beta > fetching pkg:cppget.org/beta > fetching pkg:cppget.org/testing (complements pkg:cppget.org/beta) > fetching pkg:cppget.org/stable (complements pkg:cppget.org/testing) > error: unable to satisfy constraint (build2 >= 0.11.0) for package odb > info: available build2 version is 0.10.0 > info: while satisfying odb/2.5.0-b.17 > > Is there any way to specify a "home path" for build2 binaries? You could do: $ PATH="../../build/dev-tools/build2/bin:$PATH" bpkg ... But there is also --build : The build program to be used to build packages. This should be the path to the build2 b executable. You can also specify additional options that should be passed to the build program with --build-option.[1] So you can do: $ ../../build/dev-tools/build2/bin/bpkg --build ../../build/dev-tools/build2/bin/b ... [1] https://build2.org/bpkg/doc/bpkg-common-options.xhtml From chere.loque at gmail.com Fri Nov 22 11:55:25 2019 From: chere.loque at gmail.com (Vincent) Date: Fri Nov 22 12:02:40 2019 Subject: [odb-users] Dependency issue with build2 0.12 and odb 2.5 In-Reply-To: References: <4fb546f8-1ad3-2902-d04f-cc3b22c8e8ab@gmail.com> Message-ID: <89a618f7-3434-cdd3-0ca7-59ae1b3dbc18@gmail.com> > But there is also --build : > > The build program to be used to build packages. This should be the path to > the build2 b executable. [...] > > So you can do: > > $ ../../build/dev-tools/build2/bin/bpkg --build ../../build/dev-tools/build2/bin/b ... Thank you, didn't notice this! From odb at a-cunningham.com Fri Nov 22 12:02:09 2019 From: odb at a-cunningham.com (Andrew Cunningham) Date: Fri Nov 22 12:04:25 2019 Subject: [odb-users] Switch to clang? Message-ID: Hi Boris, Have you thought about switching to clang for your C++ parser/code-generator? We already use clang for code generation from our C++ headers and it's very easy to use. Using clang has lots of benefits for Windows developers as it's more of a native tool. ODB code generation is painfully slow on Windows. Andrew From boris at codesynthesis.com Mon Nov 25 08:05:45 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Nov 25 08:07:50 2019 Subject: [odb-users] Switch to clang? In-Reply-To: References: Message-ID: Andrew Cunningham writes: > Have you thought about switching to clang for your C++ > parser/code-generator? This question comes up from time to time. It will be at least a substantial effort. But it's also not clear if Clang has all the capabilities that we need. One, in particular, is the ability to instantiate templates after parsing of the translation unit is complete. Last time I checks (which was admittedly a while ago), this was impossible in Clang. > ODB code generation is painfully slow on Windows. Do you have any evidence that switching to Clang will significantly improve compilation speed? In my experience, these days GCC's compiles about as fast as Clang. I am also assuming that you are using an optimized build of ODB (and another thing that might help is running ODB compilation jobs in parallel). From blob84 at gmail.com Sun Nov 24 13:01:19 2019 From: blob84 at gmail.com (blob blob) Date: Mon Nov 25 08:13:56 2019 Subject: [odb-users] relationship always in a consistent state Message-ID: Hello, I have not understood how make a bidirectional relationship always in a consistent state. How can I set both pointers at the same time? Thanks. From boris at codesynthesis.com Tue Nov 26 05:21:34 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Nov 26 05:23:40 2019 Subject: [odb-users] relationship always in a consistent state In-Reply-To: References: Message-ID: blob blob writes: > I have not understood how make a bidirectional relationship always > in a consistent state. How can I set both pointers at the same time? You need to be more specific about what you want to achieve: Are you talking about setting the pointers in the C++ object model or about setting the corresponding foreign keys in the database. Both? Something else entirely? From blob84 at gmail.com Tue Nov 26 13:24:22 2019 From: blob84 at gmail.com (blob blob) Date: Tue Nov 26 13:26:47 2019 Subject: [odb-users] relationship always in a consistent state In-Reply-To: References: Message-ID: I mean setting the pointers in the C++ object model, I want to update both pointers at the same time, like the 6.2 of the odb manual. I need a more concrete explanation. Thank you. Il giorno mar 26 nov 2019 alle ore 11:21 Boris Kolpackov < boris@codesynthesis.com> ha scritto: > blob blob writes: > > > I have not understood how make a bidirectional relationship always > > in a consistent state. How can I set both pointers at the same time? > > You need to be more specific about what you want to achieve: Are you > talking about setting the pointers in the C++ object model or about > setting the corresponding foreign keys in the database. Both? Something > else entirely? > From boris at codesynthesis.com Wed Nov 27 08:27:51 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Nov 27 08:30:02 2019 Subject: [odb-users] relationship always in a consistent state In-Reply-To: References: Message-ID: blob blob writes: > I mean setting the pointers in the C++ object model, I want to update both > pointers at the same time, like the 6.2 of the odb manual. The best you can do is make the data members private and then have a modifier in one class that sets both pointers (you will also need to make this class a friend of the other class so that it can access the private member). From alain.mari at se.com Thu Nov 28 08:22:07 2019 From: alain.mari at se.com (ALAIN MARI) Date: Thu Nov 28 09:15:04 2019 Subject: [odb-users] odb compiler and Windows SDK headers Message-ID: We currently try to port our Windows software to ODB. But many of our classes have specific Windows types like VARIANT which are defined in Windows SDK include. These types concern only methods parameters types, not fields types that we want to persist. As odb compiler uses its own headers (mingw), is it safe to try to include Windows headers also ? Regards. Alain. From boris at codesynthesis.com Thu Nov 28 09:21:04 2019 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Nov 28 09:23:20 2019 Subject: [odb-users] odb compiler and Windows SDK headers In-Reply-To: References: Message-ID: ALAIN MARI writes: > But many of our classes have specific Windows types like VARIANT which > are defined in Windows SDK include. These types concern only methods > parameters types, not fields types that we want to persist. As odb > compiler uses its own headers (mingw), is it safe to try to include > Windows headers also ? I think this should work for the commonly used stuff. In particular, MinGW has a fairly complete Win32 API headers but more recent and/or esoteric stuff (e.g., COM) is anyone's guess. If you do run into issues, you can work around them by conditionally excluding parts of your headers during ODB compilation with the ODB_COMPILER macro. For example: class object { #ifndef ODB_COMPILER ... // Windows-specific stuff. #endif private: ... // Data member. }; It's not pretty but reliable.