From boris at codesynthesis.com Wed Apr 1 06:55:29 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 1 07:07:11 2015 Subject: [odb-users] abstract objects and the data member pragma 'table' In-Reply-To: <15ad6efd2b5f40bdb5025957005e20b2@QEX.qosmotec.com> References: <15ad6efd2b5f40bdb5025957005e20b2@QEX.qosmotec.com> Message-ID: Hi Marcel, Marcel Nehring writes: > For example when I don't specify a custom name ODB generates the > table name from the class name of the derived, non-abstract class > and the member's name. What I would like is to have my custom name > prefixed with the non-abstract class' name, for example. I would > like to avoid the need to specify the custom name in each derived > class. While I can see how this can be useful, this is too much of an inconsequential, corner case to add extra complexity to the compiler. Perhaps you could use the --table-regex options to detect your container tables and then process their names? Boris From Harald.Bergmann at freudenberg-it.com Wed Apr 1 09:37:40 2015 From: Harald.Bergmann at freudenberg-it.com (Bergmann, Harald (FIT)) Date: Wed Apr 1 10:31:38 2015 Subject: [odb-users] odb.exe 2.4.0 does not do anything on win7 Message-ID: <020856C2C4BA284FB7D752150902B759D7749F21@fitw01v505.fitads01.fxdir.net> Hi, every time I start the precompiled odb.exe 2.4.0 on my machine (Win7 64 professional), it won't do anything, not even terminate - it just hangs. There's no difference if there are additional commands or options in the command line or not or if they are supported or not. You can stop the process with CTRL-C, though. The odb.exe 2.3.0 just works fine. I checked the sha1 checksum for the downloaded zip, which was correct. So what am I doing wrong, besides using Windows? Best Regards Harald Bergmann From boris at codesynthesis.com Wed Apr 1 10:35:02 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 1 10:46:40 2015 Subject: [odb-users] odb.exe 2.4.0 does not do anything on win7 In-Reply-To: <020856C2C4BA284FB7D752150902B759D7749F21@fitw01v505.fitads01.fxdir.net> References: <020856C2C4BA284FB7D752150902B759D7749F21@fitw01v505.fitads01.fxdir.net> Message-ID: Hi Harald, Bergmann, Harald (FIT) writes: > every time I start the precompiled odb.exe 2.4.0 on my machine (Win7 > 64 professional), it won't do anything, not even terminate - it just > hangs. Hm, that's strange. I just tried it on Win7 64 and it works fine. Can you try this command line: odb --version If that works, then try to add the '-v' option to the command line that you used. It will show what's going on under the hood. Boris From nicholas.cremonesi at gmail.com Thu Apr 2 06:27:58 2015 From: nicholas.cremonesi at gmail.com (Nicholas Cremonesi) Date: Thu Apr 2 10:18:39 2015 Subject: [odb-users] Error creating static library from ODB generated files Message-ID: Hello everyone, I'm trying to compile my generated "-odb.o" files into a static library ('.a') under Windows using MinGW, but when I link to the generated library my compiler crashes with lot of errors like this: "./libtest.a(MyClass-odb.o):MyClass-odb.cxx:(.text+0xdac): undefined reference to `_imp___ZN3odb6sqlite11transaction7currentEv'" ecc.. What am I doing wrong? I create the library using: "ar rvs /path_to_lib/myClass.a *.o" From Harald.Bergmann at freudenberg-it.com Thu Apr 2 04:39:34 2015 From: Harald.Bergmann at freudenberg-it.com (Bergmann, Harald (FIT)) Date: Thu Apr 2 10:19:01 2015 Subject: [odb-users] odb.exe 2.4.0 does not do anything on win7 In-Reply-To: References: <020856C2C4BA284FB7D752150902B759D7749F21@fitw01v505.fitads01.fxdir.net> Message-ID: <020856C2C4BA284FB7D752150902B759D7749FCD@fitw01v505.fitads01.fxdir.net> Hi Boris, at least I solved the problem and as I assumed it was my fault. I built all the libs and dlls and then just copied the odb.exe out of the zip to the bin folder instead of extracting the whole archive. So the default.options file was missing which caused the problem. Although it was my fault, I think it would be a good idea to mention this dependency in the documentation. Maybe I'm not the only lazy user. But thanks again for your attention. Best Regards Harald -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Mittwoch, 1. April 2015 16:35 To: Bergmann, Harald (FIT) Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] odb.exe 2.4.0 does not do anything on win7 Hi Harald, Bergmann, Harald (FIT) writes: > every time I start the precompiled odb.exe 2.4.0 on my machine (Win7 > 64 professional), it won't do anything, not even terminate - it just > hangs. Hm, that's strange. I just tried it on Win7 64 and it works fine. Can you try this command line: odb --version If that works, then try to add the '-v' option to the command line that you used. It will show what's going on under the hood. Boris From boris at codesynthesis.com Thu Apr 2 10:14:02 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 2 10:25:40 2015 Subject: [odb-users] odb.exe 2.4.0 does not do anything on win7 In-Reply-To: <020856C2C4BA284FB7D752150902B759D7749FCD@fitw01v505.fitads01.fxdir.net> References: <020856C2C4BA284FB7D752150902B759D7749F21@fitw01v505.fitads01.fxdir.net> <020856C2C4BA284FB7D752150902B759D7749FCD@fitw01v505.fitads01.fxdir.net> Message-ID: Hi Harald, Bergmann, Harald (FIT) writes: > I built all the libs and dlls and then just copied the odb.exe out > of the zip to the bin folder instead of extracting the whole archive. > So the default.options file was missing which caused the problem. Yes, there are a lot of more important things missing than default.options. The README file, which is part of the archive, contains this warning: "Note also that while you can move the ODB compiler directory around, you cannot move the individual sub-directories or files inside it. For example, copying the ODB compiler executable to C:\Windows will not work." The whole README is actually worth a read. Boris From boris at codesynthesis.com Fri Apr 3 10:27:48 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 3 10:39:25 2015 Subject: [odb-users] Error creating static library from ODB generated files In-Reply-To: References: Message-ID: Hi Nicholas, Nicholas Cremonesi writes: > I'm trying to compile my generated "-odb.o" files into a static library > ('.a') under Windows using MinGW, but when I link to the generated library > my compiler crashes with lot of errors like this: > > "./libtest.a(MyClass-odb.o):MyClass-odb.cxx:(.text+0xdac): undefined > reference to `_imp___ZN3odb6sqlite11transaction7currentEv'" ecc.. First of all, the compiler does not crash. It issues diagnostics and exist with an error code. That's not the same as "crash". The error in question is an undefined symbol that points to the libodb-sqlite runtime. So you are either not linking this library or you are linking it in an incorrect order. In particular, it should be linked after your libtest.a, e.g., ... libtest.a -lodb-sqlite -lodb I also suggest that you google and read up on static libraries and link order. Boris From alexis.mestag at epitech.eu Sat Apr 4 22:11:53 2015 From: alexis.mestag at epitech.eu (Alexis Mestag) Date: Sat Apr 4 22:12:05 2015 Subject: [odb-users] ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' Message-ID: Hello, I'm currently trying to implement a bidirectionnal relationship using ODB. I have 2 classes Alert and Profile, and I want a profile to have a list of alerts. The two classes inherit from an Entity class which declares an id as unsigned long and are as followed: - Entities/Alert.hh: # include # include # include # include "Entities/Entity.hh" # include "Entities/Information.hh" # include "Entities/Profile.hh" # include "Entities/User.hh" class Alert : public Entity { friend class odb::access; public: typedef std::set> Users; private: Information _information; Users _users; std::shared_ptr _profile; private: Alert() = default; public: Alert(Information const &information); Alert(Alert const &rhs) = default; Alert &operator=(Alert const &rhs) = default; ~Alert() = default; public: bool operator==(Alert const &rhs) const; bool operator!=(Alert const &rhs) const; public: Information const &getInformation() const; void setInformation(Information const &information); Users const &getUsers() const; void setUsers(Users const &users); void addUser(Users::value_type const &user); void removeUser(Users::value_type const &rhs); public: virtual void serialize(Json::Value &json) const override; }; # ifdef ODB_COMPILER # pragma db object(Alert) # pragma db member(Alert::_information) # pragma db member(Alert::_users) # pragma db member(Alert::_profile) # endif - Entities/Profile.hh # include # include # include # include # include "Entities/Entity.hh" class Alert; class TimeSlot; class Profile : public Entity { friend classodb::access; public: typedef std::list> Alerts; typedef std::list> TimeSlots; private: int _polling; Alerts _alerts; TimeSlots _timeSlots; protected: Profile() = default; Profile(Profile const &rhs) = default; Profile& operator=(Profile const &rhs) = default; Profile(int const polling); public: virtual ~Profile() = default; public: int getPolling() const; void setPolling(int const polling); Alerts const &getAlerts() const; void setAlerts(Alerts const &alerts); void addAlert(Alerts::value_type const &alert); void removeAlert(Alerts::value_type const &alert); TimeSlots const &getTimeSlots() const; void setTimeSlots(TimeSlots const &timeSlots); void addTimeSlot(TimeSlots::value_type const &timeSlot); void removeTimeSlot(TimeSlots::value_type const &timeSlot); public: virtual void serialize(Json::Value &json) const override; }; # include "Entities/Alert.hh" # include "Entities/TimeSlot.hh" # ifdefODB_COMPILER # pragma db object(Profile) polymorphic # pragma db member(Profile::_polling) # pragma db member(Profile::_alerts) inverse(_profile) value_not_null # pragma db member(Profile::_timeSlots) inverse(_profile) value_not_null # endif The problem is, when I try to compile, ODB crashes: $ make odb -d mysql -q -s -e --std c++11 --default-pointer 'std::shared_ptr' --cxx-suffix .cpp --generate-schema --generate-session -I Headers -o Headers/Entities Headers/Entities/Alert.hh terminate called after throwing an instance of 'cutl::compiler::context::no_entry' what(): N4cutl8compiler7context8no_entryE *** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_START_UNIT | odb PLUGIN_PRAGMAS | odb PLUGIN_OVERRIDE_GATE | odb In file included from Headers/Entities/Alert.hh:20:0: Headers/Entities/User.hh: In function ?std::string CryptoPP::StringNarrow(const wchar_t*, bool)?: Headers/Entities/User.hh:27:49: internal compiler error: Aborted typedef ByteArray hash_type; ^ Please submit a full bug report, with preprocessed source if appropriate. See for instructions. Makefile:84: recipe for target 'Headers/Entities/Alert-odb.cpp' failed make: *** [Headers/Entities/Alert-odb.cpp] Error 1 odb -d mysql -q -s -e --std c++11 --default-pointer 'std::shared_ptr' --cxx-suffix .cpp --generate-schema --generate-session -I Headers -o Headers/Entities Headers/Entities/Alert.hh terminate called after throwing an instance of 'cutl::compiler::context::no_entry' what(): N4cutl8compiler7context8no_entryE *** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_START_UNIT | odb PLUGIN_PRAGMAS | odb PLUGIN_OVERRIDE_GATE | odb In file included from Headers/Entities/Alert.hh:20:0: Headers/Entities/User.hh: In function ?std::string CryptoPP::StringNarrow(const wchar_t*, bool)?: Headers/Entities/User.hh:27:49: internal compiler error: Aborted typedef ByteArray hash_type; ^ Please submit a full bug report, with preprocessed source if appropriate. See for instructions. Makefile:84: recipe for target 'Headers/Entities/Alert-odb.cpp' failed make: *** [Headers/Entities/Alert-odb.cpp] Error 1 I have no idea what causes this crash, I can't understand what the problem is from the crash report. Is there a problem on my part ? I post the User.hh file too since the error message mentions it, but I am not sure it will help resolve the problem. - Entities/User.hh: # include # include # include "Entities/Entity.hh" # include "Utils/ByteArray.hpp" # include # include class User : public Entity { friend classodb::access; public: typedef ByteArrayhash_type; private: std::string _name; std::string _surname; std::string _email; hash_type _hash; hash_type _salt; private: User() = default; public: User(User const &rhs) = delete; User(std::string const &name, std::string const &surname, std::string const &email); User& operator=(User const &rhs) = delete; ~User() = default; public: std::string const &getName() const; void setName(std::string const &name); std::string const &getSurname() const; void setSurname(std::string const &surname); std::string const &getEmail() const; void setEmail(std::string const &email); hash_type::type const &getHash() const; void setPassword(std::string const &password); hash_type::type const &getSalt() const; public: virtual void serialize(Json::Value &json) const override; }; # ifdefODB_COMPILER # pragma db value(User::hash_type) # pragma db member(User::hash_type::_array) transient # pragma db member(User::hash_type::_hex) get(toHexString) set(setHexString(?)) # pragma db object(User) # pragma db member(User::_name) # pragma db member(User::_surname) # pragma db member(User::_email) # pragma db member(User::_hash) # pragma db member(User::_salt) # endif I am not sure I posted everything which is needed to solve this, so don't hesitate to ask me more about my code. thanks in advance, Alexis MESTAG From boris at codesynthesis.com Mon Apr 6 10:18:43 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 6 10:30:20 2015 Subject: [odb-users] ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' In-Reply-To: References: Message-ID: Hi Alexis, > I am not sure I posted everything which is needed to solve this, so don't > hesitate to ask me more about my code. Yes, I will need a complete set of headers that reproduce the problem in order to try to figure out what's going on. Specifically, can you try to create a minimal but complete set that triggers the error by commenting out things that I not relevant (e.g., sha, json serialization. etc). Once you have it, please send it to me (you can send it off-list if you prefer). Also, I assume you are using the latest version of ODB (2.4.0)? Thanks, Boris From alexis.mestag at epitech.eu Mon Apr 6 18:26:42 2015 From: alexis.mestag at epitech.eu (Alexis Mestag) Date: Mon Apr 6 18:26:59 2015 Subject: [odb-users] Re: ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' References: Message-ID: Hi Boris, > Yes, I will need a complete set of headers that reproduce the problem I created one, I just sent it to you. > Also, I assume you are using the latest version of ODB (2.4.0)? Yes, I am using ODB 2.4.0 with GCC 4.9.2. From boris at codesynthesis.com Tue Apr 7 10:36:55 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 7 10:48:31 2015 Subject: [odb-users] Re: ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' In-Reply-To: References: Message-ID: Hi Alexis, Thanks for the test case. I've tracked it down and it is a bug in ODB. The fix is in the repository: http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=cebe8e9964267590a80965b98e6f8f1e8bb5059e If you are building the ODB compiler yourself, then it should be pretty straightforward to apply the patch. Alternatively, I can build you a pre-release binary. Just let me know for which platform. Thanks for reporting this! Boris From alexis.mestag at epitech.eu Tue Apr 7 19:40:16 2015 From: alexis.mestag at epitech.eu (alexis mestag) Date: Wed Apr 8 06:37:07 2015 Subject: [odb-users] Re: ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' In-Reply-To: References: , Message-ID: <1428450016169.60375@epitech.eu> Hi Boris, > Alternatively, I can build you a pre-release binary. Just let me know for > which platform. If you could build me a pre-release binary, that would be great. I tried to patch the sources myself but it didn't fix the issue so I think I must have done something wrong. I'm running on Archlinux x86_64. > Thanks for reporting this! You're welcome. Alexis MESTAG PS: I tried all day to answer on the gmane.org site but it took 10 hours to reach the answer form, and I wasn't able to submit it ... ________________________________________ From: Boris Kolpackov Sent: Tuesday, April 7, 2015 4:36 PM To: alexis mestag Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Re: ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' Hi Alexis, Thanks for the test case. I've tracked it down and it is a bug in ODB. The fix is in the repository: http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=cebe8e9964267590a80965b98e6f8f1e8bb5059e If you are building the ODB compiler yourself, then it should be pretty straightforward to apply the patch. Alternatively, I can build you a pre-release binary. Just let me know for which platform. Thanks for reporting this! Boris From nicholas.cremonesi at gmail.com Wed Apr 8 08:26:11 2015 From: nicholas.cremonesi at gmail.com (Nicholas Cremonesi) Date: Wed Apr 8 10:36:56 2015 Subject: [odb-users] Set integer field to NULL Message-ID: Hello, I need to set an integer field in my db to value type NULL, not to 0. Is there any way to do this? Many thanks From konstantin.tarovik at ab-soft.net Wed Apr 8 09:13:26 2015 From: konstantin.tarovik at ab-soft.net (Konstantin Tarovik) Date: Wed Apr 8 10:36:57 2015 Subject: [odb-users] ODB for iOS cross-compilation Message-ID: <55252976.1010605@ab-soft.net> Hello, I'm trying to build ODB for iOS on OSX 10.10.1 but struggle with cross-compilation. Here is configuration command I'm using: *./configure CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang LD=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar CFLAGS="-Os -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -target armv7m-apple-darwin" LDFLAGS="-arch armv7" --prefix=`pwd`/../install --disable-shared --disable-threads --host=arm-apple-darwin** * But after running *make*I check architecture of the lib by calling: *lipo -info libodb.a * and see: *input file libodb.a is not a fat file** **Non-fat file: libodb.a is architecture: x86_64** * When I try building iOS app using this lib it shows warning: *ld: warning: ignoring file /Users/user/Documents/Work/SDKs/ODB/install/lib/libodb.a, file was built for archive which is not the architecture being linked (armv7): /Users/user/Documents/Work/SDKs/ODB/install/lib/libodb.a** * Please advise. Thank you. Best regards, Konstantin Tarovik From boris at codesynthesis.com Wed Apr 8 10:50:36 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 8 11:02:10 2015 Subject: [odb-users] ODB for iOS cross-compilation In-Reply-To: <55252976.1010605@ab-soft.net> References: <55252976.1010605@ab-soft.net> Message-ID: Hi Konstantin, Konstantin Tarovik writes: > *./configure CC=[...] CFLAGS=[...] You need to use CXX, CXXFLAGS when building ODB runtimes since they are C++ code. Also, see this guide for more information on cross-compiling ODB: http://wiki.codesynthesis.com/Using_ODB_on_Mobile_and_Embedded_Systems Finally, once you figure it out, I would appreciate a note to this mailing list with any tips on using ODB with iOS. Thanks, Boris From boris at codesynthesis.com Wed Apr 8 11:01:31 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 8 11:13:06 2015 Subject: [odb-users] Re: ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' In-Reply-To: <1428450016169.60375@epitech.eu> References: <1428450016169.60375@epitech.eu> Message-ID: Hi Alexis, alexis mestag writes: > I tried to patch the sources myself but it didn't fix the issue so > I think I must have done something wrong. Hm, that's strange. Here is the patched ODB compiler source code. Can you try this: http://codesynthesis.com/~boris/tmp/odb/odb-2.4.0-1.tar.bz2 Boris From mne at qosmotec.com Wed Apr 8 11:28:54 2015 From: mne at qosmotec.com (Marcel Nehring) Date: Wed Apr 8 11:30:01 2015 Subject: [odb-users] Includes missing when defining view of polymorphic type in separate file Message-ID: <13f43b848af94004a5f974ae613d324d@QEX.qosmotec.com> Hi Boris, I am getting a compile error in VS12 that seems to be caused by missing includes in an ODB generated file. The missing directives seem to be #include #include #include I can reproduce the issue in a small example when I define an ODB polymorphic Base class (Base) and a class derived from it (Derived) in their own files. Then, when I define an ODB view in a third file, the ODB compiler runs successfully but the produced result causes compile errors C2027 for odb::polymorphic_map::object_type> and odb::oracle::polymorphic_derived_object_statements::object_type>. If I manually add the three include directives mentioned above to the ODB generated file in question everything seems to work fine. The problem does not occur if the view is defined in the same file as Derived. Am I missing something? Regards, Marcel From alexis.mestag at epitech.eu Wed Apr 8 11:36:24 2015 From: alexis.mestag at epitech.eu (Alexis Mestag) Date: Wed Apr 8 11:36:39 2015 Subject: [odb-users] Re: Set integer field to NULL References: Message-ID: Hi Nicholas, > I need to set an integer field in my db to value type NULL, not to 0. > Is there any way to do this? I believe you can use the odb::nullable class template to achieve this, as explained here: http://www.codesynthesis.com/products/odb/doc/manual.xhtml#7.3 Alexis MESTAG From alexis.mestag at epitech.eu Wed Apr 8 12:00:07 2015 From: alexis.mestag at epitech.eu (alexis mestag) Date: Wed Apr 8 12:13:46 2015 Subject: [odb-users] Re: ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' In-Reply-To: References: <1428450016169.60375@epitech.eu>, Message-ID: <1428508806290.71759@epitech.eu> Hi Boris, I finally erased my already installed version of ODB to replace it with your patched source code and it works fine. Thanks for your help. I was surprised to see how quickly you answered and fixed this. Keep up the great work ! Alexis MESTAG ________________________________________ From: Boris Kolpackov Sent: Wednesday, April 8, 2015 5:01 PM To: alexis mestag Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Re: ODB crashes: terminate called after throwing an instance of 'cutl::compiler::context::no_entry' Hi Alexis, alexis mestag writes: > I tried to patch the sources myself but it didn't fix the issue so > I think I must have done something wrong. Hm, that's strange. Here is the patched ODB compiler source code. Can you try this: http://codesynthesis.com/~boris/tmp/odb/odb-2.4.0-1.tar.bz2 Boris From konstantin.tarovik at ab-soft.net Thu Apr 9 07:26:23 2015 From: konstantin.tarovik at ab-soft.net (Konstantin Tarovik) Date: Thu Apr 9 10:04:55 2015 Subject: [odb-users] ODB for iOS cross-compilation In-Reply-To: References: <55252976.1010605@ab-soft.net> Message-ID: <552661DF.3070709@ab-soft.net> Hi Boris & all, Thank you for the help. I managed to compile ODB runtime for armv7/iOS using C++98 dialect using the following configuration command: ./configure CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang LD=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar CXXFLAGS="-Os -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -target armv7-apple-darwin -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/c++/4.2.1" LDFLAGS="-arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk" --prefix=`pwd`/../install --disable-shared --disable-threads --host=arm-apple-darwin But now I can't use it from the app implemented in C++11. When I try to compile ODB using c++11 (adding compiler param -std=gnu++11) it rises many errors like: ../odb/pointer-traits.hxx:239:29: error: no member named 'unique_ptr' in namespace 'std' class pointer_traits> ~~~~~^ ../odb/pointer-traits.hxx:239:40: error: 'T' does not refer to a value class pointer_traits> ^ ../odb/pointer-traits.hxx:238:22: note: declared here template ^ ../odb/pointer-traits.hxx:311:24: error: no template named 'shared_ptr' in namespace 'std'; did you mean 'details::shared_ptr'? class pointer_traits> ^~~~~~~~~~~~~~~ details::shared_ptr ../odb/details/shared-ptr-fwd.hxx:17:11: note: 'details::shared_ptr' declared here class shared_ptr; ^ Please advise. Thank you. Best regards, Konstantin Tarovik On 4/8/15 5:50 PM, Boris Kolpackov wrote: > Hi Konstantin, > > Konstantin Tarovik writes: > >> *./configure CC=[...] CFLAGS=[...] > You need to use CXX, CXXFLAGS when building ODB runtimes since > they are C++ code. > > Also, see this guide for more information on cross-compiling ODB: > > http://wiki.codesynthesis.com/Using_ODB_on_Mobile_and_Embedded_Systems > > Finally, once you figure it out, I would appreciate a note to this > mailing list with any tips on using ODB with iOS. > > Thanks, > Boris From konstantin.tarovik at ab-soft.net Thu Apr 9 08:18:49 2015 From: konstantin.tarovik at ab-soft.net (Konstantin Tarovik) Date: Thu Apr 9 10:04:55 2015 Subject: [odb-users] ODB for iOS cross-compilation In-Reply-To: <552661DF.3070709@ab-soft.net> References: <55252976.1010605@ab-soft.net> <552661DF.3070709@ab-soft.net> Message-ID: <55266E29.8040204@ab-soft.net> Also I've added -stdlib=libc++ parameter which also doesn't help. Best regards, Konstantin Tarovik On 4/9/15 2:26 PM, Konstantin Tarovik wrote: > Hi Boris & all, > > Thank you for the help. I managed to compile ODB runtime for armv7/iOS > using C++98 dialect using the following configuration command: > > ./configure > CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang > LD=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld > AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar > CXXFLAGS="-Os -isysroot > /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk > -target armv7-apple-darwin > -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/usr/include/c++/4.2.1" > LDFLAGS="-arch armv7 -isysroot > /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk" > --prefix=`pwd`/../install --disable-shared --disable-threads > --host=arm-apple-darwin > > > But now I can't use it from the app implemented in C++11. When I try > to compile > ODB using c++11 (adding compiler param -std=gnu++11) it rises many > errors like: > > ../odb/pointer-traits.hxx:239:29: error: no member named 'unique_ptr' > in namespace 'std' > class pointer_traits> > ~~~~~^ > ../odb/pointer-traits.hxx:239:40: error: 'T' does not refer to a value > class pointer_traits> > ^ > ../odb/pointer-traits.hxx:238:22: note: declared here > template > ^ > ../odb/pointer-traits.hxx:311:24: error: no template named > 'shared_ptr' in namespace 'std'; did you mean 'details::shared_ptr'? > class pointer_traits> > ^~~~~~~~~~~~~~~ > details::shared_ptr > ../odb/details/shared-ptr-fwd.hxx:17:11: note: 'details::shared_ptr' > declared here > class shared_ptr; > ^ > > Please advise. > > Thank you. > > Best regards, > Konstantin Tarovik > > On 4/8/15 5:50 PM, Boris Kolpackov wrote: >> Hi Konstantin, >> >> Konstantin Tarovik writes: >> >>> *./configure CC=[...] CFLAGS=[...] >> You need to use CXX, CXXFLAGS when building ODB runtimes since >> they are C++ code. >> >> Also, see this guide for more information on cross-compiling ODB: >> >> http://wiki.codesynthesis.com/Using_ODB_on_Mobile_and_Embedded_Systems >> >> Finally, once you figure it out, I would appreciate a note to this >> mailing list with any tips on using ODB with iOS. >> >> Thanks, >> Boris > From boris at codesynthesis.com Thu Apr 9 10:08:36 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 9 10:20:11 2015 Subject: [odb-users] ODB for iOS cross-compilation In-Reply-To: <552661DF.3070709@ab-soft.net> References: <55252976.1010605@ab-soft.net> <552661DF.3070709@ab-soft.net> Message-ID: Hi Konstantin, Konstantin Tarovik writes: > But now I can't use it from the app implemented in C++11. When I try > to compile ODB using c++11 (adding compiler param -std=gnu++11) it > rises many errors like: What do you mean by "compile ODB using c++11"? Are you compiling the ODB compiler? Are you compiling something with the ODB compiler? If the latter, the ODB compiler doesn't recognize the -std=gnu++11 option. You should use --std=c++11 instead. Boris From boris at codesynthesis.com Thu Apr 9 10:26:27 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 9 10:38:02 2015 Subject: [odb-users] Consulting for ODB users Message-ID: Hi, >From time to time I get asked by users of ODB if there is anyone providing consulting for ODB. If you have experience with ODB and looking for consulting projects, please let me know (off-list). Note that Code Synthesis will be acting as purely an introductory agent without collecting any fees or providing any guarantees. All the details are to be negotiated directly by the parties involved. Thanks, Boris From konstantin.tarovik at ab-soft.net Thu Apr 9 10:40:02 2015 From: konstantin.tarovik at ab-soft.net (Konstantin Tarovik) Date: Thu Apr 9 10:52:23 2015 Subject: [odb-users] ODB for iOS cross-compilation In-Reply-To: References: <55252976.1010605@ab-soft.net> <552661DF.3070709@ab-soft.net> Message-ID: <55268F42.60808@ab-soft.net> Hi Boris & all, The include path had to be changed for c++11 enabled stl. Below is the correct configuration command: ./configure CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ LD=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar CXXFLAGS="-Os -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -target armv7-apple-darwin -std=c++11 -stdlib=libc++ -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/" LDFLAGS="-arch armv7 -stdlib=libc++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk" --prefix=`pwd`/../install --disable-shared --disable-threads --host=arm-apple-darwin Now sqlite-based ODB runtime compiles without problems for iOS/armv7. Thank you. Best regards, Konstantin Tarovik On 4/9/15 5:08 PM, Boris Kolpackov wrote: > Hi Konstantin, > > Konstantin Tarovik writes: > >> But now I can't use it from the app implemented in C++11. When I try >> to compile ODB using c++11 (adding compiler param -std=gnu++11) it >> rises many errors like: > What do you mean by "compile ODB using c++11"? Are you compiling the > ODB compiler? Are you compiling something with the ODB compiler? > If the latter, the ODB compiler doesn't recognize the -std=gnu++11 > option. You should use --std=c++11 instead. > > Boris From Bob.Loncar at halton.ca Thu Apr 9 10:40:56 2015 From: Bob.Loncar at halton.ca (Loncar, Bob) Date: Thu Apr 9 10:52:23 2015 Subject: [odb-users] using values in MySQL DB to create all objects Message-ID: Regards, I want to use the DB for creating all the objects. First I would manually populate the tables/columns in my DB based on what I need, then I would like to create all the objects from the DB to be used within my main() and then save any changes made to the objects during runtime back to the DB. I have no need to create new objects in my code that will then persist in the DB. My question is how to create a transaction that grabs all records within a table and create objects based on those records. Regards, Bob Loncar SCADA Programmer The Regional Municipality of Halton 1151 Bronte Rd. Oakville, Ont. L6M 3L1 Tel: 1-866-442-5866 ext 3073 Cell: 289-795-3085 Email: Bob.Loncar@halton.ca From nicholas.cremonesi at gmail.com Fri Apr 10 05:50:09 2015 From: nicholas.cremonesi at gmail.com (Nicholas Cremonesi) Date: Fri Apr 10 10:45:40 2015 Subject: [odb-users] Defining multiple PKs - needed to define also comparison members Message-ID: Hello, I'm trying to define multiple PKs in a class and I'm using the same code provided in your example named 'composite'. When I generate classes with the 'odb ..' command I obtain this error: "value type that is used as object id in persistent class with session support does not define the less than (<) comparison" I'm using the exact code you provided so, how can I avoid this error? The multiple PK I'll define will contain two values of type "string". Is it essential to define <, >, = comparators? Many thanks, Nicholas From boris at codesynthesis.com Fri Apr 10 10:41:59 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 10 10:53:33 2015 Subject: [odb-users] Includes missing when defining view of polymorphic type in separate file In-Reply-To: <13f43b848af94004a5f974ae613d324d@QEX.qosmotec.com> References: <13f43b848af94004a5f974ae613d324d@QEX.qosmotec.com> Message-ID: Hi Marcel, Marcel Nehring writes: > I can reproduce the issue in a small example when I define an ODB > polymorphic Base class (Base) and a class derived from it (Derived) > in their own files. Then, when I define an ODB view in a third file, > the ODB compiler runs successfully but the produced result causes > compile errors [...] Can you please send me the "small example" that reproduces the problem? Thanks, Boris From boris at codesynthesis.com Fri Apr 10 10:52:24 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 10 11:03:58 2015 Subject: [odb-users] using values in MySQL DB to create all objects In-Reply-To: References: Message-ID: Hi Bob, Loncar, Bob writes: > I want to use the DB for creating all the objects. First I would > manually populate the tables/columns in my DB based on what I need, > then I would like to create all the objects from the DB to be used > within my main() and then save any changes made to the objects > during runtime back to the DB. I have no need to create new > objects in my code that will then persist in the DB. My question > is how to create a transaction that grabs all records within a > table and create objects based on those records. Take a look at Section 2.5, "Querying the Database for Objects" in the "Hello, World" chapter in the manual (BTW, if you haven't read this chapter completely, I strongly suggest that you do). If you want to get all the objects rather than a subset that matches a certain criteria, then all you have to do is omit the condition in the call to query(), for example, change: result r (db->query (query::age > 30)); To: result r (db->query ()); And you will get all the person object in the database. Boris From shametko.roman at gmail.com Sun Apr 12 12:05:46 2015 From: shametko.roman at gmail.com (Roman Shametko) Date: Sun Apr 12 12:04:52 2015 Subject: [odb-users] Composing object view attribute Message-ID: <552A97DA.3040800@gmail.com> Hi, guys. I need some help: Suppose I have some class like class AdjacencyListItem { public: std::shared_ptr m_parent; std::string m_nodeName; std::string nodePath() {...} }; Which represents, for instance, file tree. Assume that class is persistent (not gonna write pragmas in example). So AdjacencyListItem stores it's name and reference to it's parent, and nodePath glues all parent node names and produces some kind of path. Now I want to create view containing, in addition to other members, "glued path" which can be prodused by nodePath method. So I need to get something like this class View { public: ... std::string m_nodePath; // path, created by AdjacencyListItem::nodePath }; So my question is: Is there any way to supply Views with manually composed values? From boris at codesynthesis.com Mon Apr 13 10:11:07 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 13 10:22:39 2015 Subject: [odb-users] Composing object view attribute In-Reply-To: <552A97DA.3040800@gmail.com> References: <552A97DA.3040800@gmail.com> Message-ID: Hi Roman, Roman Shametko writes: > So my question is: Is there any way to supply Views with manually > composed values? Normally a view gets values for its members from the database (query). But you can also declare a member transient and compute its value using a database operation callback (e.g., post_load; Section 14.2.5). Not sure if this is what you are looking for. If not, then describe how you see the m_nodePath calculation being implemented under the hood. Boris From boris at codesynthesis.com Mon Apr 13 10:18:36 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 13 10:30:09 2015 Subject: [odb-users] Defining multiple PKs - needed to define also comparison members In-Reply-To: References: Message-ID: Hi Nicholas, Nicholas Cremonesi writes: > "value type that is used as object id in persistent class with session > support does not define the less than (<) comparison" > > I'm using the exact code you provided so, how can I avoid this error? > The multiple PK I'll define will contain two values of type "string". Is it > essential to define <, >, = comparators? See Section 7.2.1, "Composite Object Ids". Boris From tmatthews at appliedmedical.com Mon Apr 13 16:15:10 2015 From: tmatthews at appliedmedical.com (Matthews, Thomas) Date: Tue Apr 14 09:58:57 2015 Subject: [odb-users] Boost Date Time version for ODB Message-ID: <29886DC6E140EB408FF197BDF257D2ADFAFD0BBD@EX2.appliedmed.com> I building with ODB and I get the error message: 1>LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-gd-1_50.lib' I'm using Visual Studio 2010 and I can't find where this library is referenced. I've checked the properties page of libodb-boost-vc10.sln and it is not listed as an input to the Linker. I build the Boost 1.50 library. I have "libboost_date_time-vc110-mt-gd-1_50.lib" So how do I tell ODB to use the vc110 lib and not the vc100 lib? Thanks, From boris at codesynthesis.com Tue Apr 14 10:19:32 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 14 10:31:35 2015 Subject: [odb-users] Boost Date Time version for ODB In-Reply-To: <29886DC6E140EB408FF197BDF257D2ADFAFD0BBD@EX2.appliedmed.com> References: <29886DC6E140EB408FF197BDF257D2ADFAFD0BBD@EX2.appliedmed.com> Message-ID: Hi Thomas, Matthews, Thomas writes: > 1>LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-gd-1_50.lib' > > I'm using Visual Studio 2010 and I can't find where this library > is referenced. With Visual Studio, Boost uses compiler pragmas to automatically link to the correct library if/when required. > I've checked the properties page of libodb-boost-vc10.sln and it > is not listed as an input to the Linker. No, libodb-boost does not link to Boost Date-time library. It is your application that links to it (via the above mentioned pragmas). > I build the Boost 1.50 library. > I have "libboost_date_time-vc110-mt-gd-1_50.lib" > > So how do I tell ODB to use the vc110 lib and not the vc100 lib? I think this is where the problem is: you are using VC 10 (aka 2010) while your Boost library is built with VC11 (aka 2012). This has nothing to do with ODB. The correct solution is to build Date-time with VC10, the same version as your application. Normally opening the command prompt for VC10 command line tools and using the 'msvc' toolset should do the trick. Or you can try 'msvc-10.0'. Boris From boris at codesynthesis.com Tue Apr 14 11:21:17 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 14 11:33:20 2015 Subject: [odb-users] Includes missing when defining view of polymorphic type in separate file In-Reply-To: References: <13f43b848af94004a5f974ae613d324d@QEX.qosmotec.com> Message-ID: Hi Marcel, Thanks for the test case. The bug is now fixed and I built the 2.4.0-1 ODB compiler binary with the fix: http://codesynthesis.com/~boris/tmp/odb/odb-2.4.0-1-i686-windows.zip Let me know if there are any issues. Boris From shametko.roman at gmail.com Tue Apr 14 11:36:43 2015 From: shametko.roman at gmail.com (Roman Shametko) Date: Tue Apr 14 11:35:47 2015 Subject: [odb-users] Composing object view attribute In-Reply-To: References: <552A97DA.3040800@gmail.com> Message-ID: <552D340B.8050607@gmail.com> Hi. Thank you for your answer. Post load is not seems to be what I am looking for. Let me explain it. Have a look at class class AdjacencyListItem { public: std::shared_ptr m_parent; std::string m_nodeName; std::string nodePath() {...} }; It contains list of parent nodes. Assume we have object A of AdjacencyListItem type. This object contains following: A->m_parent/*"Documents"*/->m_parent/*"username"*/->m_parent/*"home"*/->m_parent/*"/"*/. Adjacency list item can return it's path by getting all it's parents names recursively. So I can call A->m_parent->getPath() which gonna result in "/home/username/Documents/". This is the path I want to get in view. But I don't really understand how can I achieve this. Basically I'd be happy with following view: #pragma db view /*some other objects*/ object(AdjacencyListItem) class View { public: ... std::shared_ptr m_parent; }; But as far as I understand it's impossible to get one. Thanks in advance. On 04/13/2015 05:11 PM, Boris Kolpackov wrote: > Hi Roman, > > Roman Shametko writes: > >> So my question is: Is there any way to supply Views with manually >> composed values? > Normally a view gets values for its members from the database > (query). But you can also declare a member transient and compute > its value using a database operation callback (e.g., post_load; > Section 14.2.5). > > Not sure if this is what you are looking for. If not, then > describe how you see the m_nodePath calculation being > implemented under the hood. > > Boris From axel50397 at gmail.com Wed Apr 15 02:43:42 2015 From: axel50397 at gmail.com (Adnan RIHAN) Date: Wed Apr 15 02:44:07 2015 Subject: [odb-users] std::map In-Reply-To: References: Message-ID: Hello there ! I?m coming back to this problem, from a long time ago. On 24 novembre 2014 at 11:16:00, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > #pragma db value > struct OfferKey > { > QSharedPointer o; > }; > > inline bool > operator< (const OfferKey& x, const OfferKey& y) {return x.o < y.o;} I didn?t notice earlier because I didn?t use this class yet (the Invoice class). Now I?ve just tried to insert an invoice, and I have a runtime ODB-Sqlite error: >?1: table invoice_carts has no column named offer_id_o As a reminder, I wanted to insert a map with an entity as the key. Boris pointed out that it wasn?t supported BUT wrapping the entity around a struct worked. Indeed, but naturally, ODB is trying to insert a wrong column name, and I don?t know how to #pragma it. Here is what I have so far (concerning only the map): >?typedef QMap ? ?Cart; >? >?# ? pragma ?db ?value(OfferKey) >? >?# ? pragma ?db ?member(Invoice::m_cart) ?table("invoice_carts") \ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?id_column("invoice_id") \ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?key_column("offer_id") \ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?key_type("UNSIGNED INT") \ > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?value_column("quantity") And of course, if I add that line below ??value(OfferKey)??: >?# ? pragma ?db ?member(OfferKey::o) ? ? ? ? ? ? transient It?s an odb compiler error:?no persistent data members in the class...?What should I do there? Thank you for your help. -- Cordialement, Adnan RIHAN. GPG: 5675-62BA (https://keybase.io/max13/key.asc) -> Si vous n'utilisez pas GPG mais souhaitez quand m?me m?envoyer un e-mail chiffr?: (https://encrypt.to/0x567562BA). From Bob.Loncar at halton.ca Tue Apr 14 10:10:21 2015 From: Bob.Loncar at halton.ca (Loncar, Bob) Date: Wed Apr 15 08:25:06 2015 Subject: [odb-users] using values in MySQL DB to create all objects In-Reply-To: References: Message-ID: I have been able to build the compiler, odblib and libmysql. I am trying to work with the hello example. I have been able to get it to build but when I try to run it I get an error saying "The program can't start because odb-2.4-vc10.dll is missing from your computer". I checked and the file is there in the appropriate directory yet I can't register it using regsvr32. I tried using elevated command prompt and tried both the 64 bit and 32 bit versions of regsvr32. I'm on windows 7 64 bit using visual studio 2010, and I have built all the projects using release 64 bit. Any ideas? [cid:image001.png@01D0769B.3746F530] Bob Loncar SCADA Programmer The Regional Municipality of Halton 1151 Bronte Rd. Oakville, Ont. L6M 3L1 Tel: 1-866-442-5866 ext 3073 Cell: 289-795-3085 Email: Bob.Loncar@halton.ca -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Friday, April 10, 2015 10:52 AM To: Loncar, Bob Cc: 'odb-users@codesynthesis.com' Subject: Re: [odb-users] using values in MySQL DB to create all objects Hi Bob, Loncar, Bob > writes: > I want to use the DB for creating all the objects. First I would > manually populate the tables/columns in my DB based on what I need, > then I would like to create all the objects from the DB to be used > within my main() and then save any changes made to the objects during > runtime back to the DB. I have no need to create new objects in my > code that will then persist in the DB. My question is how to create a > transaction that grabs all records within a table and create objects > based on those records. Take a look at Section 2.5, "Querying the Database for Objects" in the "Hello, World" chapter in the manual (BTW, if you haven't read this chapter completely, I strongly suggest that you do). If you want to get all the objects rather than a subset that matches a certain criteria, then all you have to do is omit the condition in the call to query(), for example, change: result r (db->query (query::age > 30)); To: result r (db->query ()); And you will get all the person object in the database. Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 15498 bytes Desc: image001.png Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150414/45aad3a5/image001.png From boris at codesynthesis.com Wed Apr 15 08:23:11 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 15 08:35:15 2015 Subject: [odb-users] std::map In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > 1: table invoice_carts has no column named offer_id_o FYI, a composite column name is constructed by concatenating the composite member name and the inner member name ("o" in your case). So the question is whether the schema that was produced by the ODB compiler is incorrect or the mapping to an existin schema is incorrect. Boris From boris at codesynthesis.com Wed Apr 15 08:27:23 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 15 08:39:28 2015 Subject: [odb-users] Composing object view attribute In-Reply-To: <552D340B.8050607@gmail.com> References: <552A97DA.3040800@gmail.com> <552D340B.8050607@gmail.com> Message-ID: Hi Roman, Roman Shametko writes: > So I can call A->m_parent->getPath() which gonna result in > "/home/username/Documents/". This is the path I want to get > in view. But I don't really understand how can I achieve this. Neither do I. What would be an SQL SELECT-list expression that would return such a path? If you can come up with one, then you can embed it into the view. Obviously, an SQL database cannot just "call" A->m_parent->getPath() ;-). > Basically I'd be happy with following view: > > #pragma db view /*some other objects*/ object(AdjacencyListItem) > class View { > public: > ... > std::shared_ptr m_parent; > }; > > But as far as I understand it's impossible to get one. Why not? Since 2.4.0 there is support for object loading views (Section 10.2). Boris From shametko.roman at gmail.com Wed Apr 15 08:43:00 2015 From: shametko.roman at gmail.com (Roman Shametko) Date: Wed Apr 15 08:42:01 2015 Subject: [odb-users] Composing object view attribute In-Reply-To: References: <552A97DA.3040800@gmail.com> <552D340B.8050607@gmail.com> Message-ID: <552E5CD4.4050201@gmail.com> Thanks a lot, Boris! I'm using 2.3 now, and I didn't know about object loading view. On 04/15/2015 03:27 PM, Boris Kolpackov wrote: > Hi Roman, > > Roman Shametko writes: > >> So I can call A->m_parent->getPath() which gonna result in >> "/home/username/Documents/". This is the path I want to get >> in view. But I don't really understand how can I achieve this. > Neither do I. What would be an SQL SELECT-list expression that > would return such a path? If you can come up with one, then you > can embed it into the view. Obviously, an SQL database cannot > just "call" A->m_parent->getPath() ;-). > > >> Basically I'd be happy with following view: >> >> #pragma db view /*some other objects*/ object(AdjacencyListItem) >> class View { >> public: >> ... >> std::shared_ptr m_parent; >> }; >> >> But as far as I understand it's impossible to get one. > Why not? Since 2.4.0 there is support for object loading > views (Section 10.2). > > Boris From boris at codesynthesis.com Wed Apr 15 08:31:16 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 15 08:43:18 2015 Subject: [odb-users] using values in MySQL DB to create all objects In-Reply-To: References: Message-ID: Hi Bob, Loncar, Bob writes: > I have been able to build the compiler, odblib and libmysql. I am > trying to work with the hello example. I have been able to get it > to build but when I try to run it I get an error saying "The program > can't start because odb-2.4-vc10.dll is missing from your computer". > I checked and the file is there in the appropriate directory What is "appropriate directory"? It should either be one of the directories in your PATH or in the same directory as the executable you are trying to run. Just copy it to the directory of the executable. > yet I can't register it using regsvr32. I don't understand why you are trying to register it with regsvr? What makes you think it is a COM component? Boris From axel50397 at gmail.com Wed Apr 15 09:37:01 2015 From: axel50397 at gmail.com (Adnan RIHAN) Date: Wed Apr 15 09:37:13 2015 Subject: [odb-users] std::map Message-ID: <552E697D.10205@gmail.com> Hi Boris, On 15 avril 2015 at 14:35:15, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > FYI, a composite column name is constructed by concatenating the > composite member name and the inner member name ("o" in your case). That?s what I thought. > So the question is whether the schema that was produced by the > ODB compiler is incorrect or the mapping to an existin schema > is incorrect. For me, these 2 ? problems ? are the same. The mapping could be miswrote, which makes ODB produce an incorrect schema. Or, as using an Entity as a Key isn?t supported yet, the compiler can also misinterpret the pragmas. Here is a workaround I?ve found 2 minutes ago (line 3): # ifdef ODB_COMPILER # pragma db value(OfferKey) # pragma db member(OfferKey::o) table("invoice_carts") column("") # pragma db model version(1, 1, open) # pragma db object(Invoice) table("invoices") # pragma db member(Invoice::m_cart) table("invoice_carts") \ id_column("invoice_id") \ key_column("offer_id") \ key_type("UNSIGNED INT") \ value_column("quantity") [...] # endif With this, the columns in ? *-odb.cxx ? are correct (and taken from the member(Invoice::m_cart) line) Thank you. -- Cordialement, Adnan RIHAN. Directeur-G?rant de Eolis-Software, soci?t? de services informatiques. GPG: 5675-62BA (https://keybase.io/max13/key.asc) -> Si vous n'utilisez pas GPG mais souhaitez quand m?me m?envoyer un e-mail chiffr?: (https://encrypt.to/0x567562BA). -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 882 bytes Desc: OpenPGP digital signature Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150415/d9432b03/signature.pgp From axel50397 at gmail.com Thu Apr 16 09:25:12 2015 From: axel50397 at gmail.com (Adnan RIHAN) Date: Thu Apr 16 09:25:37 2015 Subject: [odb-users] queries during results iterations Message-ID: Hello there ! I have an Invoice class and a Warehouse class. An Invoice has a ??type?? property (among other types not interesting). A Warehouse, in the database, only have 3 columns: open_date, open_time, closed_at. Each line are simply there to indicate when the user began to sell, and when he closed. The C++ model has a pointer (transient) to an Invoice. There is no link between these 2 objects in database, BUT, when a day is closed, a particular Invoice (with a particular type = INVT) is created. And when I load a Warehouse, I?have post_load callback which looks for the corresponding???INVT???type and loads it to the Warehouse?s invoice pointer. When I query the Warehouse list, it loads the callback for each result, while iterating the results. So far, it?s what I want. But during the Warehouse list iteration, the first result is correctly loaded, it loads the post_load callback is correctly called (and executed in the same transaction as the iteration) then, it crashes on ??++i??...: > Thread 0 Crashed:: Dispatch queue: com.apple.main-thread >?0 ? libodb-sqlite-2.4.dylib ? ? ? 0x000000010fad41fa odb::sqlite::select_statement::next() + 10 >?1 ? com.yourcompany.LGC ? ? ? ? ? 0x000000010f8b3b2f odb::sqlite::object_result_impl::next() + 95 (simple-object-result.txx:104) >?2 ? com.yourcompany.LGC ? ? ? ? ? 0x000000010f8ba160 odb::result_iterator::operator++() + 32 (object-result.hxx:115) >?3 ? com.yourcompany.LGC ? ? ? ? ? 0x000000010f8c5900 QOdbList > EntityManager::all(OrderBy, bool) + 576 (EntityManager.hpp:89) Any idea? Is it because I execute it in the same transaction, or something like that? When I comment out the whole callback post_load, it doesn?t crash and there is no ODB exception. I hope I don?t need to play with multiple transactions :S Thank you ! -- Cordialement, Adnan RIHAN. GPG: 5675-62BA (https://keybase.io/max13/key.asc) -> Si vous n'utilisez pas GPG mais souhaitez quand m?me m?envoyer un e-mail chiffr?: (https://encrypt.to/0x567562BA). From mne at qosmotec.com Thu Apr 16 11:20:08 2015 From: mne at qosmotec.com (Marcel Nehring) Date: Thu Apr 16 11:21:32 2015 Subject: AW: [odb-users] Includes missing when defining view of polymorphic type in separate file In-Reply-To: References: <13f43b848af94004a5f974ae613d324d@QEX.qosmotec.com> Message-ID: <88c6d329743342cfb8ab7545e1bbf7d4@QEX.qosmotec.com> Hi Boris, thanks, it works. Regards, Marcel -----Urspr?ngliche Nachricht----- Von: Boris Kolpackov [mailto:boris@codesynthesis.com] Gesendet: Dienstag, 14. April 2015 17:21 An: Marcel Nehring Cc: odb-users@codesynthesis.com Betreff: Re: [odb-users] Includes missing when defining view of polymorphic type in separate file Hi Marcel, Thanks for the test case. The bug is now fixed and I built the 2.4.0-1 ODB compiler binary with the fix: http://codesynthesis.com/~boris/tmp/odb/odb-2.4.0-1-i686-windows.zip Let me know if there are any issues. Boris From boris at codesynthesis.com Fri Apr 17 11:06:30 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 17 11:18:38 2015 Subject: [odb-users] queries during results iterations In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > Is it because I execute it in the same transaction, or something like > that? No, that's how you should do it and it should work. Can you show the body of post_load() as well as the top-level transaction that iterates over Warehouse? Is there an eager-loaded pointer in Invoice (directly or indirectly) that point to (another) Warehouse? Boris From axel50397 at gmail.com Fri Apr 17 15:40:16 2015 From: axel50397 at gmail.com (Adnan RIHAN) Date: Fri Apr 17 15:40:41 2015 Subject: [odb-users] queries during results iterations In-Reply-To: References: Message-ID: Hi Boris, On 17 avril 2015 at 17:18:38, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > No, that's how you should do it and it should work. Can you show the > body of post_load() as well as the top-level transaction that iterates > over Warehouse? Sure. First of all, WarehouseWidget loads EntityManager::all() to get all the Warehouse lines: template ? ? ? ? ? ? ? ? ? ? ? ? QOdbList > ? ?all(OrderBy orderBy = ORD_NATURALLY, bool useCache = true) { ? ? [...] ? ? QOdbList > ? ?list; ? ? try { ? ? ? ? odb::transaction ? ?t(this->m_db->begin(), !odb::transaction::has_current()); ? ? ? ? odb::result ? ? ?r(this->m_db->query(useCache)); ? ? ? ? for (typename odb::result::iterator i(r.begin()); i != r.end(); ++i) { ? ? ? ? ? ? list.append(QSharedPointer(new T(*i))); ? ? ? ? } ? ? ? ? odb::transaction::current().commit(); ? ? } catch (const odb::result_not_cached &e) { ? ? ? ? this->m_lastError = ERR_NOT_CACHED; ? ? ? ? this->m_lastRawError = e.what(); ? ? ? ? qDebug() << "ODB Exception:" << this->m_lastRawError; ? ? } catch (const odb::exception &e) { ? ? ? ? this->m_lastRawError = e.what(); ? ? ? ? qDebug() << "ODB Exception:" << this->m_lastRawError; ? ? } ? ? [...] ? ? return (list); } Here is the callback (? find()?? and ? findOne()?? call respectively ??query()?? and ??query_one()?? : void ? ?Warehouse::dbCallback(odb::callback_event e, odb::database &db) { ? ? switch (e) { ? ? ? ? case odb::callback_event::post_load: { ? ? ? ? ? ? this->m_openStock = MasterController::inst()->em()->findOne( ? ? ? ? ? ? ? ? ? ? ? ? ? ? odb::query::type == "IV_INVENT" ? ? ? ? ? ? ? ? ? ? ? ? ? ? && odb::query::createdAt >= this->m_openedAt.addDays(-1) ? ? ? ? ? ? ? ? ? ? ? ? ? ? && odb::query::createdAt <= this->m_openedAt ? ? ? ? ? ? ); ? ? ? ? ? ? this->m_closeStock = MasterController::inst()->em()->findOne( ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?odb::query::type == "IV_INVENT" ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&& odb::query::createdAt >= this->m_openedAt ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&& odb::query::createdAt <= this->m_closedAt ? ? ? ? ? ? ); ? ? ? ? ? ? this->m_invoices = MasterController::inst()->em()->find( ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?odb::query::type != "IV_INVENT" ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&& odb::query::createdAt >= this->m_openedAt ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&& odb::query::createdAt <= this->m_closedAt ? ? ? ? ? ? ); ? ? ? ? ? ? break; ? ? ? ? } ? ? ? ? default: break; ? ? } } Apparently, the callback is correctly called, but when back to EntityManager::all(), it continues until it reaches ??++i?? (I?ve checked by moving it to the end of the for loop). > Is there an eager-loaded pointer in Invoice (directly?or indirectly) > that point to (another) Warehouse? No, the Invoice class doesn?t have any pointers except to Customer (which is currently always null). I must say that the EntityManager isn?t a Singleton itself, but is accessed via a Singleton, which makes it global. But as the?queries?are done entirely in a method, I don?t think there is a conflict (each call has its own stack). Thanks for your help. -- Cordialement, Adnan RIHAN. GPG: 5675-62BA (https://keybase.io/max13/key.asc) -> Si vous n'utilisez pas GPG mais souhaitez quand m?me m?envoyer un e-mail chiffr?: (https://encrypt.to/0x567562BA). From jan.k.pi at t-online.de Fri Apr 17 12:08:21 2015 From: jan.k.pi at t-online.de (t-online) Date: Sun Apr 19 02:18:32 2015 Subject: [odb-users] Problem with ODB in QtCreator and MingW Message-ID: I tried what you said in your last message, I read the MingW, QtCreator and Windows tutorial carefully and added the "peron-odb.hxx" include and get the following error : =============================== 17:56:10: Running steps for project test... 17:56:10: Configuration unchanged, skipping qmake step. 17:56:10: Starting: "C:\Qt\Qt5.4.0\Tools\mingw491_32\bin\mingw32-make.exe" C:/Qt/Qt5.4.0/Tools/mingw491_32/bin/mingw32-make -f Makefile.Debug mingw32-make[1]: Entering directory 'C:/Users/Jan/Documents/QT-Projects/build-test-Desktop_Qt_5_4_0_MinGW_32bit-Debug' odb --database mysql --profile qt --generate-schema --generate-query --generate-session -IC:/Qt/Qt5.4.0/5.4/mingw491_32/include ..\test\person.h odb: error: the system couldn't find the path. Makefile.Debug:110: recipe for target 'person-odb.cxx' failed mingw32-make[1]: *** [person-odb.cxx] Error 1 mingw32-make[1]: Leaving directory 'C:/Users/Jan/Documents/QT-Projects/build-test-Desktop_Qt_5_4_0_MinGW_32bit-Debug' mingw32-make: *** [debug] Error 2 makefile:34: recipe for target 'debug' failed 17:56:11: The process "C:\Qt\Qt5.4.0\Tools\mingw491_32\bin\mingw32-make.exe" exited with code 2. Error while building/deploying project test (kit: Desktop Qt 5.4.0 MinGW 32bit) When executing step "Make" 17:56:11: Elapsed time: 00:00. ================================ How I install ODB : - I put all ODB Compiler files in the QtCreator's MingW folder (without putting it in different structure as downloaded) - and install all libarys in the QtCreator's MingW folder with : - ./configure --prefix=/c/Qt/Tools/mingw491_32/i686-w64-mingw32 - make - make install prefix=/c/Qt/Tools/mingw491_32/i686-w64-mingw32 Jan -------------- next part -------------- A non-text attachment was scrubbed... Name: project-files.zip Type: application/x-zip-compressed Size: 4045 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150417/f28aa87b/project-files.bin From boris at codesynthesis.com Mon Apr 20 09:44:52 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 20 09:57:05 2015 Subject: [odb-users] queries during results iterations In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > odb::transaction t(this->m_db->begin(), !odb::transaction::has_current()); I don't see anything abvious but then again all your code is obscured by the multitude of wrappers. Perhaps one of these wrappers (that you call from the callback) commits the current transaction. After all, you need the above "start a transaction and make it current unless one is already in progress" hack for some reason... Boris From boris at codesynthesis.com Mon Apr 20 09:50:47 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 20 10:03:01 2015 Subject: [odb-users] Problem with ODB in QtCreator and MingW In-Reply-To: References: Message-ID: Hi, t-online writes: > 17:56:10: Running steps for project test... > 17:56:10: Configuration unchanged, skipping qmake step. > 17:56:10: Starting: "C:\Qt\Qt5.4.0\Tools\mingw491_32\bin\mingw32-make.exe" > C:/Qt/Qt5.4.0/Tools/mingw491_32/bin/mingw32-make -f Makefile.Debug > mingw32-make[1]: Entering directory 'C:/Users/Jan/Documents/QT-Projects/build-test-Desktop_Qt_5_4_0_MinGW_32bit-Debug' > odb --database mysql --profile qt --generate-schema --generate-query --generate-session -IC:/Qt/Qt5.4.0/5.4/mingw491_32/include ..\test\person.h > odb: error: the system couldn't find the path. So QtCreator runs ODB as you would want. But then ODB fails saying that the file it tries to compile does not exist. Make helpfully tells you which directory it is in. So check if C:/Users/Jan/Documents/QT-Projects/build-test-Desktop_Qt_5_4_0_MinGW_32bit-Debug/..\test\person.h exists. If it doesn't, then try to figure out where it is and adjust your project accordingly. This should be a pretty simple issue to fix. In the future please try to solve things like this yourself. If you expect me to debug every silly mistake in your project, I am afraid I won't do that. Boris From axel50397 at gmail.com Mon Apr 20 12:52:52 2015 From: axel50397 at gmail.com (Adnan RIHAN) Date: Mon Apr 20 12:53:17 2015 Subject: [odb-users] queries during results iterations In-Reply-To: References: Message-ID: Hi Boris, On 20 avril 2015 at 15:57:05, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > > odb::transaction t(this->m_db->begin(), !odb::transaction::has_current()); > After all, > you need the above "start a transaction and make it current unless > one is already in progress" hack for some reason... Actually, it?s exactly for this issue. In the beginning, I only had: odb::transaction t(this->m_db->begin()) [...] t.commit(); But the callback would call the same function the transaction is in, and obviously I can begin 2 transactions at the same time in the same thread right? The only other way to check that would be to make a separated query/query_one in the callback, to be sure to avoid trying to create another transaction, while correctly closing the right one and not ??current??. Now, writing this email, I realized that ? odb::transaction::current().commit();?? is closing the current transaction, opened by findOne() and NOT REOPENED in the callback. I?ll add a boolean and come back to tell you if I?m failing so much I must relearn how to code... -- Cordialement, Adnan RIHAN. GPG: 5675-62BA (https://keybase.io/max13/key.asc) -> Si vous n'utilisez pas GPG mais souhaitez quand m?me m?envoyer un e-mail chiffr?: (https://encrypt.to/0x567562BA). From konstantin.tarovik at ab-soft.net Tue Apr 21 12:17:11 2015 From: konstantin.tarovik at ab-soft.net (Konstantin Tarovik) Date: Tue Apr 21 12:53:13 2015 Subject: [odb-users] ODB compiler issue. To-one relation with shared_ptr Message-ID: <55367807.1080507@ab-soft.net> Hi all, I have issue with ODB compiler on OSX 10.10. When I try to compile class implementing to-one relation with shared_ptr I get the following error: *>> /Users/user/Documents/Work/SDKs/ODB/odb-2.4.0-i686-macosx/bin/odb -d sqlite --generate-schema --generate-query message_imp.hpp** * *message_imp.hpp:75:10: error: 'shared_ptr' in namespace 'std' does not name a template type** ** std::shared_ptr _sender;** ** ^** **message_imp.hpp:83:28: error: unable to resolve name 'Message::_sender' in db pragma member** * When I compile the same class with shared_ptr changed to auto_ptr ODB generates code with no problems but auto_ptr is not suitable for me. I use ODB compiler binary downloaded from http://www.codesynthesis.com/products/odb/download.xhtml Class code: *class Message : public IMessage {** **public:** ** Message();** ** Message(const Message& m);** ** Message(const std::string& text, int messageId, int conversationId);** ** ** const std::string& text() const;** ** void setText(const std::string& text);** ** ** int messageId() const;** ** void setMessageId(int messageId);** **** ** int conversationId() const;** ** void setConversationId(int conversationId);** **** //private: ** std::shared_ptr _sender;** ** std::string _text;** ** unsigned long _creationTime;** ** int _conversationId;** ** int _messageId;** **};** ** **#pragma db object(Message)** **#pragma db member(Message::_sender)** **#pragma db member(Message::_text)** **#pragma db member(Message::_creationTime)** **#pragma db member(Message::_conversationId)** **#pragma db member(Message::_messageId) id auto** * Please advice. Thank you. Best regards, Konstantin Tarovik From konstantin.tarovik at ab-soft.net Wed Apr 22 08:39:16 2015 From: konstantin.tarovik at ab-soft.net (Konstantin Tarovik) Date: Wed Apr 22 12:30:39 2015 Subject: [odb-users] Re: ODB compiler issue. To-one relation with shared_ptr In-Reply-To: <55367807.1080507@ab-soft.net> References: <55367807.1080507@ab-soft.net> Message-ID: <55379674.9040700@ab-soft.net> Hi all, I've found the solution. I needed to pass "--std c++11" to ODB compiler. Thank you. Best regards, Konstantin Tarovik On 4/21/15 7:17 PM, Konstantin Tarovik wrote: > Hi all, > > I have issue with ODB compiler on OSX 10.10. When I try to compile > class implementing to-one relation with shared_ptr I get the following > error: > > *>> /Users/user/Documents/Work/SDKs/ODB/odb-2.4.0-i686-macosx/bin/odb > -d sqlite --generate-schema --generate-query message_imp.hpp** > * > *message_imp.hpp:75:10: error: 'shared_ptr' in namespace 'std' does > not name a template type** > ** std::shared_ptr _sender;** > ** ^** > **message_imp.hpp:83:28: error: unable to resolve name > 'Message::_sender' in db pragma member** > * > When I compile the same class with shared_ptr changed to auto_ptr ODB > generates code with no problems but auto_ptr is not suitable for me. I > use ODB compiler binary downloaded from > http://www.codesynthesis.com/products/odb/download.xhtml > > Class code: > > *class Message : public IMessage {** > **public:** > ** Message();** > ** Message(const Message& m);** > ** Message(const std::string& text, int messageId, int > conversationId);** > ** > ** const std::string& text() const;** > ** void setText(const std::string& text);** > ** > ** int messageId() const;** > ** void setMessageId(int messageId);** > **** > ** int conversationId() const;** > ** void setConversationId(int conversationId);** > ** > //private: > > ** std::shared_ptr _sender;** > ** std::string _text;** > ** unsigned long _creationTime;** > ** int _conversationId;** > ** int _messageId;** > **};** > ** > **#pragma db object(Message)** > **#pragma db member(Message::_sender)** > **#pragma db member(Message::_text)** > **#pragma db member(Message::_creationTime)** > **#pragma db member(Message::_conversationId)** > **#pragma db member(Message::_messageId) id auto** > * > Please advice. > > Thank you. > > Best regards, > Konstantin Tarovik > > > From jan.k.pi at t-online.de Tue Apr 21 14:05:25 2015 From: jan.k.pi at t-online.de (t-online) Date: Wed Apr 22 12:31:49 2015 Subject: [odb-users] Problem with ODB in QtCreator and MingW In-Reply-To: References: Message-ID: <1DFABFB619114DE0A3DCE5DC55CCCD3D@JanPC> Hi, thanks for answering, i don't want to waste your time, but in my eyes you are to only one who can help me ... the folder wasn't the problem (the folder exist and executing the ODB-Compiler inside QtCreators MingW from commandline brings also the same error) but after trying some things i believe that i install the ODB-Compiler wrong.. If i try to use the ODB-Compiler inside the QtCreators Mingw i get the following error again : "system couldn't find the path" But if i use the ODB-Compiler with the given Mingw (inside the "mingw"-folder of the windows binaries) the compiler seems to work (all files was generated) ... => so how can i setup the ODB-Compiler to use the QtCreators Mingw Compiler (if it's possible) (I read the install guides, but maybe didn't understand it right) The problem while using the given Mingw is that the builded programm don't run right : i.e: a simple output do not appear And the programm couldn't be executed in debug-mode => it fails with : "The gdb process terminated unexpectly (code 0)" "Cannot continue debugged process: The program is not being run." "During startup program exited with code 0xc0000135" -> this is because "libgcc_s_sjlj-1.dll" is missing (QtCreators Minw hasn't no such file, only the given Mingw-Compiler given with the ODB-Compiler) But after adding this file i get the next errors ... In my opinion there is a version-conflict between ODB-Compiler and the build-compiler (32bit vs 64bit) maybe the odb libaries are also compiled with the wrong compiler settings ODB-Installtion like i do it (maybe you see a wrong step) : - i copy the ODB-Compiler files (without the "mingw") in the proper QtCreators MingW folders - i use the MSYS given by the ODB-Compiler download - and execute in the libary folders (all was done without errors) - ./configure --prefix=/c/Qt/Qt5.4.0/Tools/mingw491_32/i686-w64-mingw32 - make - make install prefix=/c/Qt/Qt5.4.0/Tools/mingw491_32/i686-w64-mingw32 - and it shows that he find the MingW Compiler and use it to compile -----original message----- From: Boris Kolpackov Sent: Monday, April 20, 2015 3:50 PM To: t-online Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Problem with ODB in QtCreator and MingW Hi, t-online writes: > 17:56:10: Running steps for project test... > 17:56:10: Configuration unchanged, skipping qmake step. > 17:56:10: Starting: "C:\Qt\Qt5.4.0\Tools\mingw491_32\bin\mingw32-make.exe" > C:/Qt/Qt5.4.0/Tools/mingw491_32/bin/mingw32-make -f Makefile.Debug > mingw32-make[1]: Entering directory > 'C:/Users/Jan/Documents/QT-Projects/build-test-Desktop_Qt_5_4_0_MinGW_32bit-Debug' > odb --database mysql --profile > qt --generate-schema --generate-query --generate-session -IC:/Qt/Qt5.4.0/5.4/mingw491_32/include > ..\test\person.h > odb: error: the system couldn't find the path. So QtCreator runs ODB as you would want. But then ODB fails saying that the file it tries to compile does not exist. Make helpfully tells you which directory it is in. So check if C:/Users/Jan/Documents/QT-Projects/build-test-Desktop_Qt_5_4_0_MinGW_32bit-Debug/..\test\person.h exists. If it doesn't, then try to figure out where it is and adjust your project accordingly. This should be a pretty simple issue to fix. In the future please try to solve things like this yourself. If you expect me to debug every silly mistake in your project, I am afraid I won't do that. Boris From organgtool at gmail.com Wed Apr 22 22:38:56 2015 From: organgtool at gmail.com (Greg McKeever) Date: Thu Apr 23 10:27:53 2015 Subject: [odb-users] Unable to Find Suitable Accessor Function Error Message-ID: I am trying to compile a simple class using ODB 2.4.0 on an Ubuntu Linux machine and I keep getting the following error: BaseTransferObject.h:24:34: error: unable to find suitable accessor function 'getPrimaryKey' The command I am using to compile the class is: /usr/local/bin/odb -d sqlite BaseTransferObject.h The source of the file is: /* * BaseTransferObject.h * * Created on: Jul 29, 2013 * Author: Greg McKeever */ #ifndef BASETRANSFEROBJECT_H_ #define BASETRANSFEROBJECT_H_ #pragma db object class BaseTransferObject { public: BaseTransferObject(); virtual ~BaseTransferObject(); void setPrimaryKey( long thePrimaryKey ); long getPrimaryKey(); private: #pragma db id column("idfr") get(getPrimaryKey) set(setPrimaryKey) long primaryKey; }; #endif /* BASETRANSFEROBJECT_H_ */ I am specifying the getter and setter in the pragma since I get the following error if I do not explicitly set them: BaseTransferObject.h:23:10: error: data member 'primaryKey' is private and no suitable accessor function could be automatically found BaseTransferObject.h:23:10: info: consider making class 'odb::access' a friend of class 'BaseTransferObject' BaseTransferObject.h:23:10: info: or use '#pragma db get' to explicitly specify the accessor function or expression I tried adding odb::access as a friend class and that fixed this problem, although I think it created other problems. Could you please help me as I can not find anything in the ODB manual about what I am doing wrong? Thanks, Greg From konstantin.tarovik at ab-soft.net Thu Apr 23 09:34:41 2015 From: konstantin.tarovik at ab-soft.net (Konstantin Tarovik) Date: Thu Apr 23 10:27:53 2015 Subject: [odb-users] lazy_shared_ptr compilation issue Message-ID: <5538F4F1.9070500@ab-soft.net> Hi all, I have the following issue with lazy_shared_ptr. In one of my persistent objects there is a field: odb::lazy_shared_ptr _sender; It compiles both with ODB compiler and C++ without issues until I call _sender.load(). When I add this call I get the following error when compiling my project with C++: In file included from external/storage/odb/ios/include/odb/lazy-ptr.hxx:668: external/storage/odb/ios/include/odb/lazy-ptr.ixx:1153:10: error: no viable overloaded '=' p_ = i_.template load (true); // Reset id. ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ /Users/user/Documents/Work/core/src/db/message_imp.cpp:56:21: note: in instantiation of member function 'odb::lazy_shared_ptr::load' requested here return _sender.load(); ^ In file included from /Users/user/Documents/Work/core/src/db/message_imp.cpp:9: In file included from /Users/user/Documents/Work/core/src/db/message_imp.hpp:11: In file included from core/src/db/message.hpp:11: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:439: In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:628: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3841:17: note: candidate function not viable: no known conversion from 'typename object_traits::pointer_type' (aka 'rc::core::Contact *') to 'const std::__1::shared_ptr' for 1st argument shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3850:17: note: candidate function not viable: no known conversion from 'typename object_traits::pointer_type' (aka 'rc::core::Contact *') to 'std::__1::shared_ptr' for 1st argument shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3848:9: note: candidate template ignored: could not match 'shared_ptr' against 'rc::core::Contact *' operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT; ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3857:9: note: candidate template ignored: could not match 'shared_ptr' against 'rc::core::Contact *' operator=(shared_ptr<_Yp>&& __r); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3865:9: note: candidate template ignored: could not match 'auto_ptr' against 'rc::core::Contact *' operator=(auto_ptr<_Yp>&& __r); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3884:9: note: candidate template ignored: could not match 'unique_ptr' against 'rc::core::Contact *' operator=(unique_ptr<_Yp, _Dp>&& __r); ^ 1 error generated. Am I doing something wrong? Thank you. Best regards, Konstantin Tarovik From boris at codesynthesis.com Thu Apr 23 10:22:28 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 23 10:34:36 2015 Subject: [odb-users] Unable to Find Suitable Accessor Function Error In-Reply-To: References: Message-ID: Hi Greg, Greg McKeever writes: > BaseTransferObject.h:24:34: error: unable to find suitable accessor > function 'getPrimaryKey' > > long getPrimaryKey(); An accessor must be const: long getPrimaryKey() const; Boris From boris at codesynthesis.com Thu Apr 23 10:26:16 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 23 10:38:24 2015 Subject: [odb-users] lazy_shared_ptr compilation issue In-Reply-To: <5538F4F1.9070500@ab-soft.net> References: <5538F4F1.9070500@ab-soft.net> Message-ID: Hi Konstantin, Konstantin Tarovik writes: > odb::lazy_shared_ptr _sender; > > [...] > > p_ = i_.template load (true); // Reset id. > [...] > note: candidate function not viable: no known conversion from > 'typename object_traits::pointer_type' (aka > 'rc::core::Contact *') to 'const The object pointer of Contact is a raw pointer, not std::shared_ptr (Section 3.3). Boris From boris at codesynthesis.com Thu Apr 23 10:40:17 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 23 10:52:26 2015 Subject: [odb-users] Problem with ODB in QtCreator and MingW In-Reply-To: <1DFABFB619114DE0A3DCE5DC55CCCD3D@JanPC> References: <1DFABFB619114DE0A3DCE5DC55CCCD3D@JanPC> Message-ID: Hi, t-online writes: > ODB-Installtion like i do it (maybe you see a wrong step) : > - i copy the ODB-Compiler files (without the "mingw") in the proper > QtCreators MingW folders Here is a quote from the README file that comes with the ODB compiler binary for Windows: " Note also that while you can move the ODB compiler directory around, you cannot move the individual sub-directories or files inside it. For example, copying the ODB compiler executable to C:\Windows will not work. " And here are the instructions that come before that: " To install this package simply unpack it into a directory of your choice, for example C:\tools. The ODB compiler binary will be in the bin\ directory inside the package directory, for example C:\tools\odb-x.y.z-i686-windows\bin\. You can run the ODB compiler by either using the absolute path, for example: C:\tools\odb-x.y.z-i686-windows\bin\odb --version Or you can add the bin\ directory to the Path environment variable. To accomplish this, open Control Panel, then System, select the Advanced tab and click on the Environment Variables button. If you have administrator privileges, select the Path variable from the System variables list. Otherwise, select (or create) the Path variable from the User variables list. Click the Edit button and add the bin\ directory to the list. Click Ok, then log off and log on again for the changes to take effect. Once this is done, you should be able to run the ODB compiler by using just its name, for example: odb --version " So try this: 1. Unpack the ODB compiler archive to C:\ 2. Don't move/copy any files 3. In your Qt MinGW prompt (or QtCreator), use the absolute path to the ODB compiler (e.g. C:\odb-2.4.0-i686-windows\bin\odb) and see if that works. 4. If step 3 works, try the PATH environment variable as described above so that you can just use 'odb'. Boris From organgtool at gmail.com Thu Apr 23 10:43:32 2015 From: organgtool at gmail.com (Greg McKeever) Date: Thu Apr 23 10:52:44 2015 Subject: [odb-users] Unable to Find Suitable Accessor Function Error In-Reply-To: References: Message-ID: Boris, I figured it had to be something simple but it was driving me crazy that I couldn't figure it out. Thank you for the help! - Greg On Apr 23, 2015 10:34 AM, "Boris Kolpackov" wrote: > Hi Greg, > > Greg McKeever writes: > > > BaseTransferObject.h:24:34: error: unable to find suitable accessor > > function 'getPrimaryKey' > > > > long getPrimaryKey(); > > An accessor must be const: > > long getPrimaryKey() const; > > Boris > From jan.k.pi at t-online.de Thu Apr 23 12:21:58 2015 From: jan.k.pi at t-online.de (t-online) Date: Fri Apr 24 07:38:45 2015 Subject: [odb-users] Problem with ODB in QtCreator and MingW In-Reply-To: References: <1DFABFB619114DE0A3DCE5DC55CCCD3D@JanPC> Message-ID: <63A72EE7CD20442BBEFF201470C36EB1@JanPC> Hi, thanks for answer I try what you say and the ODB-Compiler creates the 4 files but i can't execute the program after compiling it. I start the Program from QtCreator,a console pop up and make nothing (i add a simple qDebug() which was not executed) I start the Program from QtCreator in Debug mode, i get the 3 error messages : "The gdb process terminated unexpectedly (code 0)" "Cannot continue debugged process: The program is not being run." "During startup program exited with code 0xc000007b." If I then start the programm with console i get the error that the "ibgcc_s_sjlj-1.dll" is missing and this file i couldn't find inside the QtCreators MingW bin (where it normally should be because the program was compiled with this?) but inside the MingW which was shipped with ODB -> If i then add the "ibgcc_s_sjlj-1.dll" from the bin path i get the error "the Procedureentry __gxx_personality_sj0 wasn't found in DLL libstdc++-6.dll" -> If i then add the "ibgcc_s_sjlj-1.dll" from the bin64 path i get the same error as in QtCreator-debug-mode "the programm couldn't start (0xc000007b)" Jan -------------- next part -------------- A non-text attachment was scrubbed... Name: project-files.zip Type: application/x-zip-compressed Size: 9798 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150423/a04f177a/project-files.bin From fredrik.strand at qliro.com Fri Apr 24 03:43:39 2015 From: fredrik.strand at qliro.com (Fredrik Strand) Date: Fri Apr 24 07:38:46 2015 Subject: [odb-users] Extended types SQL Server (table and/or xml type) Message-ID: <8AA78A021277394A9D783152B9622C207AF50E89@TELLUS-EXCH02.cdongroup.com> Hi, I want to execute a stored procedure in SQL Server with XML or table type as an argument. Could anyone give me some hints where to start? I've looked through the examples but can't really find any useful hints. /Fredrik From boris at codesynthesis.com Fri Apr 24 11:12:41 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 24 11:24:51 2015 Subject: [odb-users] Extended types SQL Server (table and/or xml type) In-Reply-To: <8AA78A021277394A9D783152B9622C207AF50E89@TELLUS-EXCH02.cdongroup.com> References: <8AA78A021277394A9D783152B9622C207AF50E89@TELLUS-EXCH02.cdongroup.com> Message-ID: Hi Fredrik, Fredrik Strand writes: > I want to execute a stored procedure in SQL Server with XML or table > type as an argument. XML should be pretty straightforward. You will need to pieces of information: "Extended Database to C++ Type Mapping in ODB": http://www.codesynthesis.com/~boris/blog/2012/07/18/custom-database-to-cxx-type-mapping-in-odb/ And the mssql/custom/ test from the odb-tests package. This test shows how to work with the XML type. The table-valued parameters are a lot harder. Perhaps one could map them to XML using stored procedures. I don't think, however, this will be a general-purpose solution (i.e., it will be specific to the table types of an application), though who knows. There are also plans (in the early stage) to have proper support for table-valued parameters using the ODBC support. Boris From fredrik.strand at qliro.com Mon Apr 27 03:55:30 2015 From: fredrik.strand at qliro.com (Fredrik Strand) Date: Mon Apr 27 12:32:07 2015 Subject: [odb-users] Extended types SQL Server (table and/or xml type) In-Reply-To: References: <8AA78A021277394A9D783152B9622C207AF50E89@TELLUS-EXCH02.cdongroup.com> Message-ID: <8AA78A021277394A9D783152B9622C207AF50FA3@TELLUS-EXCH02.cdongroup.com> Thanks for the hints! Now I got a nice view how to use the XML type in normal queries. However, I can't really see how it will be used when using stored procedures. At the moment I'm calling a stored procedure as stated in the documentation under 21.7 SQL Server Stored Procedures: #pragma db view query("EXEC....") object Db.query(query:_val(value)).... In this case I'm just using a std::string as value and it automagically maps to an nvarchar in the procedure. Since I can't specify the actual type in the call how do I specify that it's an XML argument that I want to send/use? Regards, Fredrik -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Friday, April 24, 2015 5:13 PM To: Fredrik Strand Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Extended types SQL Server (table and/or xml type) Hi Fredrik, Fredrik Strand writes: > I want to execute a stored procedure in SQL Server with XML or table > type as an argument. XML should be pretty straightforward. You will need to pieces of information: "Extended Database to C++ Type Mapping in ODB": http://www.codesynthesis.com/~boris/blog/2012/07/18/custom-database-to-cxx-type-mapping-in-odb/ And the mssql/custom/ test from the odb-tests package. This test shows how to work with the XML type. The table-valued parameters are a lot harder. Perhaps one could map them to XML using stored procedures. I don't think, however, this will be a general-purpose solution (i.e., it will be specific to the table types of an application), though who knows. There are also plans (in the early stage) to have proper support for table-valued parameters using the ODBC support. Boris From boris at codesynthesis.com Mon Apr 27 12:59:57 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 27 13:12:06 2015 Subject: [odb-users] Problem with ODB in QtCreator and MingW In-Reply-To: <63A72EE7CD20442BBEFF201470C36EB1@JanPC> References: <1DFABFB619114DE0A3DCE5DC55CCCD3D@JanPC> <63A72EE7CD20442BBEFF201470C36EB1@JanPC> Message-ID: Hi Jan, t-online writes: > I try what you say and the ODB-Compiler creates the 4 files but i > can't execute the program after compiling it. Ok, so the ODB compiler is working. I think the latest problem is due to you building the ODB runtime libraries (libodb, libodb-sqlite) using GCC that comes with ODB rather than the one that comes with QtCreator. If you can, try not to use MinGW/MSYS that comes with the ODB compiler. If you don't have MSYS as part of your QtCreator, then use ODB's MSYS but be very careful to use GCC from your Qt distribution and not from ODB. Specifically, use the CXX option to specify the full path to g++, for example: ./configure CXX=/c/qtcreator/path/to/where/qt/mingw/is/installed/bin/g++ Also, check the output of the QtCreator build and add any options that may affect the resulting library (e.g., -m32/-m64, -std, etc). Boris From boris at codesynthesis.com Mon Apr 27 13:24:13 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 27 13:36:22 2015 Subject: [odb-users] Extended types SQL Server (table and/or xml type) In-Reply-To: <8AA78A021277394A9D783152B9622C207AF50FA3@TELLUS-EXCH02.cdongroup.com> References: <8AA78A021277394A9D783152B9622C207AF50E89@TELLUS-EXCH02.cdongroup.com> <8AA78A021277394A9D783152B9622C207AF50FA3@TELLUS-EXCH02.cdongroup.com> Message-ID: Hi Fredrik, Fredrik Strand writes: > However, I can't really see how it will be used when using stored > procedures. At the moment I'm calling a stored procedure as stated > in the documentation under 21.7 SQL Server Stored Procedures: > > #pragma db view query("EXEC....") > object > > Db.query(query:_val(value)).... > > > In this case I'm just using a std::string as value and it automagically > maps to an nvarchar in the procedure. Since I can't specify the actual > type in the call how do I specify that it's an XML argument that I want > to send/use? For this to work automagically, as you put it, you will need to represent XML as a separate C++ type (it can be as simple as a struct containing a string). You will then need to provide the conversion expression as is done for point and variant types in the 'mssql/custom' test. Note that you will also need to provide the value_traits specialization. It can be a simple implementation that forwards to the std::string's one. Boris From jan.k.pi at t-online.de Mon Apr 27 17:57:24 2015 From: jan.k.pi at t-online.de (t-online) Date: Tue Apr 28 08:20:42 2015 Subject: [odb-users] Problem with ODB in QtCreator and MingW In-Reply-To: References: <1DFABFB619114DE0A3DCE5DC55CCCD3D@JanPC> <63A72EE7CD20442BBEFF201470C36EB1@JanPC> Message-ID: <8D8AEB315F7F4B6FBE328D552A045FF5@JanPC> Hi, great thanks for your help and the time it needed problem is solved :-) to give a resume : - i forgot the #include person-odb.hxx - i install the odb-compiler wrong -> have to leave it like downloaded (and not move him half around) and link in .pro file directly (or with PATH-variable) - i build the ODB-libaries with 64bit while the QtCreators MinGW was used in 32bit mode -> so i have built the libary on a pure 32bit MinGW and copy the generated libary files into QtCreators MinGW Jan From vchendrix at lbl.gov Tue Apr 28 15:54:36 2015 From: vchendrix at lbl.gov (Val Hendrix) Date: Tue Apr 28 15:54:44 2015 Subject: [odb-users] Deadlock in apache module that uses odb-mysql? Message-ID: Hello, Details of my system: - OS - Scientific Linux 7 - Linux vagrant 3.10.0-229.1.2.el7.x86_64 #1 SMP Thu Mar 26 09:10:25 CDT 2015 x86_64 x86_64 x86_64 GNU/Linux - ODB - 2.3.0-6.el7 - DB - Maria DB 1:5.5.41-2.el7_0 - Apache - httpd.x86_64 2.4.6-31.sl7 I am a new user to ODB. On my project we are integrating ODB into our an existing application that is deployed as an apache module. I have created a working version of ODB classes that map to our database schema. I wrote integration tests that creates, queries and deletes data. When I try to register a simple apache module that links to the odb-mysql library, the apache web server hangs on start up. Executing pstack on the apache process that is starting up shows the following trace. It looks like there is a dead lock but I am unfamiliar with these libraries. Can someone shed some light on what is the problem? I have confirmed that libmysqlclient is indeed reentrant. *$ sudo pstack 5457* *Thread 2 (Thread 0x7f2a6fbb5700 (LWP 5458)):* *#0 0x00007f2a734bef7d in __lll_lock_wait () from /lib64/libpthread.so.0* *#1 0x00007f2a734bad5c in _L_lock_839 () from /lib64/libpthread.so.0* *#2 0x00007f2a734bac79 in pthread_mutex_lock () from /lib64/libpthread.so.0* *#3 0x00007f2a746591ee in _dl_open () from /lib64/ld-linux-x86-64.so.2* *#4 0x00007f2a7301c992 in do_dlopen () from /lib64/libc.so.6* *#5 0x00007f2a74655314 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2* *#6 0x00007f2a7301ca52 in __libc_dlopen_mode () from /lib64/libc.so.6* *#7 0x00007f2a734c0853 in pthread_cancel_init () from /lib64/libpthread.so.0* *#8 0x00007f2a734c0a1c in _Unwind_ForcedUnwind () from /lib64/libpthread.so.0* *#9 0x00007f2a734bed90 in __pthread_unwind () from /lib64/libpthread.so.0* *#10 0x00007f2a734b9e15 in pthread_exit () from /lib64/libpthread.so.0* *#11 0x00007f2a71ab6c9b in nptl_pthread_exit_hack_handler () from /usr/lib64/mysql/libmysqlclient.so.18* *#12 0x00007f2a734b8df3 in start_thread () from /lib64/libpthread.so.0* *#13 0x00007f2a72fe21ed in clone () from /lib64/libc.so.6* *Thread 1 (Thread 0x7f2a74851780 (LWP 5457)):* *#0 0x00007f2a734b9f37 in pthread_join () from /lib64/libpthread.so.0* *#1 0x00007f2a71ab7857 in my_thread_global_init () from /usr/lib64/mysql/libmysqlclient.so.18* *#2 0x00007f2a71ab53af in my_init () from /usr/lib64/mysql/libmysqlclient.so.18* *#3 0x00007f2a71a7c91c in mysql_server_init () from /usr/lib64/mysql/libmysqlclient.so.18* *#4 0x00007f2a7218a226 in mysql_process_init (this=0x7f2a723a3784 ) at connection-factory.cxx:113* *#5 __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535) at connection-factory.cxx:128* *#6 _GLOBAL__sub_I_connection_factory.cxx(void) () at connection-factory.cxx:316* *#7 0x00007f2a74655503 in _dl_init_internal () from /lib64/ld-linux-x86-64.so.2* *#8 0x00007f2a74659b44 in dl_open_worker () from /lib64/ld-linux-x86-64.so.2* *#9 0x00007f2a74655314 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2* *#10 0x00007f2a7465925b in _dl_open () from /lib64/ld-linux-x86-64.so.2* *#11 0x00007f2a732ae02b in dlopen_doit () from /lib64/libdl.so.2* *#12 0x00007f2a74655314 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2* *#13 0x00007f2a732ae62d in _dlerror_run () from /lib64/libdl.so.2* *#14 0x00007f2a732ae0c1 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2* *#15 0x00007f2a736dfb2d in apr_dso_load () from /lib64/libapr-1.so.0* *#16 0x000000000047c707 in load_file ()* *#17 0x0000000000441be7 in invoke_cmd ()* *#18 0x0000000000442e71 in execute_now ()* *#19 0x00000000004421f1 in ap_build_config_sub ()* *#20 0x000000000044284a in ap_build_config ()* *#21 0x0000000000443564 in process_resource_config_nofnmatch ()* *#22 0x0000000000443964 in ap_process_resource_config ()* *#23 0x0000000000436866 in include_config ()* *#24 0x000000000044152e in invoke_cmd ()* *#25 0x0000000000442e71 in execute_now ()* *#26 0x00000000004421f1 in ap_build_config_sub ()* *#27 0x000000000044284a in ap_build_config ()* *#28 0x0000000000443564 in process_resource_config_nofnmatch ()* *#29 0x00000000004436a7 in ap_process_resource_config ()* *#30 0x00000000004445a0 in ap_read_config ()* *#31 0x0000000000425d54 in main ()* Thanks! Val From boris at codesynthesis.com Wed Apr 29 12:37:47 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 29 12:49:56 2015 Subject: [odb-users] Deadlock in apache module that uses odb-mysql? In-Reply-To: References: Message-ID: Hi Val, I did some digging and it appears something is going wrong with MySQL threading initialization when done from an apache module. The code in question (i.e., nptl_pthread_exit_hack_handler() in the stack trace) itself is dealing with (allegedly) a bug in NPTL. Here is the comment from my_thr_init.c: /* BUG#24507: Race conditions inside current NPTL pthread_exit() implementation. To avoid a possible segmentation fault during concurrent executions of pthread_exit(), a dummy thread is spawned which initializes internal variables of pthread lib. See bug description for a full explanation. TODO: Remove this code when fixed versions of glibc6 are in common use. */ Also, generally, from our experience, MySQL multi-threading support is a huge mess. See the comment at the beginning of libodb-mysql/odb/ mysql/connection-factory.cxx for the kind of hacks we have to resort to make it work. Note also that while we could reproduce this problem with 5.5.37- MariaDB, it seem to have been fixed in 10.0.17-MariaDB. Boris From vchendrix at lbl.gov Wed Apr 29 16:39:26 2015 From: vchendrix at lbl.gov (Val Hendrix) Date: Wed Apr 29 16:39:35 2015 Subject: [odb-users] Deadlock in apache module that uses odb-mysql? In-Reply-To: References: Message-ID: Boris, Thanks for the speedy feedback! I have successfully tested our apache module using MariaDB 10.0.17. Regards, Val +++++++++++++++++++++++++++++++++ Val Hendrix vchendrix@lbl.gov Lawrence Berkeley National Lab Mail Stop: 50B-2239 Room: 50B-2258E Phone: (510) 495-2905 Skype: val.hendrix +++++++++++++++++++++++++++++++++ On Wed, Apr 29, 2015 at 9:37 AM, Boris Kolpackov wrote: > Hi Val, > > I did some digging and it appears something is going wrong with > MySQL threading initialization when done from an apache module. > The code in question (i.e., nptl_pthread_exit_hack_handler() in > the stack trace) itself is dealing with (allegedly) a bug in > NPTL. Here is the comment from my_thr_init.c: > > /* > BUG#24507: Race conditions inside current NPTL pthread_exit() > implementation. > > To avoid a possible segmentation fault during concurrent > executions of pthread_exit(), a dummy thread is spawned which > initializes internal variables of pthread lib. See bug description > for a full explanation. > > TODO: Remove this code when fixed versions of glibc6 are in common > use. > */ > > Also, generally, from our experience, MySQL multi-threading support > is a huge mess. See the comment at the beginning of libodb-mysql/odb/ > mysql/connection-factory.cxx for the kind of hacks we have to resort > to make it work. > > Note also that while we could reproduce this problem with 5.5.37- > MariaDB, it seem to have been fixed in 10.0.17-MariaDB. > > Boris > From fasdfasdas at gmail.com Thu Apr 30 17:58:09 2015 From: fasdfasdas at gmail.com (=?UTF-8?B?VG9sZ2EgSE/FnkfDllI=?=) Date: Thu Apr 30 17:58:18 2015 Subject: [odb-users] Transient class member that is only used to load an expression Message-ID: Hello, Thanks for ODB. It is a great, professional project. I ended up with a case that I need to load an expression from the psql database. The situation is that I have a psql JSON field in a column. I have mapped my JSON library and added the necessary traits specializations and it all works fine. But the thing is I don't want the huge JSON column to be converted to text and then parsed by the C++ JSON library completely. I need to add that JSON class member to a lazy loading section and use only one field of it most of the time. For that I want to create another (kind of a) transient std::string class member that loads with 'table.JSON_column->>'json-key' expression in the SELECT query field when I load the object. Obviously it should not have an actual column on the database side. I can actually make the variable eager loading manual updating section and use column() with that expression but the generated table SQL file obviously has that expression as a column that should be created on the table. Is there a correct way to do this? Regards, Tolga.