From anuragg at miltenyi.com Fri Aug 4 18:31:07 2023 From: anuragg at miltenyi.com (Anurag Gupta) Date: Mon Aug 7 09:36:05 2023 Subject: [odb-users] Error when building examples. Message-ID: Hello, I was able to install ODB 2.5.0 beta on my Ubuntu 22.04 with GCC 13.1. Now I'm trying to build the examples by following the instructions provided. I am able to configure the build to use "pgsql" but when I run make command it finishes with errors. Also, lots of warning about using std::auto_ptr. Please check the attached output of make. Thank you! Anurag Gupta -------------- next part -------------- make all-recursive make[1]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0' Making all in access make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/access' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/access' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/access' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/access' Making all in composite make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/composite' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/composite' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/composite' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/composite' Making all in container make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/container' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/container' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/container' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/container' Making all in hello make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/hello' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/hello' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/hello' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/hello' Making all in inheritance/polymorphism make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/inheritance/polymorphism' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/inheritance/polymorphism' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/inheritance/polymorphism' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/inheritance/polymorphism' Making all in inheritance/reuse make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/inheritance/reuse' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/inheritance/reuse' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/inheritance/reuse' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/inheritance/reuse' Making all in query make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/query' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/query' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/query' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/query' Making all in mapping make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/mapping' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/mapping' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/mapping' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/mapping' Making all in optimistic make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/optimistic' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/optimistic' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/optimistic' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/optimistic' Making all in pimpl make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/pimpl' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/pimpl' make[3]: Nothing to be done for 'all-am'. make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/pimpl' make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/pimpl' Making all in prepared make[2]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/prepared' make all-am make[3]: Entering directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/prepared' depbase=`echo driver.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ g++ -DHAVE_CONFIG_H -I'.' -I'.' -DDATABASE_PGSQL -g -O2 -D_REENTRANT -MT driver.o -MD -MP -MF $depbase.Tpo -c -o driver.o driver.cxx &&\ mv -f $depbase.Tpo $depbase.Po In file included from driver.cxx:12: database.hxx:35:13: warning: ???template class std::auto_ptr??? is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations] 35 | inline std::auto_ptr | ^~~~~~~~ In file included from /usr/local/include/c++/13.1.0/memory:78, from driver.cxx:4: /usr/local/include/c++/13.1.0/bits/unique_ptr.h:65:28: note: declared here 65 | template class auto_ptr; | ^~~~~~~~ database.hxx: In function ???std::auto_ptr create_database(int&, char**)???: database.hxx:84:3: warning: ???template class std::auto_ptr??? is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations] 84 | auto_ptr db (new odb::pgsql::database (argc, argv)); | ^~~~~~~~ /usr/local/include/c++/13.1.0/bits/unique_ptr.h:65:28: note: declared here 65 | template class auto_ptr; | ^~~~~~~~ driver.cxx: In function ???void query_factory(const char*, odb::connection&)???: driver.cxx:31:3: warning: ???template class std::auto_ptr??? is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations] 31 | auto_ptr p (new params); | ^~~~~~~~ /usr/local/include/c++/13.1.0/bits/unique_ptr.h:65:28: note: declared here 65 | template class auto_ptr; | ^~~~~~~~ driver.cxx:35:17: error: no matching function for call to ???odb::connection::cache_query(odb::prepared_query&, std::auto_ptr&)??? 35 | c.cache_query (pq, p); | ~~~~~~~~~~~~~~^~~~~~~ In file included from /usr/local/include/odb/database.hxx:28, from driver.cxx:8: /usr/local/include/odb/connection.hxx:78:5: note: candidate: ???template void odb::connection::cache_query(const odb::prepared_query&)??? 78 | cache_query (const prepared_query&); | ^~~~~~~~~~~ /usr/local/include/odb/connection.hxx:78:5: note: template argument deduction/substitution failed: driver.cxx:35:17: note: candidate expects 1 argument, 2 provided 35 | c.cache_query (pq, p); | ~~~~~~~~~~~~~~^~~~~~~ /usr/local/include/odb/connection.hxx:83:5: note: candidate: ???template void odb::connection::cache_query(const odb::prepared_query&, std::unique_ptr

)??? 83 | cache_query (const prepared_query&, std::unique_ptr

params); | ^~~~~~~~~~~ /usr/local/include/odb/connection.hxx:83:5: note: template argument deduction/substitution failed: driver.cxx:35:17: note: ???std::auto_ptr??? is not derived from ???std::unique_ptr

??? 35 | c.cache_query (pq, p); | ~~~~~~~~~~~~~~^~~~~~~ driver.cxx: In function ???int main(int, char**)???: driver.cxx:54:5: warning: ???template class std::auto_ptr??? is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations] 54 | auto_ptr db (create_database (argc, argv)); | ^~~~~~~~ /usr/local/include/c++/13.1.0/bits/unique_ptr.h:65:28: note: declared here 65 | template class auto_ptr; | ^~~~~~~~ driver.cxx:153:9: warning: ???template class std::auto_ptr??? is deprecated: use 'std::unique_ptr' instead [-Wdeprecated-declarations] 153 | auto_ptr p (new unsigned short); | ^~~~~~~~ /usr/local/include/c++/13.1.0/bits/unique_ptr.h:65:28: note: declared here 65 | template class auto_ptr; | ^~~~~~~~ driver.cxx:157:25: error: no matching function for call to ???odb::database::cache_query(prep_query&, std::auto_ptr&)??? 157 | db->cache_query (pq, p); // Assumes ownership of p. | ~~~~~~~~~~~~~~~~^~~~~~~ In file included from /usr/local/include/odb/database.hxx:652: /usr/local/include/odb/database.ixx:682:15: note: candidate: ???template void odb::database::cache_query(const odb::prepared_query&)??? 682 | inline void database:: | ^~~~~~~~ /usr/local/include/odb/database.ixx:682:15: note: template argument deduction/substitution failed: driver.cxx:157:25: note: candidate expects 1 argument, 2 provided 157 | db->cache_query (pq, p); // Assumes ownership of p. | ~~~~~~~~~~~~~~~~^~~~~~~ /usr/local/include/odb/database.hxx:373:5: note: candidate: ???template void odb::database::cache_query(const odb::prepared_query&, std::unique_ptr

)??? 373 | cache_query (const prepared_query&, std::unique_ptr

params); | ^~~~~~~~~~~ /usr/local/include/odb/database.hxx:373:5: note: template argument deduction/substitution failed: driver.cxx:157:25: note: ???std::auto_ptr??? is not derived from ???std::unique_ptr

??? 157 | db->cache_query (pq, p); // Assumes ownership of p. | ~~~~~~~~~~~~~~~~^~~~~~~ make[3]: *** [Makefile:356: driver.o] Error 1 make[3]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/prepared' make[2]: *** [Makefile:299: all] Error 2 make[2]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0/prepared' make[1]: *** [Makefile:368: all-recursive] Error 1 make[1]: Leaving directory '/home/anuragg/ODB_Examples/odb-examples-2.4.0' make: *** [Makefile:297: all] Error 2 From boris at codesynthesis.com Mon Aug 7 09:56:11 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 7 09:46:40 2023 Subject: [odb-users] Error when building examples. In-Reply-To: References: Message-ID: Anurag Gupta writes: > I was able to install ODB 2.5.0 beta on my Ubuntu 22.04 with GCC 13.1. > Now I'm trying to build the examples by following the instructions > provided. I am able to configure the build to use "pgsql" but when > I run make command it finishes with errors. Also, lots of warning > about using std::auto_ptr. Please check the attached output of make. > > [...] > > g++ -DHAVE_CONFIG_H -I'.' -I'.' -DDATABASE_PGSQL -g -O2 -D_REENTRANT -MT driver.o -MD -MP -MF $depbase.Tpo -c -o driver.o driver.cxx You are building examples from ODB 2.4.0 which invoke the ODB compiler in the C++98 mode. We haven't yet migrated examples to build2/C++11 so I think the best option for now is to pick the `c++11` example and then build and run it manually as described in the README that accompanies every example. You should also be able to easily convert other examples to C++11 (or later) by, in most cases, just replacing auto_ptr with unique_ptr and passing `--std c++11` (or later) to the ODB compiler. From anuragg at miltenyi.com Mon Aug 28 17:31:51 2023 From: anuragg at miltenyi.com (Anurag Gupta) Date: Mon Aug 28 20:31:04 2023 Subject: [odb-users] schema version vs object version. Message-ID: Hello, I'm trying to use schema versioning and came across an interesting choice, can I use schema versioning (#pragma db model version (x, x)) and at the same time I can version the objects (#pragma db object pointer (std::shared_ptr) version (x, x) )? what is the recommended way of dealing with object versions? Should they all be tied to model version? Thank you! AG From boris at codesynthesis.com Tue Aug 29 05:51:12 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Aug 29 05:42:11 2023 Subject: [odb-users] schema version vs object version. In-Reply-To: References: Message-ID: Anurag Gupta writes: > I'm trying to use schema versioning and came across an interesting > choice, can I use schema versioning (#pragma db model version (x, x)) > and at the same time I can version the objects (#pragma db object > pointer (std::shared_ptr) version (x, x) )? No, the `version` specifier is not valid for `#pragma db object`. > what is the recommended way of dealing with object versions? Should > they all be tied to model version? Yes, you version the object model, not individual classes. The overall idea and workflow is fairly thoroughly documented in the manual, specifically chapter 13, "Database Schema Evolution": https://www.codesynthesis.com/products/odb/doc/manual.xhtml#13 In particular, take a look at section 13.4, "Soft Object Model Changes", maybe this is what you are looking for: https://www.codesynthesis.com/products/odb/doc/manual.xhtml#13.4 From finjulhich at gmail.com Tue Aug 29 18:42:17 2023 From: finjulhich at gmail.com (MM) Date: Tue Aug 29 18:33:38 2023 Subject: [odb-users] schema evolution, changelog xml and output .sql Message-ID: Whenever I change the schema, I update and then run the odb compiler like so > odb -d sqlite --sqlite-override-null --std c++${CMAKE_CXX_STANDARD} > --profile boost > --omit-drop --generate-query --generate-schema-only --schema-format sql > --at-once -I${CMAKE_SOURCE_DIR} -I${Boost_INCLUDE_DIRS} > --changelog-dir ${CMAKE_CURRENT_SOURCE_DIR} --input-name > ${SRCS_TO_GEN_MYDB} The SRCS include a common .hpp that has > #ifdef ODB_COMPILER > #pragma db model version(OldDate,NewDate) > #endif > When building and no change in the pair OldDate,NewDate, then the odb run doesn't change the changelog xml files and no sql files are changed. However, when I've changed the C++ classes or the odb pragmas, I then change NewDate as OldDate and use today as NewDate. That odb run then updates the changelog xml and the sql files. As part of the cmake based build system, can I examine the odb exit code to see which situation I'm in? From boris at codesynthesis.com Wed Aug 30 02:04:52 2023 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Aug 30 01:55:51 2023 Subject: [odb-users] schema evolution, changelog xml and output .sql In-Reply-To: References: Message-ID: MM writes: > When building and no change in the pair OldDate,NewDate, then the odb run > doesn't change the changelog xml files and no sql files are changed. > > However, when I've changed the C++ classes or the odb pragmas, I then > change NewDate as OldDate and use today as NewDate. That odb run then > updates the changelog xml and the sql files. > > As part of the cmake based build system, can I examine the odb exit code to > see which situation I'm in? No, currently the ODB compiler does not distinguish between these two situations with an exist code. But we could probably add this support if really needed. Though it feels like it should be just as easy to detect this by comparing the changelog file modification times before/after or, alternatively, hashing the changelog file contents and comparing that, if you want a more robust mechanism. From finjulhich at gmail.com Thu Aug 31 04:04:48 2023 From: finjulhich at gmail.com (MM) Date: Thu Aug 31 03:56:06 2023 Subject: [odb-users] odb abstract classes/tables cannot be pointed to Message-ID: Hello class Base1 { Base2* b2; const b2& get_b2() const; void set_b2(Base2&); }; #pragma db object(Base1) abstract definition table("B1") #pragma db member(Base1::b2) not_null column("b2")\ get(&this.get_b2()) set(this.set_b2(*(?))) #pragma db object(Base2) abstract definition table("B2") class Base2 {...}; class D11 : public Base1 {}; class D12 : public Base1 {}; class D21 : public Base2 {}; class D22 : public Base2 {}; #pragma db object(D11) definition #pragma db object(D12) definition #pragma db object(D21) definition #pragma db object(D22) definition odb compiler fails with "pointed-to class 'Base1' is abstract" The error makes sense. How can I go about solving this? all Dxx derived tables are in the database, and will have additional specific columns. However the association 1 to 1 Base1 => Base2 remains true Rds,