From adnan at rihan.fr Sun Feb 2 14:44:09 2020 From: adnan at rihan.fr (Adnan RIHAN) Date: Mon Feb 3 08:08:55 2020 Subject: [odb-users] Re: no viable overloaded '=' with QLazySharedPointer In-Reply-To: References: Message-ID: <7660bd47-086e-fa4c-037b-fb287b502961@rihan.fr> Skipped content of type multipart/mixed-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature Url : https://codesynthesis.com/pipermail/odb-users/attachments/20200202/2e90879b/signature.pgp From atsdb at gmx.at Mon Feb 3 03:11:19 2020 From: atsdb at gmx.at (ATSDB) Date: Mon Feb 3 08:08:55 2020 Subject: [odb-users] Retrieving Results from Native Queries without Compile-time Fixed Classes Message-ID: <53aae82f-9b4a-0f9a-c7a6-093ed659feb0@gmx.at> Dear All, ? I am the main developer of an open-source project (https://github.com/hpuhr/ATSDB/) and I am considering switching to ODB in my database backend. The short question is: I would like to use native queries to obtain partial data (some columns of many) from existing (unmapped) tables without having to have compile-time fixed classes to hold the results. Is this possible? Would you recommend using ODB in such a manner? From my understanding this is somewhat supported using Views (as stated in the odb manual), but only if I write result classes that store the selected columns - which is then compile-time fixed. Is my understanding correct? Background: My applications stores large amounts of data in a database (gigabytes). I wrote a (simplistic) system which allows data abstraction from the actual database schema based on configuration. During loading, the current schema is used to dynamically create the select queries with not-fixed number/names of columns, and the result is stored in custom container (basically a dynamic templated aggregations of std::vectors - think array of structs with dynamic amount of members). To load the complete dataset into RAM is not feasible. But: In addition to this partial load I would value the use of mapped classes for other (smaller) data. Would it be possible/reasonable to use mapped classes and additionally directly use the native database connections to retrieve the results to fill my custom containers? References I found: https://www.codesynthesis.com/products/odb/doc/manual.xhtml#3.12 https://www.codesynthesis.com/pipermail/odb-users/2011-September/000306.html I hope I explained the issue in an understandable manner. Thank you in advance, best regards, ? Helmut Puhr From boris at codesynthesis.com Mon Feb 3 09:14:12 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 3 09:19:59 2020 Subject: [odb-users] Retrieving Results from Native Queries without Compile-time Fixed Classes In-Reply-To: <53aae82f-9b4a-0f9a-c7a6-093ed659feb0@gmx.at> References: <53aae82f-9b4a-0f9a-c7a6-093ed659feb0@gmx.at> Message-ID: ATSDB writes: > The short question is: I would like to use native queries to obtain > partial data (some columns of many) from existing (unmapped) tables > without having to have compile-time fixed classes to hold the results. > Is this possible? While it should be possible using implementation details (basically what the generated code is using), this is not a documented API, there are no stability guarantees, etc. You will also have to write this code for each database that you want to support. Here is, for example, select_statement for SQLite: https://git.codesynthesis.com/cgit/odb/libodb-sqlite/tree/odb/sqlite/statement.hxx#n210 > From my understanding this is somewhat supported using Views (as stated > in the odb manual), but only if I write result classes that store the > selected columns - which is then compile-time fixed. Is my understanding > correct? It is. > Background: My applications stores large amounts of data in a database > (gigabytes). I wrote a (simplistic) system which allows data abstraction > from the actual database schema based on configuration. During loading, the > current schema is used to dynamically create the select queries with > not-fixed number/names of columns, and the result is stored in custom > container (basically a dynamic templated aggregations of std::vectors - > think array of structs with dynamic amount of members). I assume the types of these columns are not known at compile time either? > Would it be possible/reasonable to use mapped classes and additionally > directly use the native database connections to retrieve the results > to fill my custom containers? I think it would be reasonable if you don't have a better alternative. One thing going for ODB here (IMO), is that the database runtimes are pretty efficient and well-tested. From atsdb at gmx.at Mon Feb 3 09:28:48 2020 From: atsdb at gmx.at (ATSDB) Date: Tue Feb 4 02:35:32 2020 Subject: [odb-users] Retrieving Results from Native Queries without Compile-time Fixed Classes In-Reply-To: References: <53aae82f-9b4a-0f9a-c7a6-093ed659feb0@gmx.at> Message-ID: <73f8c300-b9ea-29db-4bfc-103d10a13976@gmx.at> Thank you for your reply, please find my comments below. On 03.02.20 15:14, Boris Kolpackov wrote: > ATSDB writes: > >> The short question is: I would like to use native queries to obtain >> partial data (some columns of many) from existing (unmapped) tables >> without having to have compile-time fixed classes to hold the results. >> Is this possible? > While it should be possible using implementation details (basically > what the generated code is using), this is not a documented API, there > are no stability guarantees, etc. You will also have to write this > code for each database that you want to support. > > Here is, for example, select_statement for SQLite: > > https://git.codesynthesis.com/cgit/odb/libodb-sqlite/tree/odb/sqlite/statement.hxx#n210 > Understood, I'll take a look. Since I only support 2 database systems now (MySQL, SQLite3) this would not be an issue. >> From my understanding this is somewhat supported using Views (as stated >> in the odb manual), but only if I write result classes that store the >> selected columns - which is then compile-time fixed. Is my understanding >> correct? > It is. Thanks. >> Background: My applications stores large amounts of data in a database >> (gigabytes). I wrote a (simplistic) system which allows data abstraction >> from the actual database schema based on configuration. During loading, the >> current schema is used to dynamically create the select queries with >> not-fixed number/names of columns, and the result is stored in custom >> container (basically a dynamic templated aggregations of std::vectors - >> think array of structs with dynamic amount of members). > I assume the types of these columns are not known at compile time either? No. Whether this was a good choice can be discussed, but this is the way I need it for now. >> Would it be possible/reasonable to use mapped classes and additionally >> directly use the native database connections to retrieve the results >> to fill my custom containers? > I think it would be reasonable if you don't have a better alternative. > One thing going for ODB here (IMO), is that the database runtimes are > pretty efficient and well-tested. Understood. Well the ODB database code is definitely better than mine :-) and the special "partial load" is one circumstance that ODB was not written for. But for the smaller-data classes (which I will need more of in the future) and their mapping I could very much benefit from your good work. Thanks again for your quick and helpful reply, I'll send a notification to the project if I decide to go for it. From alain.mari at se.com Tue Feb 4 05:52:10 2020 From: alain.mari at se.com (ALAIN MARI) Date: Tue Feb 4 06:19:27 2020 Subject: [odb-users] How to persist a custom collection adapted from std::vector ? Message-ID: Hi, I am replacing an existing object database layer with odb. I would like to make a custom persistent class which is an array of elements named os_Array. I could easily replace this os_Array with a std::vector which is already natively persisted by odb. But, in order to ease development migration, I just created a wrapper class like this : template class os_Array : private std::vector { ... } In order to keep the same API. But when I want to use my new class to persist a field like this for instance : typedef odb::os_Array> TIntArray; TIntArray m_collParam; I just get the following error message when I try to compile with odb.exe : 1> Generating ODB schema for CrossRef.odb 1> PXRefAddressObjRE.h:178:20: error: unable to map C++ type '::CPXRefAddressObjRE::TIntArray' used in data member 'm_collParam' to a SQLite database type 1> PXRefAddressObjRE.h:178:20: info: use '#pragma db type' to specify the database type What could be the best way to make my field persistent with my own wrapper class ? Regards. Alain. From boris at codesynthesis.com Tue Feb 4 06:27:06 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 4 06:32:57 2020 Subject: [odb-users] Retrieving Results from Native Queries without Compile-time Fixed Classes In-Reply-To: <73f8c300-b9ea-29db-4bfc-103d10a13976@gmx.at> References: <53aae82f-9b4a-0f9a-c7a6-093ed659feb0@gmx.at> <73f8c300-b9ea-29db-4bfc-103d10a13976@gmx.at> Message-ID: ATSDB writes: > Understood. Well the ODB database code is definitely better than mine :-) > and the special "partial load" is one circumstance that ODB was not written > for. In ODB, depending on the database you use (both databases that you target allow this), you can choose not to cache the query result in memory and instead "stream" it one element at a time from the database. See Section 4.4, "Query Result" for details: https://codesynthesis.com/products/odb/doc/manual.xhtml#4.4 From boris at codesynthesis.com Tue Feb 4 06:33:29 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 4 06:39:19 2020 Subject: [odb-users] How to persist a custom collection adapted from std::vector ? In-Reply-To: References: Message-ID: ALAIN MARI writes: > template > class os_Array : private std::vector > { > ... > } > > What could be the best way to make my field persistent with my own > wrapper class ? You need to provide the odb::container_traits specialization similar to how libodb provides one for std::vector (and other containers). The comment at the beginning of this file has more information on how to set everything up: https://git.codesynthesis.com/cgit/odb/libodb/tree/odb/c-array-traits.hxx (You could also provide this specialization in the same header as os_Array if you don't want to mess with the ODB compiler options.) See the std::vector specialization for an example: https://git.codesynthesis.com/cgit/odb/libodb/tree/odb/std-vector-traits.hxx From Tschoche.Jonas at ddv-mediengruppe.de Wed Feb 5 05:57:12 2020 From: Tschoche.Jonas at ddv-mediengruppe.de (Tschoche.Jonas@ddv-mediengruppe.de) Date: Wed Feb 5 07:52:50 2020 Subject: [odb-users] EXC_BAD_ACCESS in recursion use Message-ID: Hello, I serialize my odb databases and use recursion for serialize the relationships. I created a test table with an endless recursion for testing. On first view the recusion works fine, but after some seconds it crashes with a EXC_BAD_ACCESS in odb. First I tested it with a single transaction: Result: crash at select_statement& st (sts.find_statement ()); st.execute (); <- here # in generated file I think that the transaction was to big here. Then I tested it with connection pool and db->connection()->begin() Result crash at: inline connection_ptr database:: connection () { return connection_ptr (connection_ ()); <- here } # in odb/database.ixx I have no idea why it crash - possible out of connections? But it is synchronously. Can someone explain me why it works for a while and crash? How can I fix it? From boris at codesynthesis.com Wed Feb 5 08:09:04 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 5 08:14:56 2020 Subject: [odb-users] EXC_BAD_ACCESS in recursion use In-Reply-To: References: Message-ID: Tschoche.Jonas@ddv-mediengruppe.de writes: > I serialize my odb databases and use recursion for serialize the > relationships. I created a test table with an endless recursion > for testing. This is a very vague description of what you are doing. You will need to be more specific and show some concrete code if you want us to understand your problem. > On first view the recusion works fine, but after some seconds it > crashes with a EXC_BAD_ACCESS in odb. What platform is this on and which database are you using? Brief googling seems to indicate this is iOS and the common cause seems to be memory management issues. Perhaps your recursion runs out of stack and/or memory? From Tschoche.Jonas at ddv-mediengruppe.de Wed Feb 5 09:04:08 2020 From: Tschoche.Jonas at ddv-mediengruppe.de (Tschoche.Jonas@ddv-mediengruppe.de) Date: Wed Feb 5 09:47:10 2020 Subject: [odb-users] EXC_BAD_ACCESS in recursion use In-Reply-To: References: Message-ID: <60C1A2D4-4D73-4F7C-978B-7E71C6813153@ddv-mediengruppe.de> Yes the project runs at macos. I use ODB with mysql (C++17). Its not easy to explain. I have a serializer on the odb database classes to generate a json. I checked already the code for memory leaks. I measure the memory consume util the crash, it was ~20mb. How can it run out of stack? Here an example (I removed the preprocessor stuff that is used for serialize): class Device : public BaseEntity, public ISerializeable { public: std::string DeviceID; #pragma db null odb::lazy_shared_ptr DeviceGroupID; }; ISerializeable.hpp: template class ISerializeable : public Jsonable {}; Jsonable.hpp: class Jsonable : public IJsonable { public: [[nodiscard]] Json::Value toJson() const { return JsonUtils::toJson(static_cast(*this)); } } JsonUtils.hpp: template static Json::Value toJson(const T& object) { Json::Value root; Json::Value data; constexpr auto nbProperties = std::tuple_size::value; for_sequence(std::make_index_sequence{}, [&](auto i) { constexpr auto property = std::get(T::properties); data[property.name] = Converts::simplify(object, object.*(property.member)); }); root[T::objectname] = data; return root; } Converts::simplify: - It?s a convertclass with enable if -> relevant methods: template static Json::Value simplify(IEntity const& entity, T const& obj, typename std::enable_if, is_odb_weak_pointer>::value, T>::type* = 0) { return SerializeTraits::containerToSimple(entity, obj); } template static Json::Value simplify(IEntity const& entity, T const& obj, typename std::enable_if, is_odb_shared_pointer>::value, T>::type* = 0) { return SerializeTraits::containerToSimple(entity, obj); } template static Json::Value simplify(IEntity const& entity, T const& obj, typename std::enable_if::value, T>::type* = 0) { return SerializeTraits::nestedObjectToSimple(entity, obj); } template static Json::Value simplify(IEntity const& entity, T const& obj, typename std::enable_if::value, T>::type* = 0) { return SerializeTraits::nestedObjectToSimple(entity, obj); } SerializeTraits.hpp: - Here is the relevant class: template static SERIALIZER nestedObjectToSimple( ENTITY& currentReferenceObj, T const& nestedObj, typename std::enable_if::value, T>::type* = 0 ) { std::cout << "-> nestedObjectToSimple::begin::" << typeid(T).name() << " | " << typeid(ENTITY).name() << std::endl; bool isValid = false; SERIALIZER serializedOut; if (!notstd::is_uninitialized(nestedObj)) { auto config = EntityConfigurator::instance().getConfig(¤tReferenceObj); auto db = config.getDatabase(); auto mode = config.getNestedSerializeMode(); if constexpr (is_lazy_odb_ptr::value) { auto loadedObj = odbLoadObject(db, nestedObj); auto nested_config = EntityConfigurator::instance().getConfig(loadedObj.get()); isValid = loadedObj != nullptr; serializedOut = serializedJsonObject(loadedObj, mode, nested_config); } if constexpr (is_ptr::value) { auto nested_config = EntityConfigurator::instance().getConfig(nestedObj); isValid = nestedObj != nullptr; serializedOut = serializedJsonObject(nestedObj, mode, nested_config); } } std::cout << "-> nestedObjectToSimple::end" << std::endl; return defaultReturn(isValid, serializedOut); } template static SERIALIZER containerToSimple( ENTITY& currentReferenceObj, T const& containerObj ) { SERIALIZER array; // for Json::Value if constexpr (std::is_same::value) { array = Json::Value(Json::arrayValue); for (auto &elem : containerObj) { array.append(nestedObjectToSimple(currentReferenceObj, elem)); } } return array; } static auto odbLoadObject(std::shared_ptr& db, T const& nestedObj, typename std::enable_if::value, T>::type* = 0) { auto conn = db->connection(); if (!nestedObj.loaded()) { // Make only a transaction if needed - we try to use a existing. std::shared_ptr transaction = nullptr; //if (!odb::transaction::has_current()) transaction = std::make_shared(conn->begin(), false); // switch for 1. Situation or second (single transaction or multiple) std::cout << "LOAD BEGIN" << std::endl; if (!notstd::is_uninitialized(nestedObj.get_eager())) { auto loaded = nestedObj.load(); // CRASH after a some calls with EXC_BAD_ADDRESS std::cout << "LOAD END" << std::endl; if (transaction) transaction->commit(); return loaded; } } return decltype(nestedObj.load())(); } Extras: template struct is_lazy_odb_ptr { static constexpr bool value = notstd::satisfies_any_v; }; template struct is_ptr { static constexpr bool value = notstd::satisfies_any_v; }; Calling Code: odb::transaction t (DB::instance().get_database()->connection()->begin ()); // << Note transaction odb::result r (DB::instance().get_database()->query (odb::query< CurrentList >::List::ID > 0)); for (odb::result< CurrentList >::iterator e(r.begin()); e != r.end(); ++e) { std::cout << e->toJsonString() << std::endl; } t.commit (); ?Am 05.02.20, 14:09 schrieb "Boris Kolpackov" : Tschoche.Jonas@ddv-mediengruppe.de writes: > I serialize my odb databases and use recursion for serialize the > relationships. I created a test table with an endless recursion > for testing. This is a very vague description of what you are doing. You will need to be more specific and show some concrete code if you want us to understand your problem. > On first view the recusion works fine, but after some seconds it > crashes with a EXC_BAD_ACCESS in odb. What platform is this on and which database are you using? Brief googling seems to indicate this is iOS and the common cause seems to be memory management issues. Perhaps your recursion runs out of stack and/or memory? From boris at codesynthesis.com Thu Feb 6 08:42:52 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 6 08:48:51 2020 Subject: [odb-users] EXC_BAD_ACCESS in recursion use In-Reply-To: <60C1A2D4-4D73-4F7C-978B-7E71C6813153@ddv-mediengruppe.de> References: <60C1A2D4-4D73-4F7C-978B-7E71C6813153@ddv-mediengruppe.de> Message-ID: Tschoche.Jonas@ddv-mediengruppe.de writes: > Yes the project runs at macos. I use ODB with mysql (C++17). Can you run it under a debugger and get a stack trace? Generally, you are on a real OS, you should be able to use the debugger to understand what's going on. From Tschoche.Jonas at ddv-mediengruppe.de Fri Feb 7 04:03:17 2020 From: Tschoche.Jonas at ddv-mediengruppe.de (Tschoche.Jonas@ddv-mediengruppe.de) Date: Fri Feb 7 05:28:10 2020 Subject: [odb-users] EXC_BAD_ACCESS in recursion use In-Reply-To: References: <60C1A2D4-4D73-4F7C-978B-7E71C6813153@ddv-mediengruppe.de> Message-ID: It seems to crash every time on ~20mb memory usage. Here is the backtrace: https://gist.github.com/Jonas18175/c1f618637d8c9cfd955b59ea03fb2138 ?Am 06.02.20, 14:43 schrieb "Boris Kolpackov" : Tschoche.Jonas@ddv-mediengruppe.de writes: > Yes the project runs at macos. I use ODB with mysql (C++17). Can you run it under a debugger and get a stack trace? Generally, you are on a real OS, you should be able to use the debugger to understand what's going on. From boris at codesynthesis.com Mon Feb 10 08:43:46 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 10 08:49:56 2020 Subject: [odb-users] EXC_BAD_ACCESS in recursion use In-Reply-To: References: <60C1A2D4-4D73-4F7C-978B-7E71C6813153@ddv-mediengruppe.de> Message-ID: Tschoche.Jonas@ddv-mediengruppe.de writes: > It seems to crash every time on ~20mb memory usage. Here is the > backtrace: [...] 3579 frames -- I am pretty sure you are blowing through your stack. Check what is the default stack size on your OS. You can also try to increase it and see if it makes a difference (i.e., you get more stack frames before crashing). But overall, this is probably not a good design. From kiselev.alexander at gmail.com Wed Feb 12 04:25:00 2020 From: kiselev.alexander at gmail.com (Alexander Kiselev) Date: Wed Feb 12 07:08:37 2020 Subject: [odb-users] ODB for macOS 10.15 Catalina Message-ID: Hi, Do you have ODB for macOS 10.15 Catalina ? I try install ODB by instruction: https://www.codesynthesis.com/products/odb/doc/install-build2.xhtml#macos And I have many errors. Thanks Alexander Telegram: @KiselevAlexander Skype: kas_ru From boris at codesynthesis.com Wed Feb 12 07:07:25 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 12 07:13:39 2020 Subject: [odb-users] ODB for macOS 10.15 Catalina In-Reply-To: References: Message-ID: Alexander Kiselev writes: > Do you have ODB for macOS 10.15 Catalina ? Yes, our CI builds are all green: https://cppget.org/?builds=*odb*&cf=macos_10.15* > I try install ODB by instruction: > > https://www.codesynthesis.com/products/odb/doc/install-build2.xhtml#macos > > And I have many errors. You would need to show us the errors and also provide some details on your setup (Clang and GCC versions, etc). From baileythomashayes at gmail.com Thu Feb 13 10:43:01 2020 From: baileythomashayes at gmail.com (Thomas Hayes) Date: Fri Feb 14 07:38:46 2020 Subject: [odb-users] ODB Sqlite Database Message-ID: Hello, I am using odb with sqlite and never had any issues. I am currently using Beta 2.5 built with build2. Currently I use: shared_ptr db (new odb::sqlite::database ("test.db" , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)); { connection_ptr c (db->connection ()); c->execute ("PRAGMA foreign_keys=OFF"); transaction t (c->begin ()); schema_catalog::create_schema (*db); t.commit (); c->execute ("PRAGMA foreign_keys=ON"); } However I want to use: "memory" to use the ram or "" to use a temp file, but when I do this I get no such table error Please help! Thanks! shared_ptr db (new odb::sqlite::database (":memory:" , SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)); { connection_ptr c (db->connection ()); c->execute ("PRAGMA foreign_keys=OFF"); transaction t (c->begin ()); schema_catalog::create_schema (*db); t.commit (); c->execute ("PRAGMA foreign_keys=ON"); } From boris at codesynthesis.com Fri Feb 14 07:40:54 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Feb 14 07:47:16 2020 Subject: [odb-users] ODB Sqlite Database In-Reply-To: References: Message-ID: Thomas Hayes writes: > "memory" to use the ram or "" to use a temp file, but when I do this I > get no such table error What statement in your code causes this error? I've also tried the hello example from the odb-examples package and it works fine with an in-memory database: $ ./hello --database ':memory:' So my guess would be there is something special about your code. From quentindeldycke at gmail.com Mon Feb 17 10:20:59 2020 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Mon Feb 17 10:27:49 2020 Subject: [odb-users] odb-compiler errors with make -j ? Message-ID: Hi, I face a strange behavior of odb compiler (2.4.0) on a rhel 7.1 system. When compiling, i have random odb compile error of this form: error: '/../../../include/what/ever.hpp' is not a valid filesystem path. The '../../../' path is logic: my project is in this form: ./my/library/here/test.{pro,hpp,cpp} (I use qt and odb do run in this path) ./include/odb/pre.hxx ./include/or/anything.hpp But actually, it seems odb miss "the first dot" to make a path like "./../../../include/what/ever.hpp" Note that my library / binary is building correctly most of the times. (whole project is quite big) The .hpp can be anything my files do include, odb/pre.hxx, odb/post.hxx, my own includes... really anything. This seems to happen more and more oftenly with thread count passed to -j. -- Deldycke Quentin From boris at codesynthesis.com Tue Feb 18 09:17:07 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 18 09:23:43 2020 Subject: [odb-users] odb-compiler errors with make -j ? In-Reply-To: References: Message-ID: Quentin Deldycke writes: > When compiling, i have random odb compile error of this form: > > error: '/../../../include/what/ever.hpp' is not a valid filesystem path. > > The '../../../' path is logic: my project is in this form: > > ./my/library/here/test.{pro,hpp,cpp} (I use qt and odb do run in this path) > ./include/odb/pre.hxx > ./include/or/anything.hpp > > But actually, it seems odb miss "the first dot" to make a path like > "./../../../include/what/ever.hpp" > > Note that my library / binary is building correctly most of the times. > (whole project is quite big) > The .hpp can be anything my files do include, odb/pre.hxx, odb/post.hxx, > my own includes... really anything. > > This seems to happen more and more oftenly with thread count passed to -j. That's quite a strange behavior and it doesn't really ring any bells. Can you show the ODB compiler command line that corresponds to the above 'error: ...'? That is, from the same failed output log as the error so that if any malformed paths are passed, we can see it. Also, which version of GCC are you using with the ODB compiler? From quentindeldycke at gmail.com Tue Feb 18 09:35:11 2020 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Wed Feb 19 08:35:56 2020 Subject: [odb-users] odb-compiler errors with make -j ? In-Reply-To: References: Message-ID: Hi, $> gcc --version gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For making my build crash i use the Uber intelligent script: $> while [ 1 -eq 1 ] ; do make clean && qmake && make -j; if [ ! $? -eq 0 ] ; then break; fi; done It will build my ~8 files in this library correctly, ~20 times before failing. Here is my command line: V=1 VERBOSE=1 odb -x -H -v -U __X86_64__ -I/usr/lib/qt4/mkspecs/linux-g++-32 -I. -I/usr/include/QtCore -I/usr/include/QtNetwork -I/usr/include -I../../../include -I../../../include/scherzoReseau -I/home/dim/BR_EVO/src/server/libMaestroReception/libinclude -I../../../include/ScherzoSysteme -I../../../include/scherzoDim -I../../../include/scherzoodb -I../../../include/scherzoodb-gen -I../../../include/types -I../../../include/scherzoReseau -I../../../build/gen/odb-gen-maestroReception -I../derivation/libinclude -I../../../include/tcpSSL -I../../../include/ScherzoJsonNode -I../../../include/ScherzoLdap -I../../../include/views -I../../../include/xdr -I../../../build/release/libMaestroReception/mocs --database mysql --generate-schema --generate-query --generate-session --options-file /home/dim/BR_EVO/include/scherzoodb/OScherzo_ptr.options -I/home/dim/BR_EVO/build/gen/odb/ -I/home/dim/BR_EVO/include/ -I/home/dim/BR_EVO/src/server/libMaestroReception/libinclude/ -I/home/dim/BR_EVO/include/ScherzoSysteme/ -I/home/dim/BR_EVO/include/types/ -I/home/dim/BR_EVO/include/scherzoodb/ -I/usr/include --output-dir /home/dim/BR_EVO/build/gen/odb-gen-maestroReception/ receptioncdmetrics.hpp > ../../../build/gen/odb-gen-maestroReception/receptioncdmetrics-odb.cxx.log 2>&1 V=1 VERBOSE=1 -x -H and -v were added to track this problem. same as the log file redirection. I give it to you for additionnal information If you look at log file, the "not found" is SStatistiques.h. But at log file line 494, the file is found... in the correct path. -- Deldycke Quentin On Tue, 18 Feb 2020 at 15:17, Boris Kolpackov wrote: > Quentin Deldycke writes: > > > When compiling, i have random odb compile error of this form: > > > > error: '/../../../include/what/ever.hpp' is not a valid filesystem path. > > > > The '../../../' path is logic: my project is in this form: > > > > ./my/library/here/test.{pro,hpp,cpp} (I use qt and odb do run in this > path) > > ./include/odb/pre.hxx > > ./include/or/anything.hpp > > > > But actually, it seems odb miss "the first dot" to make a path like > > "./../../../include/what/ever.hpp" > > > > Note that my library / binary is building correctly most of the times. > > (whole project is quite big) > > The .hpp can be anything my files do include, odb/pre.hxx, odb/post.hxx, > > my own includes... really anything. > > > > This seems to happen more and more oftenly with thread count passed to > -j. > > That's quite a strange behavior and it doesn't really ring any bells. Can > you show the ODB compiler command line that corresponds to the above > 'error: ...'? That is, from the same failed output log as the error so > that if any malformed paths are passed, we can see it. > > Also, which version of GCC are you using with the ODB compiler? > -------------- next part -------------- A non-text attachment was scrubbed... Name: receptioncdmetrics-odb.cxx.log Type: text/x-log Size: 60108 bytes Desc: not available Url : https://codesynthesis.com/pipermail/odb-users/attachments/20200218/50bbd3ee/receptioncdmetrics-odb.cxx-0001.bin From boris at codesynthesis.com Wed Feb 19 09:19:55 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 19 09:26:31 2020 Subject: [odb-users] odb-compiler errors with make -j ? In-Reply-To: References: Message-ID: Quentin Deldycke writes: > $> gcc --version > gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16) Actually, from your log, GCC used by ODB is: gcc version 4.9.3 20150204 (prerelease) (GCC) Is it self-built or part of the RedHat developer toolset? > If you look at log file, the "not found" is SStatistiques.h. But at log > file line 494, the file is found... in the correct path. Yes, looks strange. Any chance you can upgrade your GCC 4.9.3 to 5.0 or later (preferably final release) and try the latest ODB 2.5.0 pre-release per these instructions: https://codesynthesis.com/products/odb/doc/install-build2.xhtml From wangpeng at tinavi.com Wed Feb 19 08:51:01 2020 From: wangpeng at tinavi.com (wangpeng) Date: Wed Feb 19 09:27:13 2020 Subject: [odb-users] error occurs when to build libodb-pgsql 2.4 Message-ID: <06dd01d5e72b$9f7bfa50$de73eef0$@tinavi.com>+A3B7AE2B3FEA517C Hi all, When I try to build libodb-pgsql 2.4 in VisualStudio 2010, error occurs as follow, my postgresql's version is 12. ?? 8 error LNK2019: ????????? _PQstatus??????? "public: __thiscall odb::pgsql::connection::connection(class odb::pgsql::database &)" (??0connection@pgsql@odb@@QAE@AAVdatabase@12@@Z) ? ??? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 11 error LNK2019: ????????? _PQsetNoticeProcessor?? ????? "private: void __thiscall odb::pgsql::connection::init(void)" (?init@connection@pgsql@odb@@AAEXXZ) ???? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 3 error LNK2019: ????????? _PQresultStatus????? ?? "bool __cdecl odb::pgsql::is_good_result(struct pg_result *,enum ExecStatusType *)" (?is_good_result@pgsql@odb@@YA_NPAUpg_result@@PAW4ExecStatusType@@@Z) ??? ? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 22 error LNK2019: ????????? _PQresultErrorMessage?? ????? "void __cdecl odb::pgsql::translate_error(class odb::pgsql::connection &,struct pg_result *)" (?translate_error@pgsql@odb@@YAXAAVconnection@12@PAUpg_result@@@Z) ???? D:\????\odb\libodb-pgsql-2.4.0\odb\pgsql\error.obj libodb-pgsql-vc10 ?? 20 error LNK2019: ????????? _PQresultErrorField??? ???? "void __cdecl odb::pgsql::translate_error(class odb::pgsql::connection &,struct pg_result *)" (?translate_error@pgsql@odb@@YAXAAVconnection@12@PAUpg_result@@@Z) ???? D:\????\odb\libodb-pgsql-2.4.0\odb\pgsql\error.obj libodb-pgsql-vc10 ?? 23 error LNK2019: ????????? _PQprepare??????? "private: void __thiscall odb::pgsql::statement::init(enum odb::pgsql::statement_kind,class odb::pgsql::binding const *,bool,unsigned int const *,unsigned int)" (?init@statement@pgsql@odb@@AAEXW4statement_kind@23@PBVbinding@23@_NPBII@Z) ???? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\statement.obj libodb-pgsql-vc10 ?? 12 error LNK2019: ????????? _PQparameterStatus???? ??? "private: void __thiscall odb::pgsql::connection::init(void)" (?init@connection@pgsql@odb@@AAEXXZ) ???? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 15 error LNK2019: ????????? _PQntuples??????? "public: virtual unsigned __int64 __thiscall odb::pgsql::connection::execute(char const *,unsigned int)" (?execute@connection@pgsql@odb@@UAE_KPBDI@Z) ???? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 28 error LNK2019: ????????? _PQnfields??????? "public: static bool __cdecl odb::pgsql::statement::bind_result(struct odb::pgsql::bind *,unsigned int,struct pg_result *,unsigned int,bool)" (?bind_result@statement@pgsql@odb@@SA_NPAUbind@23@IPAUpg_result@@I_N@Z) ?? ?? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\statement.obj libodb-pgsql-vc10 ?? 26 error LNK2019: ????????? _PQgetvalue??????? "public: static bool __cdecl odb::pgsql::statement::bind_result(struct odb::pgsql::bind *,unsigned int,struct pg_result *,unsigned int,bool)" (?bind_result@statement@pgsql@odb@@SA_NPAUbind@23@IPAUpg_result@@I_N@Z) ?? ?? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\statement.obj libodb-pgsql-vc10 ?? 24 error LNK2019: ????????? _PQgetlength??????? "public: static bool __cdecl odb::pgsql::statement::bind_result(struct odb::pgsql::bind *,unsigned int,struct pg_result *,unsigned int,bool)" (?bind_result@statement@pgsql@odb@@SA_NPAUbind@23@IPAUpg_result@@I_N@Z) ?? ?? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\statement.obj libodb-pgsql-vc10 ?? 27 error LNK2019: ????????? _PQgetisnull??????? "public: static bool __cdecl odb::pgsql::statement::bind_result(struct odb::pgsql::bind *,unsigned int,struct pg_result *,unsigned int,bool)" (?bind_result@statement@pgsql@odb@@SA_NPAUbind@23@IPAUpg_result@@I_N@Z) ?? ?? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\statement.obj libodb-pgsql-vc10 ?? 25 error LNK2019: ????????? _PQftype??????? "public: static bool __cdecl odb::pgsql::statement::bind_result(struct odb::pgsql::bind *,unsigned int,struct pg_result *,unsigned int,bool)" (?bind_result@statement@pgsql@odb@@SA_NPAUbind@23@IPAUpg_result@@I_N@Z) ?? ?? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\statement.obj libodb-pgsql-vc10 ?? 1 error LNK2019: ????????? _PQfinish??????? "public: static void __cdecl odb::pgsql::handle_traits::release(struct pg_conn *)" (?release@?$handle_traits@Upg_conn@@@pgsql@odb@@SAXPAUpg_conn@@@Z) ???? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\auto-handle.obj libodb-pgsql-vc10 ?? 29 error LNK2019: ????????? _PQexecPrepared????? ?? "public: void __thiscall odb::pgsql::select_statement::execute(void)" (?execute@select_statement@pgsql@odb@@QAEXXZ) ???? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\statement.obj libodb-pgsql-vc10 ?? 17 error LNK2019: ????????? _PQexec??????? "public: virtual unsigned __int64 __thiscall odb::pgsql::connection::execute(char const *,unsigned int)" (?execute@connection@pgsql@odb@@UAE_KPBDI@Z) ???? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 7 error LNK2019: ????????? _PQerrorMessage????? ?? "public: __thiscall odb::pgsql::connection::connection(class odb::pgsql::database &)" (??0connection@pgsql@odb@@QAE@AAVdatabase@12@@Z) ? ??? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 10 error LNK2019: ????????? _PQconnectdb??????? "public: __thiscall odb::pgsql::connection::connection(class odb::pgsql::database &)" (??0connection@pgsql@odb@@QAE@AAVdatabase@12@@Z) ? ??? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 13 error LNK2019: ????????? _PQcmdTuples??????? "public: virtual unsigned __int64 __thiscall odb::pgsql::connection::execute(char const *,unsigned int)" (?execute@connection@pgsql@odb@@UAE_KPBDI@Z) ???? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\connection.obj libodb-pgsql-vc10 ?? 2 error LNK2019: ????????? _PQclear??????? "public: static void __cdecl odb::pgsql::handle_traits::release(struct pg_result *)" (?release@?$handle_traits@Upg_result@@@pgsql@odb@@SAXPAUpg_result@@@Z) ?? ?? D:\???? \odb\libodb-pgsql-2.4.0\odb\pgsql\auto-handle.obj libodb-pgsql-vc10 From boris at codesynthesis.com Wed Feb 19 09:24:40 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 19 09:31:17 2020 Subject: [odb-users] error occurs when to build libodb-pgsql 2.4 In-Reply-To: <06dd01d5e72b$9f7bfa50$de73eef0$@tinavi.com> References: <06dd01d5e72b$9f7bfa50$de73eef0$@tinavi.com> Message-ID: wangpeng writes: > When I try to build libodb-pgsql 2.4 in VisualStudio 2010, error occurs as > follow, my postgresql's version is 12. There seems to be some mismatch between what you are building and libpq you are trying to link. Try the latest pre-release of ODB per these instructions: https://codesynthesis.com/products/odb/doc/install-build2.xhtml This will build you a packaged version of libpq from source in the same build configuration as libodb-pgsql. From quentindeldycke at gmail.com Wed Feb 19 09:31:14 2020 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Wed Feb 19 09:38:10 2020 Subject: [odb-users] odb-compiler errors with make -j ? In-Reply-To: References: Message-ID: The odb version is a the one from this url: https://www.codesynthesis.com/download/odb/2.4/odb-2.4.0-1.x86_64.rpm It packages it's own gcc: $> ./odb-2.4.0-1.x86_64/usr/libexec/odb/x86_64-linux-gnu/bin/gcc --version gcc (GCC) 4.9.3 20150204 (prerelease) Copyright (C) 2014 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I think it actually depends of the way you delivered the package back in 2015. The rest of the application is built with the gcc available on my rhel: 4.9.2. odb 2.5 is not a trivial update from my point of view. I need to see if it is possible with my old rhel 7... Is it possible to have a odb 2.5 compiler which can pre-process file for a odb 2.4 library? -- Deldycke Quentin On Wed, 19 Feb 2020 at 15:20, Boris Kolpackov wrote: > Quentin Deldycke writes: > > > $> gcc --version > > gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16) > > Actually, from your log, GCC used by ODB is: > > gcc version 4.9.3 20150204 (prerelease) (GCC) > > Is it self-built or part of the RedHat developer toolset? > > > > If you look at log file, the "not found" is SStatistiques.h. But at log > > file line 494, the file is found... in the correct path. > > Yes, looks strange. > > Any chance you can upgrade your GCC 4.9.3 to 5.0 or later (preferably > final release) and try the latest ODB 2.5.0 pre-release per these > instructions: > > https://codesynthesis.com/products/odb/doc/install-build2.xhtml > From boris at codesynthesis.com Wed Feb 19 09:44:14 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 19 09:50:51 2020 Subject: [odb-users] odb-compiler errors with make -j ? In-Reply-To: References: Message-ID: Quentin Deldycke writes: > The odb version is a the one from this url: > https://www.codesynthesis.com/download/odb/2.4/odb-2.4.0-1.x86_64.rpm > > It packages it's own gcc: Ah, ok. > odb 2.5 is not a trivial update from my point of view. I need to see if it > is possible with my > old rhel 7... If you can get GCC 5 or later (just to build/run the ODB compiler, everything else can continue using GCC 4.8.2), then I think it should be pretty straightforward. I would look into getting the RedHat developer toolset: https://developers.redhat.com/products/developertoolset/updates It seems you can get version 7 for RHEL 7 which has GCC 7.2.1. > Is it possible to have a odb 2.5 compiler which can pre-process file for a > odb 2.4 library? Not sure exactly what you mean by this (if you want to use 2.5 ODB compiler with 2.4 libodb* libraries, then no). Generally, I don't believe there are any breaking changes in 2.5 compared to 2.4 so it should be a matter of re-compiling your headers with the new ODB compiler and linking to new libodb* libraries. From quentindeldycke at gmail.com Fri Feb 21 12:38:05 2020 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Fri Feb 21 12:45:09 2020 Subject: [odb-users] use of unique_ptr in odb::connection::cache_query Message-ID: Hi, Using odb 2.4.0 I was using this code (c++-98) static void histoSearch(const char* name, odb::connection& c) { // This is my parameter class typedef ScherzoConfigurationImpression::HistoParams param; // This one is a view typedef ScherzoConfigurationImpression::CI_HistoImpression base; typedef odb::query qry; typedef odb::prepared_query pqry; std::auto_ptr p(new param); // Creation query qry q(qry::form == qry::_ref(p->form) && qry::dest == qry::_ref(p->dest) && qry::idform == qry::_ref(p->idform)); pqry pq(c.prepare_query(name, q)); // We put to cache c.cache_query(pq, p); } Now, with odb 2.5.0 and c++-11, i need to use it like this: static void histoSearch(const char* name, odb::connection& c) { // This is my parameter class typedef ScherzoConfigurationImpression::HistoParams param; // This one is a view typedef ScherzoConfigurationImpression::CI_HistoImpression base; typedef odb::query qry; typedef odb::prepared_query pqry; std::unique_ptr p = std::make_unique(); // Creation query qry q(qry::form == qry::_ref(p->form) && qry::dest == qry::_ref(p->dest) && qry::idform == qry::_ref(p->idform)); pqry pq(c.prepare_query(name, q)); // We put to cache c.cache_query(pq, p); } But the new version does not work: configurationimpressionrunnable.cpp: In function 'void histoSearch(const char*, odb::connection&)': configurationimpressionrunnable.cpp:486:24: error: use of deleted function 'std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = ScherzoConfigurationImpression::HistoParams; _Dp = std::default_delete]' c.cache_query(pq, p); ^ In file included from /usr/include/c++/8/memory:80, from configurationimpressionrunnable.hpp:4, from configurationimpressionrunnable.cpp:1: /usr/include/c++/8/bits/unique_ptr.h:394:7: note: declared here unique_ptr(const unique_ptr&) = delete; ^~~~~~~~~~ In file included from /usr/local/include/odb/connection.hxx:223, from /usr/local/include/odb/database.hxx:29, from ../../../include/views/viewconnection.hpp:6, from ../../../include/views/scherzorunnable.hpp:5, from ../../../include/views/xdrrunnable.hpp:4, from configurationimpressionrunnable.hpp:8, from configurationimpressionrunnable.cpp:1: /usr/local/include/odb/connection.ixx:69:15: note: initializing argument 2 of 'void odb::connection::cache_query(const odb::prepared_query&, std::unique_ptr

) [with T = ScherzoConfigurationImpression::CI_HistoImpression; P = ScherzoConfigurationI mpression::HistoParams]' inline void connection:: ^~~~~~~~~~ Which actually seems logic. But the cache_query function does not provide other signatures. -- Deldycke Quentin From boris at codesynthesis.com Mon Feb 24 08:50:19 2020 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 24 08:57:11 2020 Subject: [odb-users] use of unique_ptr in odb::connection::cache_query In-Reply-To: References: Message-ID: Quentin Deldycke writes: > c.cache_query(pq, p); cache_query() assumes ownership of the second argument (parameters) and with unique_ptr you need an explicit move to signal that you are relinquishing ownership: c.cache_query(pq, std::move (p));