From odb at a-cunningham.com Wed Aug 1 13:35:07 2018 From: odb at a-cunningham.com (Andrew Cunningham) Date: Wed Aug 1 13:40:01 2018 Subject: [odb-users] SQlite 3.24.0 Message-ID: This performance enhancement might be interesting for ODB developers using SQLite UPDATE avoids unnecessary low-level disk writes when the contents of the database file do not actually change. For example, "UPDATE t1 SET x=25 WHERE y=?" generates no extra disk I/O if the value in column x is already 25. Similarly, when doing UPDATE on records that span multiple pages, only the subset of pages that actually change are written to disk. This is a low-level performance optimization only and does not affect the behavior of TRIGGERs or other higher level SQL structures. https://www.sqlite.org/releaselog/3_24_0.html From boris at codesynthesis.com Thu Aug 2 06:10:51 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Aug 2 06:15:40 2018 Subject: [odb-users] SQlite 3.24.0 In-Reply-To: References: Message-ID: Andrew Cunningham writes: > This performance enhancement might be interesting for ODB developers using > SQLite [...] Nice, thanks for the heads up, Andrew! From lists at tinloaf.de Thu Aug 2 07:59:15 2018 From: lists at tinloaf.de (Lukas Barth) Date: Thu Aug 2 08:04:15 2018 Subject: [odb-users] Using std::weak_ptr Message-ID: <871d336d-24c6-f870-a0b5-0287983946ed@tinloaf.de> [ This question was cross-posted to StackOverflow. If you want to see the code in a better formatted way and / or grab SO reputation for your answer, head to https://stackoverflow.com/questions/51652818/c-odb-database-mapper-unable-to-use-stdweak-ptr-in-relationship ] Hi, I'm trying to model a one-to-many relationship with ODB. I'm basically trying to recreate the example in https://www.codesynthesis.com/products/odb/doc/manual.xhtml#6.2.2 I have to use std::weak_ptr for one side of the relationship, to avoid circular ownership issues. However, my very simple example code does not compile, as ODB doesn't seem to play nicely with std::weak_ptr. In my example, every Bar has exactly one Foo, while every Foo has multiple Bars. This is my code: ================ [Begin of main.hpp] ================== #include #include #include #include // Forward class Foo; #pragma db object class Bar { public: // A DBConfigKV has exactly *one* DBConfig #pragma db not_null std::shared_ptr cfg; private: #pragma db id auto unsigned long id_; friend class odb::access; }; #pragma db object class Foo { public: // A Foo has multiple Bars // Using std::weak_ptr here instead of std::shared_ptr to avoid // circular ownership #pragma db value_not_null inverse(cfg) std::vector> entries; private: #pragma db id auto unsigned long id_; friend class odb::access; }; int main() {} ================ [End of main.hpp] ================== I generate the database code with > odb --std c++11 --database sqlite --generate-query --generate-schema \ > --at-once main.hpp and compile with > g++ --std=c++11 main.hpp main-odb.cxx (I know that would crash at linking - I'm just trying to get it to compile.) My compiler (GCC 7) tells me: ================ [Begin compiler output] ================== main-odb.cxx: In static member function ?static void odb::access::object_traits_impl::entries_traits::init(odb::access::object_traits_impl::entries_traits::value_type&, const odb::access::object_traits_impl::entries_traits::data_image_type&, odb::database*)?: main-odb.cxx:794:43: error: no matching function for call to ?std::weak_ptr::weak_ptr(odb::object_traits::pointer_type)? obj_traits::object_type > (id)); ^ In file included from /usr/include/c++/5/memory:82:0, from main.hpp:3, from main-odb.hxx:16, from main-odb.cxx:7: /usr/include/c++/5/bits/shared_ptr.h:492:2: note: candidate: template std::weak_ptr<_Tp>::weak_ptr(std::weak_ptr<_Tp1>&&) weak_ptr(weak_ptr<_Tp1>&& __r) noexcept ^ /usr/include/c++/5/bits/shared_ptr.h:492:2: note: template argument deduction/substitution failed: main-odb.cxx:794:43: note: mismatched types ?std::weak_ptr<_Tp>? and ?odb::object_traits::pointer_type {aka Bar*}? obj_traits::object_type > (id)); ================ [End compiler output] ================== There are three more candidates which I skipped. The important part: ODB tries somewhere to create a std::weak_ptr from a Bar *, which is obviously not possible. It would have to create it from a std::shared_ptr. However, the ODB documentation explicitly says one should (and in fact must) use std::weak_ptr in these cases. What am I doing wrong? Thanks a lot, Lukas From finjulhich at gmail.com Thu Aug 2 15:45:20 2018 From: finjulhich at gmail.com (MM) Date: Thu Aug 2 15:50:26 2018 Subject: [odb-users] multiple base classes Message-ID: Hello, I have the following hierarchy: class ELBase { ... }; class EL { ... }; class Derived : public ELBase, public EL { ... }; #pragma db object(ELBase) polymorphic table("eqlogb") transient definition #pragma db object(EL) polymorphic table("eqlog") transient definition #pragma db object(Derived) definition Is this supported? In fact EL is a implementation helper, and while I use ELBase pointers and references, I don't access the objects via EL pointers and references. Rds, From boris at codesynthesis.com Fri Aug 3 10:21:20 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 3 10:26:11 2018 Subject: [odb-users] Using std::weak_ptr In-Reply-To: <871d336d-24c6-f870-a0b5-0287983946ed@tinloaf.de> References: <871d336d-24c6-f870-a0b5-0287983946ed@tinloaf.de> Message-ID: Lukas Barth writes: > main-odb.cxx:794:43: note: mismatched types ?std::weak_ptr<_Tp>? and > ?odb::object_traits::pointer_type {aka Bar*}? > obj_traits::object_type > (id)); > > There are three more candidates which I skipped. The important part: ODB > tries somewhere to create a std::weak_ptr from a Bar *, which is > obviously not possible. It would have to create it from a > std::shared_ptr. However, the ODB documentation explicitly says one > should (and in fact must) use std::weak_ptr in these cases. > > What am I doing wrong? You need to make std::shared_ptr the object pointer for your objects. See Section 3.3, "Object and View Pointers" for details. Boris From boris at codesynthesis.com Fri Aug 3 10:27:41 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 3 10:32:31 2018 Subject: [odb-users] multiple base classes In-Reply-To: References: Message-ID: MM writes: > class ELBase { ... }; > class EL { ... }; > > class Derived : public ELBase, public EL { ... }; > > #pragma db object(ELBase) polymorphic table("eqlogb") transient definition > #pragma db object(EL) polymorphic table("eqlog") transient definition > > #pragma db object(Derived) definition > > Is this supported? Section 8.2, "Polymorphism Inheritance", fourth paragraph: "Note that multiple polymorphism inheritance or mixing polymorphism and reuse inheritance is not supported." > In fact EL is a implementation helper, and while I use ELBase pointers and > references, I don't access the objects via EL pointers and references. Then you cat try to make EL a transient base and persist its data members as if they were in Derived (using virtual data member). From finjulhich at gmail.com Fri Aug 3 14:21:42 2018 From: finjulhich at gmail.com (MM) Date: Fri Aug 3 14:26:52 2018 Subject: [odb-users] internal compiler error: cult:compiler::context::no_entry Message-ID: For the purposes of preparing a small self-sufficient test case to diagnose this issue, with 2.5.0-b3 taken and compiled from https://codesynthesis.com/~boris/tmp/odb/pre-release/, I have this question. Currently, I call odb compiler like so: odb -d sqlite --sqlite-override-null --std c++14 --profile boost --omit-drop --generate-query --generate-schema-only --schema-format sql --at-once -I/src -I/usr/include --changelog-dir /src/odb --options-file /src/vendors/odb/boost-multiarray.options --input-name mydbname /src/file_1.hpp ... /src/file_n.hpp terminate called after throwing an instance of 'cutl::compiler::context::no_entry' /src/file_M.hpp:20:12: internal compiler error: Aborted #pragma db member(prtfelt::strat) virtual(blitzq::nstring) \ This is just to generate the schema, not c++ is generated. Does the odb compiler use each header file argument separately? or does it concatenate all the headers to produce the SQL. This can help me understand how to focus on the smallest test case to report. Thanks, From boris at codesynthesis.com Mon Aug 6 08:13:14 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 6 08:18:17 2018 Subject: [odb-users] internal compiler error: cult:compiler::context::no_entry In-Reply-To: References: Message-ID: MM writes: > odb -d sqlite --sqlite-override-null --std c++14 --profile boost > --omit-drop --generate-query --generate-schema-only --schema-format sql > --at-once -I/src -I/usr/include --changelog-dir /src/odb --options-file > /src/vendors/odb/boost-multiarray.options --input-name mydbname > /src/file_1.hpp ... /src/file_n.hpp > > Does the odb compiler use each header file argument separately? or does it > concatenate all the headers to produce the SQL. Since you have specified the --at-once option, they are effectively concatenated in the order specified on the command line. From adanesh at noornet.net Sat Aug 25 03:49:41 2018 From: adanesh at noornet.net (=?utf-8?B?2LnZhNuMINiv2KfZhti0?=) Date: Sat Aug 25 03:56:14 2018 Subject: [odb-users] Is C++17 supported? Message-ID: Hi Boris! According to this link https://www.codesynthesis.com/pipermail/odb-users/2018-March/003973.html, c++17 must be supported; But: C:\odb-2.5.0-b.3-i686-windows\bin>odb --std c++17 invalid value 'c++17' for option '--std' And when I include ?optional? in a header file, it generates an error: fatal error: optional: No such file or directory Best regards, Ali From boris at codesynthesis.com Mon Aug 27 09:13:43 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 27 09:19:53 2018 Subject: [odb-users] Is C++17 supported? In-Reply-To: References: Message-ID: adanesh@noornet.net writes: > C:\odb-2.5.0-b.3-i686-windows\bin>odb --std c++17 > invalid value 'c++17' for option '--std' 2.5.0-b.3 is too old. Try building the latest snapshot using these instructions: https://codesynthesis.com/products/odb/doc/install-build2.xhtml This will give you both --std c++17 and a recent enough GCC (for the ODB compiler) to be able to use it. From thomas.baudier at creatis.insa-lyon.fr Tue Aug 28 10:44:07 2018 From: thomas.baudier at creatis.insa-lyon.fr (Thomas BAUDIER) Date: Tue Aug 28 10:50:29 2018 Subject: [odb-users] No gcc-plugin support Message-ID: <9a173c5ebec6c332774cd0747b112e8f@pop3.creatis.insa-lyon.fr> Hi, I wanted to install odb using build2 (https://codesynthesis.com/products/odb/doc/install-build2.xhtml#linux). I use OpenSuse LEAP 15 but the gcc-plugin-devel is not available for this platform. How can install latest odb version without gcc-plugin support? Thank you for your help Thomas From boris at codesynthesis.com Tue Aug 28 14:36:22 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Aug 28 14:42:35 2018 Subject: [odb-users] No gcc-plugin support In-Reply-To: <9a173c5ebec6c332774cd0747b112e8f@pop3.creatis.insa-lyon.fr> References: <9a173c5ebec6c332774cd0747b112e8f@pop3.creatis.insa-lyon.fr> Message-ID: Thomas BAUDIER writes: > I wanted to install odb using build2 > (https://codesynthesis.com/products/odb/doc/install-build2.xhtml#linux). I > use OpenSuse LEAP 15 but the gcc-plugin-devel is not available for this > platform. Yes, last time I've heard SUSE was disabling support for plugins in their build of GCC. > How can install latest odb version without gcc-plugin support? You can't. The ODB compiler relies on GCC plugin support for parsing C++ code. Going forward, your options seem to be (1) to check if maybe SUSE (or someone else) provides a build of GCC with plugins enabled or (2) build GCC from source yourself (it's actually not that hard). Boris From finjulhich at gmail.com Wed Aug 29 15:56:40 2018 From: finjulhich at gmail.com (MM) Date: Wed Aug 29 16:03:13 2018 Subject: [odb-users] internal compiler error: cult:compiler::context::no_entry Message-ID: On Mon, 6 Aug 2018 at 13:13, Boris Kolpackov wrote: > MM writes: > > > odb -d sqlite --sqlite-override-null --std c++14 --profile boost > > --omit-drop --generate-query --generate-schema-only --schema-format sql > > --at-once -I/src -I/usr/include --changelog-dir /src/odb --options-file > > /src/vendors/odb/boost-multiarray.options --input-name mydbname > > /src/file_1.hpp ... /src/file_n.hpp > > > > Does the odb compiler use each header file argument separately? or does > it > > concatenate all the headers to produce the SQL. > > Since you have specified the --at-once option, they are effectively > concatenated in the order specified on the command line. Still to try to reduce to a reportable example, 1 more question: In this resulting concatenated stream of c++ code, what happens to #include directives? They are processed as usual? MM From boris at codesynthesis.com Thu Aug 30 10:16:56 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Aug 30 10:23:15 2018 Subject: [odb-users] internal compiler error: cult:compiler::context::no_entry In-Reply-To: References: Message-ID: MM writes: > On Mon, 6 Aug 2018 at 13:13, Boris Kolpackov wrote: > > > MM writes: > > > > > odb -d sqlite --sqlite-override-null --std c++14 --profile boost > > > --omit-drop --generate-query --generate-schema-only --schema-format sql > > > --at-once -I/src -I/usr/include --changelog-dir /src/odb --options-file > > > /src/vendors/odb/boost-multiarray.options --input-name mydbname > > > /src/file_1.hpp ... /src/file_n.hpp > > > > > > Does the odb compiler use each header file argument separately? or does > > > it concatenate all the headers to produce the SQL. > > > > Since you have specified the --at-once option, they are effectively > > concatenated in the order specified on the command line. > > Still to try to reduce to a reportable example, 1 more question: > > In this resulting concatenated stream of c++ code, what happens to #include > directives? They are processed as usual? Yes, the files are just concatenated together and compiled as a single translation unit. You can see the relevant code in odb/odb.cxx starting at line 801: https://git.codesynthesis.com/cgit/odb/odb/tree/odb/odb.cxx