From boris at codesynthesis.com Wed Nov 1 09:46:06 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Nov 1 09:36:55 2023 Subject: [odb-users] Invalid postgresql type with `[` on odb 2.5.0 In-Reply-To: References: Message-ID: Jarryd Beck writes: > We have been using odb 2.4.0 for a long time in some of our code, > and I was looking at updating this to 2.5.0. I have tried both > odb-2.5.0-b.19+2 and odb-2.5.0-b.25. The compiler is failing with > this error: > > src/schema/inst_schema.h:321:30: error: invalid PostgreSQL type declaration: unexpected character '[' > > it is coming from this piece of code: > > #pragma db type("TEXT[]") > std::vector attr; I get the same error until I add something along these lines: #pragma db map type("TEXT *\\[(\\d*)\\]") \ as("TEXT") \ to("(?)::TEXT[$1]") \ from("(?)::TEXT") I am pretty sure you will get the same error in 2.4.0 without such a mapping. So it looks like it's not in effect in your build when using 2.5.0 for some reason? For background, see: https://www.codesynthesis.com/products/odb/doc/manual.xhtml#14.8 From jarryd.beck at akunacapital.com Wed Nov 1 17:27:45 2023 From: jarryd.beck at akunacapital.com (Jarryd Beck) Date: Thu Nov 2 07:10:13 2023 Subject: [odb-users] Invalid postgresql type with `[` on odb 2.5.0 In-Reply-To: References: Message-ID: > it is coming from this piece of code: > > #pragma db type("TEXT[]") > std::vector attr; I get the same error until I add something along these lines: #pragma db map type("TEXT *\\[(\\d*)\\]") \ as("TEXT") \ to("(?)::TEXT[$1]") \ from("(?)::TEXT") I am pretty sure you will get the same error in 2.4.0 without such a mapping. So it looks like it's not in effect in your build when using 2.5.0 for some reason? That?s interesting, we have this in our code: #pragma db map type("TEXT *\\[([^]]*)\\]") \ as("TEXT") \ to("(?)::TEXT[$1]") \ from("(?)::TEXT") so I?ll have to try to work out why this isn?t working in 2.5.0. ________________________________ [http://www.akunacapital.com/wp-content/uploads/2018/04/akuna-logo_email-signature_4-3-18.png] Jarryd Beck | Senior Software Engineer Akuna Capital Level 10 / 1 Shelley St Sydney NSW 2000 | www.akunacapital.com p: | m: | f: | jarryd.beck@akunacapital.com Learn More About the New Wave in Tech and Trading Visit Us- A 360? Virtual Reality Experience [http://www.akunacapital.com/images/linkedin.png] [http://www.akunacapital.com/images/facebook.png] [http://www.akunacapital.com/images/instagram.png] [http://www.akunacapital.com/images/twitter.png] Please consider the environment before printing this email. This electronic message contains information from Akuna Capital LLC that may be confidential, legally privileged or otherwise protected from disclosure. This information is intended for the use of the addressee only and is not offered as investment advice to be relied upon for personal or professional use. Additionally, all electronic messages are recorded and stored in compliance pursuant to applicable SEC rules. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, printing or any other use of, or any action in reliance on, the contents of this electronic message is strictly prohibited. If you have received this communication in error, please notify us by telephone at (312)994- 4640 and destroy the original message. From jarryd.beck at akunacapital.com Wed Nov 1 18:00:07 2023 From: jarryd.beck at akunacapital.com (Jarryd Beck) Date: Thu Nov 2 07:10:13 2023 Subject: [odb-users] Invalid postgresql type with `[` on odb 2.5.0 In-Reply-To: References: Message-ID: That?s interesting, we have this in our code: #pragma db map type("TEXT *\\[([^]]*)\\]") \ as("TEXT") \ to("(?)::TEXT[$1]") \ from("(?)::TEXT") so I?ll have to try to work out why this isn?t working in 2.5.0. Oh wow, that regex has a typo in it, and it has been wrong and worked for 6 years. Thanks for the clues that helped me track that one down. ________________________________ [http://www.akunacapital.com/wp-content/uploads/2018/04/akuna-logo_email-signature_4-3-18.png] Jarryd Beck | Senior Software Engineer Akuna Capital Level 10 / 1 Shelley St Sydney NSW 2000 | www.akunacapital.com p: | m: | f: | jarryd.beck@akunacapital.com Learn More About the New Wave in Tech and Trading Visit Us- A 360? Virtual Reality Experience [http://www.akunacapital.com/images/linkedin.png] [http://www.akunacapital.com/images/facebook.png] [http://www.akunacapital.com/images/instagram.png] [http://www.akunacapital.com/images/twitter.png] Please consider the environment before printing this email. This electronic message contains information from Akuna Capital LLC that may be confidential, legally privileged or otherwise protected from disclosure. This information is intended for the use of the addressee only and is not offered as investment advice to be relied upon for personal or professional use. Additionally, all electronic messages are recorded and stored in compliance pursuant to applicable SEC rules. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, printing or any other use of, or any action in reliance on, the contents of this electronic message is strictly prohibited. If you have received this communication in error, please notify us by telephone at (312)994- 4640 and destroy the original message. From jarryd.beck at akunacapital.com Wed Nov 1 17:34:39 2023 From: jarryd.beck at akunacapital.com (Jarryd Beck) Date: Fri Nov 3 06:30:46 2023 Subject: [odb-users] Containers of containers not supported in 2.5.0 Message-ID: One piece of our code which is working fine with odb 2.4.0 fails to compile in 2.5.0 with: schema/expiration_parameters.h:1487:29: error: containers of containers not supported We have some structs that have vectors in them, and those types themselves appear in a vector. Is this no longer supported, or is there something I need to do to make this work? Thanks, Jarryd Beck. ________________________________ [http://www.akunacapital.com/wp-content/uploads/2018/04/akuna-logo_email-signature_4-3-18.png] Jarryd Beck | Senior Software Engineer Akuna Capital Level 10 / 1 Shelley St Sydney NSW 2000 | www.akunacapital.com p: | m: | f: | jarryd.beck@akunacapital.com Learn More About the New Wave in Tech and Trading Visit Us- A 360? Virtual Reality Experience [http://www.akunacapital.com/images/linkedin.png] [http://www.akunacapital.com/images/facebook.png] [http://www.akunacapital.com/images/instagram.png] [http://www.akunacapital.com/images/twitter.png] Please consider the environment before printing this email. This electronic message contains information from Akuna Capital LLC that may be confidential, legally privileged or otherwise protected from disclosure. This information is intended for the use of the addressee only and is not offered as investment advice to be relied upon for personal or professional use. Additionally, all electronic messages are recorded and stored in compliance pursuant to applicable SEC rules. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, printing or any other use of, or any action in reliance on, the contents of this electronic message is strictly prohibited. If you have received this communication in error, please notify us by telephone at (312)994- 4640 and destroy the original message. From odb at a-cunningham.com Fri Nov 3 13:44:51 2023 From: odb at a-cunningham.com (Andrew Cunningham) Date: Fri Nov 3 13:36:05 2023 Subject: [odb-users] Questions on object_not_persistent exception In-Reply-To: References: Message-ID: Hi Reilly, With SQLite make sure you have PRAGMA foreign_keys=ON Secondly using PRAGMA integrity_check to validate the database can be helpful to isolate issues. Andrew On Mon, Oct 30, 2023 at 1:34?AM Reilly He wrote: > > Hi Boris, > > We recently encountered the '*object_not_persistent*' exceptions when using > odb. > After reading through the manual, especially the chapter: > > - 3.9: Loading Persistent Objects > - 3.10: Updating Persistent Objects > - 3.11: Deleting Persistent Objects > > We know that we might R/U/D some ORM objects that do not exist in the > database. > But it is really hard to find the detailed biz logic which triggers this > error. > > Based on the manual, the exception itself looks like this: > > > struct object_not_persistent: exception { > > > > virtual const char* > > > > what () const throw (); }; > > > > And based on the descriptions on the manual: > > > *Catching this exception guarantees that we will catch all the exceptions > > thrown by ODB. The what() function returns a human-readable description of > > the condition that triggered the exception. * > > > We still find it not enough to quickly detect who triggers the exception. > > Do you know how to get more information when this exception happens? *Like > the id, or the operation (R/U/D), or even the type of the Model?* > > Thanks a lot. > > Best Regards, > Reilly He From boris at codesynthesis.com Mon Nov 6 08:16:41 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Nov 6 08:07:28 2023 Subject: [odb-users] Containers of containers not supported in 2.5.0 In-Reply-To: References: Message-ID: Jarryd Beck writes: > One piece of our code which is working fine with odb 2.4.0 fails to > compile in 2.5.0 with: > schema/expiration_parameters.h:1487:29: error: containers of containers > not supported > > We have some structs that have vectors in them, and those types themselves > appear in a vector. > > Is this no longer supported, or is there something I need to do to make > this work? ODB 2.4.0 does not support nested containers (2.5.0 has basic/manual support; see the NEWS file for details). I believe 2.4.0 did not check for containers of containers in certain cases, which we fixed in 2.5.0. And this is the reason for the error. I suggest that you check if you got any database schema objects for the nested vectors in question (a container is normally mapped to a table). If you didn't, then that means 2.4.0 simply ignored them. To get the same behavior in 2.5.0 you will need to mark them as transient with a pragma: https://www.codesynthesis.com/products/odb/doc/manual.xhtml#14.4.11 From intord at gmail.com Thu Nov 9 04:24:22 2023 From: intord at gmail.com (Alex B) Date: Thu Nov 9 04:15:53 2023 Subject: [odb-users] QT config Message-ID: Hi guys, trying to setup a simple QT project in QtCreator and got this error from one of the odb files (screenshot would be a lot better, but since it is not allowed, I am posting only the error). Basically, odb compiler cannot find the correct path to the QtCore folder, which I added to the $PATH etc, but no luck. I do not see any param for the odb compiler to specify that as well. How can it be resolved? admin@gentoo ~/QTProjects/odb-qt $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/16/bin:/opt/openjdk-bin-17/bin::/usr/include/qt5:/usr/lib64/qt5 admin@gentoo ~/QTProjects/odb-qt $ odb --std c++11 --profile qt -d sqlite --generate-query property.h In file included from :1: /usr/local/include/odb/qt/basic/sqlite/default-mapping.hxx:7:10: fatal error: QtCore/QString: No such file or directory 7 | #include | ^~~~~~~~~~~~~~~~ compilation terminated. admin@gentoo ~/QTProjects/odb-qt $ odb --std c++11 --profile qt/basic -d sqlite --generate-query property.h In file included from :1: /usr/local/include/odb/qt/basic/sqlite/default-mapping.hxx:7:10: fatal error: QtCore/QString: No such file or directory 7 | #include | ^~~~~~~~~~~~~~~~ compilation terminated. admin@gentoo ~/QTProjects/odb-qt $ odb --std c++11 -d sqlite --generate-query property.h property.h:4:10: fatal error: QString: No such file or directory 4 | #include | ^~~~~~~~~ compilation terminated. admin@gentoo ~/QTProjects/odb-qt $ From boris at codesynthesis.com Thu Nov 9 07:54:52 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Nov 9 07:45:35 2023 Subject: [odb-users] QT config In-Reply-To: References: Message-ID: Alex B writes: > Basically, odb compiler cannot find the correct path to the QtCore > folder, which I added to the $PATH etc, but no luck. I do not see > any param for the odb compiler to specify that as well. > > admin@gentoo ~/QTProjects/odb-qt $ echo $PATH > [...]:/usr/include/qt5:/usr/lib64/qt5 > admin@gentoo ~/QTProjects/odb-qt $ odb --std c++11 --profile qt -d sqlite > --generate-query property.h PATH is not the right place to add the header (/usr/include/qt5) and library (/usr/lib64/qt5) search paths. Try to add -I/usr/include/qt5 to the ODB command line: odb -I/usr/include/qt5 --std c++11 --profile qt -d sqlite \ --generate-query property.h From intord at gmail.com Thu Nov 9 12:36:19 2023 From: intord at gmail.com (Alex B) Date: Thu Nov 9 12:27:40 2023 Subject: [odb-users] QT config In-Reply-To: References: Message-ID: ok here is what i got: admin@gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 --std c++11 --profile qt -d sqlite \ --generate-query property.h In file included from /usr/include/qt5/QtCore/qchar.h:43, from /usr/include/qt5/QtCore/qstring.h:49, from /usr/include/qt5/QtCore/QString:1, from /usr/local/include/odb/qt/basic/sqlite/default-mapping.hxx:7, from :1: /usr/include/qt5/QtCore/qglobal.h:1289:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC (and not with -fPIE)." 1289 | # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\ | ^~~~~ property.h:4:10: fatal error: QString: No such file or directory 4 | #include | ^~~~~~~~~ compilation terminated. admin@gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 --std c++11 --profile qt -d sqlite --generate-query property.h In file included from /usr/include/qt5/QtCore/qchar.h:43, from /usr/include/qt5/QtCore/qstring.h:49, from /usr/include/qt5/QtCore/QString:1, from /usr/local/include/odb/qt/basic/sqlite/default-mapping.hxx:7, from :1: /usr/include/qt5/QtCore/qglobal.h:1289:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC (and not with -fPIE)." 1289 | # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\ | ^~~~~ property.h:4:10: fatal error: QString: No such file or directory 4 | #include | ^~~~~~~~~ compilation terminated. admin@gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 -fPIC --std c++11 --profile qt -d sqlite --generate-query property.h unknown option '-f' admin@gentoo ~/QTProjects/odb-qt $ so i found your answer here: https://odb-users.codesynthesis.narkive.com/dSmA1FfR/problem-compiling-with-qt and tried, but still get the same error: admin@gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 -x -fPIC --std c++11 --profile qt -d sqlite --generate-query property.h property.h:4:10: fatal error: QString: No such file or directory 4 | #include | ^~~~~~~~~ compilation terminated. admin@gentoo ~/QTProjects/odb-qt $ admin@gentoo ~/QTProjects/odb-qt $ odb -x -fPIC -I/usr/include/qt5 --std c++11 --profile qt -d sqlite --generate-query property.h property.h:4:10: fatal error: QString: No such file or directory 4 | #include | ^~~~~~~~~ compilation terminated. seems like it still should be added soomewhere in the odb makefile like suggested here: https://stackoverflow.com/questions/15978608/qt-compile-your-code-with-fpic-or-fpie On Thu, Nov 9, 2023 at 7:54?AM Boris Kolpackov wrote: > Alex B writes: > > > Basically, odb compiler cannot find the correct path to the QtCore > > folder, which I added to the $PATH etc, but no luck. I do not see > > any param for the odb compiler to specify that as well. > > > > admin@gentoo ~/QTProjects/odb-qt $ echo $PATH > > [...]:/usr/include/qt5:/usr/lib64/qt5 > > admin@gentoo ~/QTProjects/odb-qt $ odb --std c++11 --profile qt -d > sqlite > > --generate-query property.h > > PATH is not the right place to add the header (/usr/include/qt5) and > library (/usr/lib64/qt5) search paths. Try to add -I/usr/include/qt5 > to the ODB command line: > > odb -I/usr/include/qt5 --std c++11 --profile qt -d sqlite \ > --generate-query property.h > From intord at gmail.com Thu Nov 9 12:56:03 2023 From: intord at gmail.com (Alex B) Date: Thu Nov 9 12:47:33 2023 Subject: [odb-users] QT config In-Reply-To: References: Message-ID: actually it worked when i added the full path for the QString #include which is not required on the Qt side. thx On Thu, Nov 9, 2023 at 12:36?PM Alex B wrote: > ok here is what i got: > > admin@gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 --std c++11 > --profile qt -d sqlite \ > --generate-query property.h > In file included from /usr/include/qt5/QtCore/qchar.h:43, > from /usr/include/qt5/QtCore/qstring.h:49, > from /usr/include/qt5/QtCore/QString:1, > from > /usr/local/include/odb/qt/basic/sqlite/default-mapping.hxx:7, > from :1: > /usr/include/qt5/QtCore/qglobal.h:1289:4: error: #error "You must build > your code with position independent code if Qt was built with > -reduce-relocations. " "Compile your code with -fPIC (and not with -fPIE)." > 1289 | # error "You must build your code with position independent code > if Qt was built with -reduce-relocations. "\ > | ^~~~~ > property.h:4:10: fatal error: QString: No such file or directory > 4 | #include > | ^~~~~~~~~ > compilation terminated. > admin@gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 --std c++11 > --profile qt -d sqlite --generate-query property.h > In file included from /usr/include/qt5/QtCore/qchar.h:43, > from /usr/include/qt5/QtCore/qstring.h:49, > from /usr/include/qt5/QtCore/QString:1, > from > /usr/local/include/odb/qt/basic/sqlite/default-mapping.hxx:7, > from :1: > /usr/include/qt5/QtCore/qglobal.h:1289:4: error: #error "You must build > your code with position independent code if Qt was built with > -reduce-relocations. " "Compile your code with -fPIC (and not with -fPIE)." > 1289 | # error "You must build your code with position independent code > if Qt was built with -reduce-relocations. "\ > | ^~~~~ > property.h:4:10: fatal error: QString: No such file or directory > 4 | #include > | ^~~~~~~~~ > compilation terminated. > admin@gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 -fPIC --std > c++11 --profile qt -d sqlite --generate-query property.h > unknown option '-f' > admin@gentoo ~/QTProjects/odb-qt $ > > so i found your answer here: > https://odb-users.codesynthesis.narkive.com/dSmA1FfR/problem-compiling-with-qt > and tried, but still get the same error: > > admin@gentoo ~/QTProjects/odb-qt $ odb -I/usr/include/qt5 -x -fPIC --std > c++11 --profile qt -d sqlite --generate-query property.h > property.h:4:10: fatal error: QString: No such file or directory > 4 | #include > | ^~~~~~~~~ > compilation terminated. > admin@gentoo ~/QTProjects/odb-qt $ > admin@gentoo ~/QTProjects/odb-qt $ odb -x -fPIC -I/usr/include/qt5 --std > c++11 --profile qt -d sqlite --generate-query property.h > property.h:4:10: fatal error: QString: No such file or directory > 4 | #include > | ^~~~~~~~~ > compilation terminated. > > seems like it still should be added soomewhere in the odb makefile like > suggested here: > > https://stackoverflow.com/questions/15978608/qt-compile-your-code-with-fpic-or-fpie > > > > On Thu, Nov 9, 2023 at 7:54?AM Boris Kolpackov > wrote: > >> Alex B writes: >> >> > Basically, odb compiler cannot find the correct path to the QtCore >> > folder, which I added to the $PATH etc, but no luck. I do not see >> > any param for the odb compiler to specify that as well. >> > >> > admin@gentoo ~/QTProjects/odb-qt $ echo $PATH >> > [...]:/usr/include/qt5:/usr/lib64/qt5 >> > admin@gentoo ~/QTProjects/odb-qt $ odb --std c++11 --profile qt -d >> sqlite >> > --generate-query property.h >> >> PATH is not the right place to add the header (/usr/include/qt5) and >> library (/usr/lib64/qt5) search paths. Try to add -I/usr/include/qt5 >> to the ODB command line: >> >> odb -I/usr/include/qt5 --std c++11 --profile qt -d sqlite \ >> --generate-query property.h >> > From javier.gutierrez at web.de Mon Nov 13 04:10:32 2023 From: javier.gutierrez at web.de (Javier Gutierrez) Date: Mon Nov 13 04:01:22 2023 Subject: [odb-users] Question about sessions Message-ID: <04f501da1611$411f0ce0$c35d26a0$@web.de> Hi Boris, As I understand when using persist(), load(), find() or loaded by query the session-enabled object's pointer is stored in the session. Can you confirm if following works? person p ("John", "Doe"); // Does this need to be a pointer in order to work? session s; transaction t (db.begin ()); unsigned long id (db.persist (p)) // p is cached in s. t.commit (); // typedef odb::query query; typedef odb::result result; query q (query::first == "John" && query::last == "Doe"); result r (db.query (q)); // Does this retrieve from session? Additionally, is there a way to check how many objects are stored in the session (using the out of the box session class) ? Thanks in advance. Best regards, Javier Gutierrez From jarryd.beck at akunacapital.com Thu Nov 9 21:18:52 2023 From: jarryd.beck at akunacapital.com (Jarryd Beck) Date: Mon Nov 13 06:10:43 2023 Subject: [odb-users] Containers of containers not supported in 2.5.0 In-Reply-To: References: Message-ID: ODB 2.4.0 does not support nested containers (2.5.0 has basic/manual support; see the NEWS file for details). I believe 2.4.0 did not check for containers of containers in certain cases, which we fixed in 2.5.0. And this is the reason for the error. I suggest that you check if you got any database schema objects for the nested vectors in question (a container is normally mapped to a table). If you didn't, then that means 2.4.0 simply ignored them. To get the same behavior in 2.5.0 you will need to mark them as transient with a pragma: Thanks, it looks like those parts of the tables were silently ignored and they were never persisted to the database. Thankfully the relevant code is no longer used and I can just delete them instead. ________________________________ [http://www.akunacapital.com/wp-content/uploads/2018/04/akuna-logo_email-signature_4-3-18.png] Jarryd Beck | Senior Software Engineer Akuna Capital Level 10 / 1 Shelley St Sydney NSW 2000 | www.akunacapital.com p: | m: | f: | jarryd.beck@akunacapital.com Learn More About the New Wave in Tech and Trading Visit Us- A 360? Virtual Reality Experience [http://www.akunacapital.com/images/linkedin.png] [http://www.akunacapital.com/images/facebook.png] [http://www.akunacapital.com/images/instagram.png] [http://www.akunacapital.com/images/twitter.png] Please consider the environment before printing this email. This electronic message contains information from Akuna Capital LLC that may be confidential, legally privileged or otherwise protected from disclosure. This information is intended for the use of the addressee only and is not offered as investment advice to be relied upon for personal or professional use. Additionally, all electronic messages are recorded and stored in compliance pursuant to applicable SEC rules. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, printing or any other use of, or any action in reliance on, the contents of this electronic message is strictly prohibited. If you have received this communication in error, please notify us by telephone at (312)994- 4640 and destroy the original message. From boris at codesynthesis.com Tue Nov 14 06:08:55 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Nov 14 05:59:38 2023 Subject: [odb-users] Question about sessions In-Reply-To: <04f501da1611$411f0ce0$c35d26a0$@web.de> References: <04f501da1611$411f0ce0$c35d26a0$@web.de> Message-ID: Javier Gutierrez writes: > As I understand when using persist(), load(), find() or loaded by query the > session-enabled object's pointer is stored in the session. > Can you confirm if following works? > > person p ("John", "Doe"); // Does this need to be a pointer in order to work? > session s; > transaction t (db.begin ()); > unsigned long id (db.persist (p)) // p is cached in s. > t.commit (); >From Section 11.1, "Object Cache": "The per-object caching policies depend on the object pointer kind (Section 6.5, "Using Custom Smart Pointers"). Objects with a unique pointer, such as std::auto_ptr or std::unique_ptr, as an object pointer are never cached since it is not possible to have two such pointers pointing to the same object. When an object is persisted via a pointer or loaded as a dynamically allocated instance, objects with both raw and shared pointers as object pointers are cached. If an object is persisted as a reference or loaded into a pre-allocated instance, the object is only cached if its object pointer is a raw pointer." https://www.codesynthesis.com/products/odb/doc/manual.xhtml#11 > typedef odb::query query; > typedef odb::result result; > query q (query::first == "John" && query::last == "Doe"); > result r (db.query (q)); // Does this retrieve from session? If it is cached, then yes. > Additionally, is there a way to check how many objects are stored in the > session (using the out of the box session class) ? If you look at , you will see the following API: // Low-level object cache access (iteration, etc). // public: typedef std::map, details::type_info_comparator> type_map; typedef std::map database_map; database_map& map () {return db_map_;} const database_map& map () const {return db_map_;} While it doesn't provide the count directly, you should be able to calculate it with a bit of effort. From uwe.kindler at cetoni.de Tue Nov 14 10:20:35 2023 From: uwe.kindler at cetoni.de (CETONI GmbH - Uwe Kindler) Date: Wed Nov 15 08:34:43 2023 Subject: [odb-users] Qt6: error: redefinition of 'class odb::access::container_traits Message-ID: Hi, we are just switching from Qt5 to Qt6 and therefore upgraded from QDB 2.4.0 to 2.5.0. If we compile our library with Qt5, everything is fine. If we compile with Qt6, we see lots of these issues: ... ../../../../mingw1120_64_qt6/usr/include/odb/qt/containers/qvector-traits.hxx:16:17: error: redefinition of 'class odb::access::container_traits >' ?? 16 |?? class access::container_traits > ... This is caused by the include files of the generated Class-odb.h files: #if ODB_QT_VERSION != 2047500 // 2.5.0-b.25 #? error ODB and C++ compilers see different libodb-qt interface versions #endif #include #include ... The generated header files include the odb container traits files such as qlist-traits.hxx and qvector-traits.hxx. The problem here is, that in Qt6 QVector is just a typedef for QList (snipped from Qt source): ... template using QVector = QList; ... I could fix this by wrapping the code in qvector-traits.hxx into: #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) ... #endif But I'm not sure, if this is the right solution. From boris at codesynthesis.com Thu Nov 16 07:15:03 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Nov 16 07:05:46 2023 Subject: [odb-users] Qt6: error: redefinition of 'class odb::access::container_traits In-Reply-To: References: Message-ID: CETONI GmbH - Uwe Kindler writes: > The generated header files include the odb container traits files such as > qlist-traits.hxx and qvector-traits.hxx. The problem here is, that in Qt6 > QVector is just a typedef for QList (snipped from Qt source): > > ... > template using QVector = QList; > ... Thanks for the bug report and the analysis. > I could fix this by wrapping the code in qvector-traits.hxx into: > > #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) > > ... > > #endif > > But I'm not sure, if this is the right solution. Yes, I fixed this slightly differently (but based on the same underlying idea). If you could try this fix and confirm it works as expected for you, that would be helpful: https://git.codesynthesis.com/cgit/odb/libodb-qt/commit/?id=c020bda61fe4a8108772309561d1f8e2f089aec0 From intord at gmail.com Mon Nov 20 03:49:47 2023 From: intord at gmail.com (Alex B) Date: Mon Nov 20 03:41:33 2023 Subject: [odb-users] Issue with uninstall Message-ID: Boris hi, Just wanted to let you know that odb installation caused a severe failure in the compilation process on Gentoo systems because it installs headers in /usr/local/include. I have spent 3 days trying to fix broken builds on my machine and found that once portage reads headers in /usr/local/include, it overwrites current build job and fails. For example, gentoo has migrated to the openssl 3+ a while ago but one of dependencies odb has is openssl 1.1.1 so all portage jobs fail. Accordingly to the Gentoo devs no custom headers must be written to /usr/local/include. I am not sure will you be interested in fixing those, but for now i had to uninstall odb to make the system work normally and here i got another problem - the uninstall script described in bpkg uninstall odb did work once and when i tried to uninstall build2, it failed with the message build2-install-0.16.0.sh: bpkg: unknown command at line 68 at this point i am not sure what to do here - compile build2 again so bpkg will be available? when i tred to do so i got another error message. Anyways, at the end i had to read the build2-install-0.16.0.sh script and tried to remove all manually, but i am not sure did it right. So how can i get the full list of directories/files where build2 has written its files? So far i just removed the compiled odb* and libodb* folders and /usr/loca/include. But what are the others? From boris at codesynthesis.com Mon Nov 20 09:07:02 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Nov 20 08:57:43 2023 Subject: [odb-users] Issue with uninstall In-Reply-To: References: Message-ID: Alex B writes: > Just wanted to let you know that odb installation caused a severe failure > in the compilation process on Gentoo systems because it installs headers in > /usr/local/include. > I have spent 3 days trying to fix broken builds on my machine and found > that once portage reads headers in /usr/local/include, it overwrites > current build job and fails. > For example, gentoo has migrated to the openssl 3+ a while ago but one of > dependencies odb has is openssl 1.1.1 so all portage jobs fail. > Accordingly to the Gentoo devs no custom headers must be written to > /usr/local/include. I am having a hard time understanding exactly what went wrong here but I think what you are saying is that /usr/local/ is used by the Gentoo package manager and one should no install user-built software there? If that's the case, then I suggest you install build2 and ODB somewhere else, naturally. While build2 automates quite a few things, you are still expected to understand what you are doing. In particular, you need to know where it is safe to install user-built software on your system and adjust the build2 command lines accordingly. The /usr/local installation location is not even implicit, you've specified it explicitly in the bpkg-create command with config.install.root variable: bpkg create -d odb-gcc-N cc \ config.cxx=g++ \ config.cc.coptions=-O3 \ config.bin.rpath=/usr/local/lib \ config.install.root=/usr/local \ config.install.sudo=sudo > So far i just removed the compiled odb* and libodb* folders and > /usr/loca/include. But what are the others? I believe removing the following filesystem entries should be sufficient: /usr/local/bin/odb* /usr/local/include/odb/ /usr/local/lib/libodb* /usr/local/share/odb*/ /usr/local/share/doc/odb*/ From intord at gmail.com Mon Nov 20 09:28:20 2023 From: intord at gmail.com (Alex B) Date: Mon Nov 20 09:19:26 2023 Subject: [odb-users] Issue with uninstall In-Reply-To: References: Message-ID: Yes that is correct. Another part of problem is uninstall doesn't work as it should. I tried to explain the steps above. It's not clear from documentation the exact steps of removing everything if needed as a whole process. So once I tried to run the steps from within odb directories, others written for the build2 failed. As for me, that was never tested properly. I mean removing packages processing with the package manager in the Linux system should produce the same result as it was before the install but not in half state. This will potentially put the system in the bad state regardless of Linux distribution. Again I am not sure will you be interested in working on this, but just letting you know. On Mon, Nov 20, 2023, 9:07 AM Boris Kolpackov wrote: > Alex B writes: > > > Just wanted to let you know that odb installation caused a severe failure > > in the compilation process on Gentoo systems because it installs headers > in > > /usr/local/include. > > I have spent 3 days trying to fix broken builds on my machine and found > > that once portage reads headers in /usr/local/include, it overwrites > > current build job and fails. > > For example, gentoo has migrated to the openssl 3+ a while ago but one of > > dependencies odb has is openssl 1.1.1 so all portage jobs fail. > > Accordingly to the Gentoo devs no custom headers must be written to > > /usr/local/include. > > I am having a hard time understanding exactly what went wrong here but > I think what you are saying is that /usr/local/ is used by the Gentoo > package manager and one should no install user-built software there? > If that's the case, then I suggest you install build2 and ODB somewhere > else, naturally. > > While build2 automates quite a few things, you are still expected to > understand what you are doing. In particular, you need to know where > it is safe to install user-built software on your system and adjust > the build2 command lines accordingly. The /usr/local installation > location is not even implicit, you've specified it explicitly in > the bpkg-create command with config.install.root variable: > > bpkg create -d odb-gcc-N cc \ > config.cxx=g++ \ > config.cc.coptions=-O3 \ > config.bin.rpath=/usr/local/lib \ > config.install.root=/usr/local \ > config.install.sudo=sudo > > > > So far i just removed the compiled odb* and libodb* folders and > > /usr/loca/include. But what are the others? > > I believe removing the following filesystem entries should be sufficient: > > /usr/local/bin/odb* > /usr/local/include/odb/ > /usr/local/lib/libodb* > /usr/local/share/odb*/ > /usr/local/share/doc/odb*/ > From boris at codesynthesis.com Tue Nov 21 08:58:31 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Nov 21 08:49:09 2023 Subject: [odb-users] Issue with uninstall In-Reply-To: References: Message-ID: Alex B writes: > Another part of problem is uninstall doesn't work as it should. I tried to > explain the steps above. It's not clear from documentation the exact steps > of removing everything if needed as a whole process. So once I tried to run > the steps from within odb directories, others written for the build2 > failed. As for me, that was never tested properly. I mean removing packages > processing with the package manager in the Linux system should produce the > same result as it was before the install but not in half state. This will > potentially put the system in the bad state regardless of Linux > distribution. Again I am not sure will you be interested in working on > this, but just letting you know. There is nothing to fix and I take personal offense at your suggestion that build2 is just another half-baked build system that cannot even uninstall cleanly. We took great care in making sure uninstall works correctly and reliably and it has been (and is continuously being) "tested properly". Your description of what happened is neither detailed nor precise enough for me to figure out the cause. But if you install/uninstall custom-built software to the same place as the system package manager, sooner or later (and most likely sooner) you will end up with a broken system where nothing makes sense anymore. This is the reason why on most Linux distributions the system package manager installs to /usr/{bin/,lib/,...} while custom-built software goes to /usr/local/{bin/,lib/,...}. Gentoo does it differently, you choose to use it, and it's your responsibility to know to adjust the default installation location, which customarily /usr/local/. From intord at gmail.com Tue Nov 21 10:24:34 2023 From: intord at gmail.com (Alex B) Date: Wed Nov 22 08:08:29 2023 Subject: [odb-users] Issue with uninstall In-Reply-To: References: Message-ID: Listen, your statement about "personal offense" is just funny. Anyways, here is a short story which I thought was not needed here, but here it is. In Gentoo it's not recommended to install software bypassing portage (package manager) and once you will do it, you will always get the message that the system is "in the inconsistent state". Gentoo has ebuild for build2/odb as bundled all in one package here - https://packages.gentoo.org/packages/dev-cpp/libodb - but it does not work correctly. So the first thing I did was install that but it could not even create those .*xx files. Wrote to maintiner, no response. So I had to install manually following instructions on your site and this time it worked. Talking about dir where it's installed - ebuild documentation does not mention anywhere that /usr/local/include might collide with portage processing and that was just pointed to me recently at Gentoo forum. Now, say i will want to make a proper ebuild (this is instructions file used by portage to compile/install software) so i will need to write something in the rm* functions, i.e. which steps portage has to follow to completely remove EVERYTHING from the system to the pre-install state. I tried to guess those steps from your site, while install is clear, uninstall is not that clear at all. So reading your manual I tried this: cd /opt/odb* bpkg uninstall --all --recursive it ran fine for the first time. I still saw a lot of files left in the directories but I guess it is expected? Nest i tried to go to another dir like cd /opt/libodb* bpkg uninstall --all --recursive but got the error. To uninstall the build2 I tried cd /opt/build2 sh build2-install-0.16.0.sh --uninstall and got the message that bpkg is not found at line 67. So what I asked in my last email, if that was tested, can you just provide exact steps which you will be using on the Linux system to uninstall build2/odb from your system. Note - since build2 is an alternative build system and Gentoo already uses gcc + portage, there is no reason to install/uninstall it separately from odb. On Tue, Nov 21, 2023 at 8:58?AM Boris Kolpackov wrote: > Alex B writes: > > > Another part of problem is uninstall doesn't work as it should. I tried > to > > explain the steps above. It's not clear from documentation the exact > steps > > of removing everything if needed as a whole process. So once I tried to > run > > the steps from within odb directories, others written for the build2 > > failed. As for me, that was never tested properly. I mean removing > packages > > processing with the package manager in the Linux system should produce > the > > same result as it was before the install but not in half state. This will > > potentially put the system in the bad state regardless of Linux > > distribution. Again I am not sure will you be interested in working on > > this, but just letting you know. > > There is nothing to fix and I take personal offense at your suggestion > that build2 is just another half-baked build system that cannot even > uninstall cleanly. We took great care in making sure uninstall works > correctly and reliably and it has been (and is continuously being) > "tested properly". > > Your description of what happened is neither detailed nor precise > enough for me to figure out the cause. But if you install/uninstall > custom-built software to the same place as the system package manager, > sooner or later (and most likely sooner) you will end up with a broken > system where nothing makes sense anymore. > > This is the reason why on most Linux distributions the system package > manager installs to /usr/{bin/,lib/,...} while custom-built software > goes to /usr/local/{bin/,lib/,...}. Gentoo does it differently, you > choose to use it, and it's your responsibility to know to adjust the > default installation location, which customarily /usr/local/. > From uwe.kindler at cetoni.de Wed Nov 22 08:01:46 2023 From: uwe.kindler at cetoni.de (CETONI GmbH - Uwe Kindler) Date: Wed Nov 22 08:08:30 2023 Subject: [odb-users] Qt6: error: redefinition of 'class odb::access::container_traits In-Reply-To: References: Message-ID: > CETONI GmbH - Uwe Kindler writes: > >> The generated header files include the odb container traits files such as >> qlist-traits.hxx and qvector-traits.hxx. The problem here is, that in Qt6 >> QVector is just a typedef for QList (snipped from Qt source): >> >> ... >> template using QVector = QList; >> ... > Thanks for the bug report and the analysis. > > >> I could fix this by wrapping the code in qvector-traits.hxx into: >> >> #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) >> >> ... >> >> #endif >> >> But I'm not sure, if this is the right solution. > Yes, I fixed this slightly differently (but based on the same > underlying idea). If you could try this fix and confirm it > works as expected for you, that would be helpful: > > https://git.codesynthesis.com/cgit/odb/libodb-qt/commit/?id=c020bda61fe4a8108772309561d1f8e2f089aec0 I just tested your fix and everything works fine. I think this is the right way to fix this. Thank you.