From axel50397 at gmail.com Wed Oct 1 11:25:24 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Wed Oct 1 11:25:49 2014 Subject: [odb-users] Some other undefined symbols on x86_64 In-Reply-To: <20140929090457.GA6837@codesynthesis.com> References: <20140929090457.GA6837@codesynthesis.com> Message-ID: ? Hi, On 29 septembre 2014 at 11:11:18, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > My first guess (since you didn't show the ODB command line) would be > that you haven't enabled query support (-q/--generate-query ODB compiler > option). Here is my odb call: >?odb --changelog apps/LGC/schemas/odb-changelog.xml -d sqlite -p qt -q -s --schema-name categories -o apps/LGC/src/Models/Category apps/LGC/src/Models/Category/Category.hpp So yes, I?ve enabled query support... But I?ve downgraded to 10.9 (Maverick), I?m having other issues, so maybe after solving my newer issue, this one would be solved too. -- 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). From boris at codesynthesis.com Thu Oct 2 08:36:20 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 2 08:42:42 2014 Subject: [odb-users] odb: error: unable to locate options file for profile 'qt' (-p) In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > odb: error: unable to locate options file for profile ?qt' Run ODB with the -v option. This, besides other things, will print a list of profile search paths. One of these paths should be where you have installed your libodb-qt headers. Check that there is the qt.options file in this path. If it is not there, try re-installing libodb-qt (e.g., make install) and study the output to see if qt.options is installed and if so, where. > Maybe my fate doesn?t want me to use ODB, which is a shame... I believe your source of problems is trying (and changing) too many things at once without ever trying to get to the bottom of why things don't work. Boris From axel50397 at gmail.com Thu Oct 2 16:48:10 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Thu Oct 2 16:48:40 2014 Subject: [odb-users] odb: error: unable to locate options file for profile 'qt' (-p) In-Reply-To: References: Message-ID: Skipped content of type multipart/signed-------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 101 bytes Desc: Message signed with OpenPGP using AMPGpg Url : http://codesynthesis.com/pipermail/odb-users/attachments/20141002/ba16123d/signature.pgp From axel50397 at gmail.com Thu Oct 2 17:00:20 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Thu Oct 2 17:00:47 2014 Subject: [odb-users] odb: error: unable to locate options file for profile 'qt' (-p) In-Reply-To: References: Message-ID: [Corrected, mistake from my GPG plugin] Hi Boris,? On 2 octobre 2014 at 14:42:42, Boris Kolpackov (boris@codesynthesis.com=? (mailto:boris@codesynthesis.com)) wrote:? > Run ODB with the -v option. This, besides other things, will print? > a list of profile search paths. One of these paths should be where > you have installed your libodb-qt headers. Check that there is the > qt.options file in this path.? OK then. Here is what I get:? odb -v --changelog apps/LGC/schemas/odb-changelog.xml -d sqlite -p qt -q -s --schema-name categories -o . Category.hpp? Profile search paths:? > /Users/Max13/Qt/5.3/clang=5F64/lib/QtCore.framework/Headers // Added in default.options? > /usr/local/Cellar/gcc/4.9.1/lib/gcc/x86=5F64-apple-darwin13.4.0/4.9.1/include/c++? > /usr/local/Cellar/gcc/4.9.1/lib/gcc/x86=5F64-apple-darwin13.4.0/4.9.1/include/c++/x86_64-apple-darwin13.4.0? > /usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin13.4.0/4.9.1/include/c++/backward? > /usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin13.4.0/4.9.1/include? > /usr/local/Cellar/gcc/4.9.1/lib/gcc/x86_64-apple-darwin13.4.0/4.9.1/include-fixed? > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include? > /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks? odb: error: unable to locate options file for profile 'qt'? OK... I don't even need to see that the libodb-qt path is missingO_O? > If it is not there, try re-installing > libodb-qt (e.g., make install) and study the output to see if > qt.options is installed and if so, where.? I'll try to figure out this. Actually, THIS output is from the compiled-from-source version of odb and it's libs, and the EXACT SAME compilation options don't output the same architecture on 10.9(Maverick) than 10.10 (Yosemite DP)... BTW, the pre-compiled version fails because of missing .h (but this would be another thread).? > I believe your source of problems is trying (and changing) too many things > at once without ever trying to get to the bottom of why things don't work.? Yeah... Maybe... ^^'? The thing is that we've figured it out earlier, but I was on 10.10-DP, so I wanted to clear my system and reinstalled the last final release of OSX, and now it seems that (I don't know why and how) odb isn't looking in /usr/local/include (as it did on 10.10). Manually adding "-x -I/usr/local/include" solves this issue. Thank you for pointing out my faults, I'll try to modify 1 thing at a time now ;)? But I'm still having my linking issue with "odb::access::object_traits_impl", I'll try minor changes this time.? --? 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). From adnan at rihan.fr Fri Oct 3 02:07:35 2014 From: adnan at rihan.fr (Adnan RIHAN) Date: Fri Oct 3 02:08:02 2014 Subject: [odb-users] Some other undefined symbols on x86_64 In-Reply-To: References: <20140929090457.GA6837@codesynthesis.com> Message-ID: ? Hello ! On 1 octobre 2014 at 17:25:41, Adnan RIHAN (axel50397@gmail.com(mailto:axel50397@gmail.com)) wrote: > I?m having other issues, so maybe after solving my newer issue, this one would be solved too.? And YES! Recompiling, removing Qt?s cache, including odb files to the Qt?s project compilation. Thank you for your help ! -- 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). From boris at codesynthesis.com Fri Oct 3 02:12:08 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Oct 3 02:19:19 2014 Subject: [odb-users] odb: error: unable to locate options file for profile 'qt' (-p) In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > BTW, the pre-compiled version fails because of missing .h (but this > would be another thread). Could you provide more information on this (e.g., error code that you see, etc). > The thing is that we've figured it out earlier, but I was on 10.10-DP, > so I wanted to clear my system and reinstalled the last final release > of OSX, and now it seems that (I don't know why and how) odb isn't > looking in /usr/local/include (as it did on 10.10). Manually adding > "-x -I/usr/local/include" solves this issue. This is actually the GCC build issue. For some reason your new build does not look in /usr/local/include for headers as it should[1]. Can you show the configure command line you used to build GCC? [1] https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html Boris From axel50397 at gmail.com Fri Oct 3 02:36:20 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Fri Oct 3 02:36:46 2014 Subject: [odb-users] odb: error: unable to locate options file for profile 'qt' (-p) In-Reply-To: References: Message-ID: On 3 octobre 2014 at 08:19:18, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > Could you provide more information on this (e.g., error code that you > see, etc). http://pastebin.com/9Hdp63Ta > This is actually the GCC build issue. For some reason your new build > does not look in /usr/local/include for headers as it should[1]. Can > you show the configure command line you used to build GCC? > > [1] https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html The GCC configure line is from the home-brew package, here is the ./configure line: >?../configure --build=x86_64-apple-darwin13.4.0 --prefix=/usr/local/Cellar/gcc/4.9.1 --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-4.9 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-cloog=/usr/local/opt/cloog --with-isl=/usr/local/opt/isl --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --with-pkgversion=Homebrew gcc 4.9.1 --with-bugurl=https://github.com/Homebrew/homebrew/issues --enable-plugin --disable-nls --enable-multilib --with-native-system-header-dir=/usr/include --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -- 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). From christian at gsvitec.com Mon Oct 6 09:32:23 2014 From: christian at gsvitec.com (Christian Sell) Date: Mon Oct 6 09:32:28 2014 Subject: [odb-users] ODB on Android and iOS? Message-ID: <000e01cfe169$f63974d0$e2ac5e70$@gsvitec.com> Hello, we are writing an application that is supposed to run on multiple platforms, including Windows Desktop, Linux Desktop, Android and iOS (Tablets, not phones). Does ODB support all these platforms? Thanks, Christian Sell From boris at codesynthesis.com Mon Oct 6 09:59:54 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 6 10:07:05 2014 Subject: [odb-users] ODB on Android and iOS? In-Reply-To: <000e01cfe169$f63974d0$e2ac5e70$@gsvitec.com> References: <000e01cfe169$f63974d0$e2ac5e70$@gsvitec.com> Message-ID: Hi Christian, Christian Sell writes: > we are writing an application that is supposed to run on multiple platforms, > including Windows Desktop, Linux Desktop, Android and iOS (Tablets, not > phones). Does ODB support all these platforms? Assuming you are planning to use SQLite, the answer is yes. There is a guide for Android: http://wiki.codesynthesis.com/Using_ODB_on_Android There is no guide for iOS yet, but I would really like to see one. So if you would like to give it a try (with my assistance) and maybe document the steps/experience, that would be great. Boris From boris at codesynthesis.com Wed Oct 8 01:08:11 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 8 01:15:23 2014 Subject: [odb-users] odb: error: unable to locate options file for profile 'qt' (-p) In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > > Could you provide more information on this (e.g., error code that you > > see, etc). > > http://pastebin.com/9Hdp63Ta Thanks. Looks like your installation doesn't have the standard headers in /usr/include. Could you check for me if /usr/include/wchar.h exists? If you don't have this header, then I am pretty sure installing the Command Line Tools will fix this. This article seem to explain how to install them: http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/ > > This is actually the GCC build issue. For some reason your new build > > does not look in /usr/local/include for headers as it should[1]. Can > > you show the configure command line you used to build GCC? > > > > [1] https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html > > The GCC configure line is from the home-brew package, here is > the ./configure line: > > >[...] --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk I believe it is the --with-sysroot option that causes GCC to ignore /usr/local. Essentially, this option tells GCC that the root of the filesystem is in /Applications/Xcode.app/... rather than in / so it probably searches in /Applications/Xcode.app/.../usr/local. I can understand why homebrew is doing this (there are no headers in /usr/include, as we are learning above) but I am not sure this is a clean way to do it since this doesn't feel entirely correct. For example, you don't install libraries that you build into /Applications/Xcode.app/..., which is what sysroot assumes you would do. GCC configure has the --with-local-prefix option which specifies the alternative location for /usr/local. One thing to try would be to pass --with-local-prefix=/usr/local and see if it overrides the sysroot option. You may also want to forward this to the homebrew's GCC maintainer to see if they would like to try to fix this. Boris From axel50397 at gmail.com Mon Oct 13 18:14:14 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Mon Oct 13 18:14:40 2014 Subject: [odb-users] odb: error: unable to locate options file for profile 'qt' (-p) In-Reply-To: References: Message-ID: ? Hello, Sorry for the delay, I was so excited everything was working that I forgot to answer. On 8 octobre 2014 at 07:15:23, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > Thanks. Looks like your installation doesn't have the standard headers > in /usr/include. Could you check for me if /usr/include/wchar.h exists? > > If you don't have this header, then I am pretty sure installing the > Command Line Tools will fix this. This article seem to explain how > to install them: > > http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/ I?m in installing them using ?xcode-select --install? as explained on your link. It?s installing but then I saw this at the end of the post: > From OS X 10.9 onward, if Xcode is already installed in OS X then Command Line Tools becomes installed as well It doesn?t. Now I?ve installed them, wchar.h is available in /usr/include. This mystery is solved, but I wonder why the post mentions that from 10.9, the CLT are automatically installed. NVM. > I believe it is the --with-sysroot option that causes GCC to ignore > /usr/local. Essentially, this option tells GCC that the root of the > filesystem is in /Applications/Xcode.app/... rather than in / so it > probably searches in /Applications/Xcode.app/.../usr/local. This is also strange because the content of /usr/include is a complete copy/paste of?/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include (it?s not a symlink). Touching a file in one dir, doesn?t copy it to the other, so I don?t think it?s a hard link either. > I can understand why homebrew is doing this (there are no headers in > /usr/include, as we are learning above) but I am not sure this is a > clean way to do it since this doesn't feel entirely correct. For > example, you don't install libraries that you build into > /Applications/Xcode.app/..., which is what sysroot assumes you > would do. Yup, when you install Xcode without Command Line Tools (CLT), /usr/include is empty and the necessary headers are in SDKs directory. When you install them, /usr/include is created and filled. Maybe they don?t want to rely on the fact that CLT are always installed? > GCC configure has the --with-local-prefix option which specifies > the alternative location for /usr/local. One thing to try would be > to pass --with-local-prefix=/usr/local and see if it overrides the > sysroot option. CF below: I?ll wait their answer and act accordingly. My environment is nearly perfectly working so I?ll wait a little like this ^^' > You may also want to forward this to the homebrew's GCC maintainer > to see if they would like to try to fix this. https://github.com/Homebrew/homebrew/issues/33151 Thanks for your help. -- 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). From axel50397 at gmail.com Mon Oct 13 18:38:47 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Mon Oct 13 18:39:12 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception Message-ID: Hi there, I sometimes have this error (libc++abi.dylib: terminating with uncaught exception) and last time it was because ODB was trying to cast 2 types it didn?t know... I don?t remember exactly but I removed this error by changing this line in my program (cleaned example): > QSharedPointer ? ?obj1(new Object(...)); > QSharedPointer ? ?obj2(obj1); > > return (obj1 == obj2); by > QSharedPointer ? ?obj1(new Object(...)); > QSharedPointer ? ?obj2(obj1); > > return (*obj1->data() == *obj2->data()); The thing strange is that QSharedPointer::operator==() checks if the internal pointers are the same. But I don?t remember why, changing to the 2nd block (which is what I wanted because my Object::operator==() really checks the equality) removed the runtime error. --------------------- Today I?m in another situation, the ?uncaught? exception is now ?uncaught foreign exception? and I can?t find an exception related to ?foreign keys?. Here is my code and the line prepended with ?**? which causes the exception: > [...] // Some Qt?s headers > # include ? > # include ? > # include ? > # include ? >? > class EntityManager : public QObject >?{ > ? ? [...] > ? ? template ? ? ? ? ? ? ? ? ? ? ? ? > ? ??QOdbList > ? ?all(void) >?? ? { >?? ? ? ? QOdbList > ? ?list; >? >?? ? ? ? try { >?? ? ? ? ? ? odb::session ? ? ? ?s; >?? ? ? ? ? ? odb::transaction ? ?t(this->m_db->begin()); >?? ? ? ? ? ? qDebug() << "Before query?; // SHOWN >?** ? ? ? ? ?odb::result ? ? ?r(this->m_db->query());? >?? ? ? ? ? ? qDebug() << "After query?; // exception before this line >? >?? ? ? ? ? ? for (typename odb::result::iterator i(r.begin()); i != r.end(); ++i) { >?? ? ? ? ? ? ? ? list.append(QSharedPointer(new T(*i))); >?? ? ? ? ? ? } >? >?? ? ? ? ? ? t.commit(); >?? ? ? ? } catch (const odb::exception &e) { >?? ? ? ? ? ? qDebug() << "ODB Exception:" << e.what(); >?? ? ? ? } >? >?? ? ? ? return (list); >?? ? } > } Here is my ?Object? containing the foreign key: > [...] // Some Qt?s headers > # include ? > # include ? "../AbstractModel.hpp" > # include ? "../Product/Product.hpp" > class Offer : public AbstractModel >?{ >?? ? [...] >??? ?private: >?? ? ? ? quint8 ? ? ? ? ? ? ? ? ? ? m_id; >?? ? ? ? QSharedPointer ? ?m_product; >?? ? ? ? float ? ? ? ? ? ? ? ? ? ? ?m_price; >?} Here is my odb command line for the concerned class: > odb --changelog apps/LGC/schemas/odb-changelog.xml -d sqlite -p qt -q -s --schema-name LGC -o apps/LGC/src/Models/Product apps/LGC/src/Models/Product/Product.hpp 2>&1 > odb --changelog apps/LGC/schemas/odb-changelog.xml -d sqlite -p qt -q -s --schema-name LGC -o apps/LGC/src/Models/Offer apps/LGC/src/Models/Offer/Offer.hpp 2>&1 Any idea? -- 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). From adnan at rihan.fr Mon Oct 13 19:29:20 2014 From: adnan at rihan.fr (Adnan RIHAN) Date: Mon Oct 13 19:29:45 2014 Subject: [odb-users] Re: libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: Message-ID: PS: Here are my ?Offer? class pragmas: > # ? pragma ?db ?model ? ? ? ? ? ? ? ? ? ? ? version(1, 1, open) >?# ? pragma ?db ?object(Offer) ? ? ? ? ? ? ? table("offers") >?# ? pragma ?db ?member(Offer::m_id) ? ? ? ? id ?auto >?# ? pragma ?db ?member(Offer::m_product) ? ?not_null ? ?column("product_id") // The foreign key >?# ? pragma ?db ?member(Offer::m_price) ? ? ?not_null >?# ? pragma ?db ?member(Offer::isDirty) ? ? ?transient DB is populated with example data. -- 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). From boris at codesynthesis.com Tue Oct 14 01:26:53 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 14 01:34:07 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > Today I?m in another situation, the ?uncaught? exception is now > ?uncaught foreign exception? and I can?t find an exception related > to ?foreign keys?. > > > catch (const odb::exception &e) { > > qDebug() << "ODB Exception:" << e.what(); > > } ODB doesn't have any exceptions that would return "uncaught foreign exception" string. What is the *exact* text that is printed by the above catch-block? Generally, when asking for help, always provide the exact error messages, not your interpretation of them. Boris From axel50397 at gmail.com Tue Oct 14 01:47:27 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Tue Oct 14 01:47:38 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: Message-ID: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> Hi Boris, > Le 14 oct. 2014 ? 07:26, Boris Kolpackov a ?crit : > > ODB doesn't have any exceptions that would return "uncaught foreign > exception" string. What is the *exact* text that is printed by the > above catch-block? Generally, when asking for help, always provide > the exact error messages, not your interpretation of them. Sorry it's not clear. Actually, the EXACT error message is the one in the subject (copy/past), and it wasn't caught by the catch block. Instead, the program was terminated. As a "test", I wrote 2 debug lines (as in my first email): > qDebug() << "Before query?; // SHOWN > odb::result r(this->m_db->query()); > qDebug() << "After query?; // exception before this line "Before query" is shown, NOT "After query". -- Cordialement, Adnan RIHAN. Directeur-G?rant de Eolis-Software, soci?t? de services informatiques, Brazzaville. $this->setMobile("+33 (0) 6 78 62 26 20"); From boris at codesynthesis.com Tue Oct 14 09:41:05 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 14 09:48:19 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> References: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> Message-ID: Hi Adnan, Adnan RIHAN writes: > Sorry it's not clear. Actually, the EXACT error message is the one in > the subject (copy/past), and it wasn't caught by the catch block. Then this is not an ODB exception. I am not familiar with the Apple toolchain to say what 'foreign' in that phrase means. So I would suggest that you google for this error message and see if it is a common/known problem. Boris From axel50397 at gmail.com Wed Oct 15 05:20:54 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Wed Oct 15 05:21:22 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> Message-ID: Hi Boris, On 14 octobre 2014 at 15:48:18, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > So?I would suggest that you google for this error message and see > if it is a common/known problem. I tried before asking here. I can?t find anything, it?s often related to Obj-C codes. What if I tell you that this exception (not even caught by std::exception) is raised ONLY when querying an object with relations (lazy or not). When I query an object with ?id? and ?name?, it works normally. Maybe I forgot to add something in the pragmas or else? Did you see something wrong or missing in my pragmas or something I could add? Thank you for your help -- 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). From boris at codesynthesis.com Wed Oct 15 22:45:06 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 15 22:52:21 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> Message-ID: Hi Adnan, Adnan RIHAN writes: > What if I tell you that this exception (not even caught by std::exception) > is raised ONLY when querying an object with relations (lazy or not). When > I query an object with ?id? and ?name?, it works normally. Maybe I forgot > to add something in the pragmas or else? Did you see something wrong or > missing in my pragmas or something I could add? Here is what I think happens: You have built libodb* runtimes (libodb, libodb-sqlite, libodb-qt) with GCC and you are building your application with Clang. How do I know you are building it with Clang? Because the error is reported by libc++ and that's Clang's C++ runtime; GCC runtime is called libstdc++ (you can verify this by running otool -L on your executable and observing that both of these libraries are loaded). So what most likely happens is that the ODB runtime throws an exception but it uses libstdc++'s implementation of exceptions, not libc++'s. As a result, your application cannot catch it. The easiest solution would be to rebuild the above ODB runtimes using Clang instead of GCC. And don't try to rebuild the ODB compiler itself with Clang, that should continue to use GCC. As the documentation states, it is perfectly fine to use a C++ compiler other than GCC (Clang, VC++, SunCC, etc) to build the ODB runtimes and your application. Boris From axel50397 at gmail.com Thu Oct 16 07:02:02 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Thu Oct 16 07:02:28 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> Message-ID: ? Hi Boris, Thank you for the advices. On 16 octobre 2014 at 04:52:20, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > The easiest solution would be to rebuild the above ODB runtimes using > Clang instead of GCC. I tried this already, I had undefined symbols (I?ve tried again today):?http://codesynthesis.com/pipermail/odb-users/2014-September/002122.html > As the documentation states,?it is perfectly fine to use a C++ compiler other than GCC (Clang, VC++, > SunCC, etc) to build the ODB runtimes and your application. This is strange because yes, the runtimes are built with GCC (4.9.1) and my app is built with clang. I?ve tried to build libodb* with GCC AND my app with GCC (actually, before writing this thread. And I didn?t notice that Qt-Creator isn?t passing GCC path to qmake which fallbacks to Xcode gcc which is clang. I?ve modified by hand the makefiles to set the SAME GCC used to compile libodb, and now it works \o/ (No compilation issues, no runtime issues). So, to summarize: - ODB _must_ be compiled with GCC (Because of ODB core) - libodb* _must_ be compiled with GCC (Or else, compilation errors, see above link) - App _must_ be compiled with GCC (Or else, runtime error related to libc++abi) Thanks for your unlimited help Boris. I was almost ready to write the queries myself because I needed to go forward... But ODB seems to be great when it?s correctly set-up, so as these problems are not ?Adnan? related (only), I thought it may be a good idea to sort these out for eventual futur others. -- 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). From boris at codesynthesis.com Thu Oct 16 07:16:04 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 16 07:23:19 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> Message-ID: Hi Adnan, Adnan RIHAN writes: > I tried this already, I had undefined symbols (I?ve tried again > today): http://codesynthesis.com/pipermail/odb-users/2014-September/002122.html Did you make sure that your application and the runtimes are both either built in 32-bit or 64-bit mode? (-m32/-m64)? > - ODB _must_ be compiled with GCC (Because of ODB core) You mean the ODB compiler. > - libodb* _must_ be compiled with GCC (Or else, compilation errors, > see above link) No, you should be able to build them (and your application) with Clang. The fact that you weren't able to figure out why the Clang build fails doesn't mean that everything "must" be built with GCC. > - App _must_ be compiled with GCC (Or else, runtime error related to > libc++abi) Again, the only "must" here is that both the runtimes and your application are built with the same compiler (and the same 32/64 bit mode). Boris From imk at qosmotec.com Fri Oct 17 10:14:11 2014 From: imk at qosmotec.com (=?iso-8859-1?Q?Iris-Marie_K=F6ster?=) Date: Fri Oct 17 10:15:06 2014 Subject: [odb-users] Unit Testing, Mocking of classes that contain ODB code Message-ID: <735805be57d44641af8bc404906f92c9@QEX.qosmotec.com> Hello! To make code testable without real database access, I'm trying to get rid of all direct uses of odb functions. For example, I have a class foo in which something is loaded. Right now, it is done like this: std::shared_ptr databaseInstance; (databaseInstance.reset(new odb:: .. and so on - this is done somewhere else) databaseInstance->load(someId, pointerToSomeObject); What I'm trying to do now is to write a base class (called DatabaseInstance) and derive two classes from it (OdbInstance and MockInstance). These classes shall contain all necessary methods to perform (or mock performing) database actions. In trying to write these methods I have encountered the following problem (to describe it, I need to go a little further afield): I have a class "DatabaseEntity", which is the common base class of all entities within the project that are stored in the database. It is there to keep track of the entity's database ID and version. The class foo (which could be any of the entities that are stored in the database) is of course derived from "DatabaseEntity". In DatabaseInstance, I have declared a pure virtual method "void load(DatabaseEntity * pEntity) = 0;". The implementation of this method in the derived class OdbInstance looks like this: void OdbInstance::load(DatabaseEntity * pEntity) { m_database->load(pEntity->getId(), *pEntity); } (m_database is a private member of OdbInstance of type std::shared_ptr) When I try to compile this, I get funny error messages: 'find' is not an element of 'odb::object_traits_impl' 'odb::access::object_traits_impl': base class undefined 'bool odb::database::find(const object_traits::id_type &, T&)': 2 arguments expected - 3 supported 'object_traits::pointer_type odb::database::find(const object_traits::id_type &)': 1 argument expected - 3 supported My questions are: 1) Can you make sense of this? (I went through the database.ixx file and did not even find the position where the "find"-method is called after the "load"-method) 2) Does anyone have experience with Unit Testing classes that use odb-code? Did you mock the database access or not? 3) Do my ideas described above even make sense or did I miss something that make my plans inexecutable? Thanks a lot for your attention and help or ideas! Best regards Iris P.S.: I have appended a little uml-diagram to illustrate what I want to do Qosmotec Software Solutions GmbH Principal Address: Tel: +49 241 87975 26 Schloss-Rahe-Stra?e 3 Fax: +49 241 87975 15 52072 Aachen Germany Web: http://www.qosmotec.com Managing Directors : Mark Hakim - Dr. Dieter Kreuer - Axel C. Voigt Commercial Register: Amtsgericht Aachen HRB 12272, VAT-ID DE234919984 -------------- next part -------------- A non-text attachment was scrubbed... Name: Mocking Database.pdf Type: application/pdf Size: 2073 bytes Desc: Mocking Database.pdf Url : http://codesynthesis.com/pipermail/odb-users/attachments/20141017/918d7c6e/MockingDatabase.pdf From axel50397 at gmail.com Sat Oct 18 03:08:21 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Sat Oct 18 03:08:49 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> Message-ID: On 16 octobre 2014 at 13:23:17, Boris Kolpackov (boris@codesynthesis.com (mailto:boris@codesynthesis.com)) wrote: > > - libodb* _must_ be compiled with GCC (Or else, compilation errors, > > see above link) > > No, you should be able to build them (and your application) with Clang. > The fact that you weren't able to figure out why the Clang build fails > doesn't mean that everything "must" be built with GCC. I was exposing MY situation, not in general. To make everything work in my case, I have to start from a working state. > > - App _must_ be compiled with GCC (Or else, runtime error related to > > libc++abi) Here again, it?s MY case, I wasn?t meaning in general. I have to admit that I need to go forward on my project, but I also want to sort this out. I?ve tried many combination, without success. I could blame Qt/Qt-Creator but the errors were related to sqlite. I?ve even just tried to compile ?hello? example by command line, using clang-c++: > ? hello pwd > /Users/Max13/Downloads/odb-examples-2.3.0/hello > ? hello c++ -v > Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) > Target: x86_64-apple-darwin13.4.0 > Thread model: posix > ? hello odb -d sqlite --generate-query --generate-schema person.hxx > ? hello c++ -c person-odb.cxx > ? hello c++ -DDATABASE_SQLITE -c driver.cxx > ? hello c++ -o driver driver.o person-odb.o -lodb-sqlite -lodb > Undefined symbols for architecture x86_64: > "odb::schema_catalog::create_schema(odb::database&, std::__1::basic_string, std::__1::allocator > const&, bool)", referenced from: > create_database(int&, char**) in driver.o > "odb::sqlite::query_base::append(std::__1::basic_string, std::__1::allocator > const&)", referenced from: > odb::sqlite::query_base::operator+=(std::__1::basic_string, std::__1::allocator > const&) in driver.o > odb::sqlite::query_base::operator+=(std::__1::basic_string, std::__1::allocator > const&) in person-odb.o > "odb::sqlite::delete_statement::delete_statement(odb::sqlite::connection&, std::__1::basic_string, std::__1::allocator > const&, odb::sqlite::binding&)", referenced from: > odb::access::object_traits_impl::erase_query(odb::database&, odb::sqlite::query_base const&) in person-odb.o > "odb::sqlite::select_statement::select_statement(odb::sqlite::connection&, std::__1::basic_string, std::__1::allocator > const&, bool, bool, odb::sqlite::binding&, odb::sqlite::binding&)", referenced from: > odb::access::object_traits_impl::query(odb::database&, odb::sqlite::query_base const&) in person-odb.o > odb::access::view_traits_impl::query(odb::database&, odb::sqlite::query_base const&) in person-odb.o > "odb::sqlite::default_value_traits, std::__1::allocator >, (odb::sqlite::database_type_id)2>::set_image(odb::details::basic_buffer&, unsigned long&, bool&, std::__1::basic_string, std::__1::allocator > const&)", referenced from: > odb::access::object_traits_impl::init(odb::access::object_traits_impl::image_type&, person const&, odb::sqlite::statement_kind) in person-odb.o > "odb::sqlite::database::print_usage(std::__1::basic_ostream >&)", referenced from: > create_database(int&, char**) in driver.o > "odb::sqlite::database::database(int&, char**, bool, int, bool, std::__1::basic_string, std::__1::allocator > const&, odb::details::transfer_ptr)", referenced from: > create_database(int&, char**) in driver.o > ld: symbol(s) not found for architecture x86_64 > clang: error: linker command failed with exit code 1 (use -v to see invocation) Compiled with c++-4.9, no error. Maybe it?s related to my system... The thing is that I?ve completely reinstalled my system on 10.9 (Maverick), the only system ?things? I?ve reinstalled is Xcode, Qt (isolated) and homebrew (isolated but touches $PATH). I don?t know what could I check more... While writing this email, something strange happened, the lib compiled with GCC and my app with clang, no more runtime errors... I don't understand, same code, same environment and no more libc++/glibc. So I got 2 ideas to check to determine where it could come from: 1- Make a clean partition, install nothing on it but the required lib (gcc, xcode, odb, libodb, ...) then try and log environment combinations (because the libc++abi error shouldn't have disappeared) 2- Try with another db driver, because so far I've only tried libodb-sqlite. Then I'll be back to you to keep you updated. Yosemite (10.10) is now final and released, i'll also check on this system. Thanks for your help. -- 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). From boris at codesynthesis.com Sun Oct 19 10:48:16 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Oct 19 10:55:30 2014 Subject: [odb-users] Unit Testing, Mocking of classes that contain ODB code In-Reply-To: <735805be57d44641af8bc404906f92c9@QEX.qosmotec.com> References: <735805be57d44641af8bc404906f92c9@QEX.qosmotec.com> Message-ID: Hi Iris, Iris-Marie K?ster writes: > void OdbInstance::load(DatabaseEntity * pEntity) > { > m_database->load(pEntity->getId(), *pEntity); > } What you are trying to do is load an object via its base interface. This will only work if you enable polymorphism support for your class hierarchy that starts with DatabaseEntity. Section 8.2, "Polymorphism Inheritance" describes this in detail and it is a good idea to read it first before deciding to use this mechanism since the database mapping will be very different. Enabling it just to support unit testing might be an overkill. > When I try to compile this, I get funny error messages: > > 'find' is not an element of 'odb::object_traits_impl' My guess is DatabaseEntity is abstract and non-polymorphic (in ODB sense) thus the error. > 2) Does anyone have experience with Unit Testing classes that > use odb-code? Did you mock the database access or not? I haven't done it myself but thinking about it for a bit made me think that mocking the database for any kind of non-trivial testing will be hard. For example, load() essentially instantiates the object from the database. What will the mock version do in this case? In other words, how would you implement: void MockInstance::load(DatabaseEntity * pEntity) { // Where does the information for pEntity's data members come from? } One thing that seem to make more sense is to use a special database that is easier (transparent) to use in tests. For example, you could use SQLite with an in-memory database (":memory:") which would be completely private to the test. This way, for example, you could run multiple tests in parallel without having to make sure they don't trash the same set of data. Just for completeness, if you still want to mock the database access and don't want to use polymorphism support in ODB, then one way to implement what you want would be to use compile-time rather than runtime polymorphism. Something along these lines: template class DatabaseInstance; template <> class DatabaseInstance // Mock. { template void load (T& x) { // Mock database load somehow... } } template <> class DatabaseInstance // Real. { template void load (T& x) { m_database->load (x.getId(), x); } } The main drawback of this approach is that you have to decide whether you use mock access or the real stuff at compile time. Boris From boris at codesynthesis.com Mon Oct 20 07:58:53 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 20 08:06:09 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <00766192-4F22-4358-8616-F787321AC7E9@gmail.com> Message-ID: Hi Adnan, Adnan RIHAN writes: > I?ve even just tried to compile ?hello? example by command line, using > clang-c++: > > > ? hello pwd > > /Users/Max13/Downloads/odb-examples-2.3.0/hello > > ? hello c++ -v > > Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn) > > Target: x86_64-apple-darwin13.4.0 > > Thread model: posix > > ? hello odb -d sqlite --generate-query --generate-schema person.hxx > > ? hello c++ -c person-odb.cxx > > ? hello c++ -DDATABASE_SQLITE -c driver.cxx > > ? hello c++ -o driver driver.o person-odb.o -lodb-sqlite -lodb > > Undefined symbols for architecture x86_64: > [...] Good. When you give me something like this I can actually go and try to reproduce the problem. So here is what I have done: 1. Install command line tools. One thing I could not do is first uninstall everything (e.g., get rid of /usr/bin/{clang,gcc,...} and /usr/include/*). Apparently there is no way to do it. In particular, running this did not remove those tools: /Developer/Library/uninstall-devtools --mode=all In any case, to make sure I have the latest stuff, I ran: xcode-select --install And it downloaded and installed something. After that, I got: $ clang --version Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) Target: x86_64-apple-darwin13.4.0 It looks like an even newer version than yours, so I am definitely using the latest tools. 2. Then, for general undestanding, I compiled a test program called sizeof_funds.cxx (attached) to see which mode (32/64) is the default: $ clang++ sizeof_funds.cxx $ ./a.out bool sizeof = 1 alignof = 1 wchar_t sizeof = 4 alignof = 4 short int sizeof = 2 alignof = 2 int sizeof = 4 alignof = 4 long int sizeof = 8 alignof = 8 long long int sizeof = 8 alignof = 8 float sizeof = 4 alignof = 4 double sizeof = 8 alignof = 8 long double sizeof = 16 alignof = 16 void* sizeof = 8 alignof = 8 $ clang++ -m32 sizeof_funds.cxx $ ./a.out bool sizeof = 1 alignof = 1 wchar_t sizeof = 4 alignof = 4 short int sizeof = 2 alignof = 2 int sizeof = 4 alignof = 4 long int sizeof = 4 alignof = 4 long long int sizeof = 8 alignof = 8 float sizeof = 4 alignof = 4 double sizeof = 8 alignof = 8 long double sizeof = 16 alignof = 16 void* sizeof = 4 alignof = 4 So, by default, clang generates 64-bit code (look at size of void*) but you can request 32-bit with -m32. 3. Next I downloaded and unpacked these 4 ODB packages: libodb-2.3.0.tar.bz2 libodb-sqlite-2.3.0.tar.bz2 odb-2.3.0-i686-macosx.tar.bz2 odb-examples-2.3.0.tar.bz2 Then I built and installed libodb and libodb-sqlite: $ cd libodb-2.3.0 $ ./configure CC=clang CXX=clang++ $ make $ sudo make install $ cd .. $ cd libodb-sqlite-2.3.0 $ ./configure CC=clang CXX=clang++ $ make $ sudo make install $ cd .. Then I tried to build the hello example by hand, just like you did: $ cd odb-examples-2.3.0/hello $ ../../odb-2.3.0-i686-macosx/bin/odb -d sqlite -q -s person.hxx clang++ -c person-odb.cxx clang++ -DDATABASE_SQLITE -c driver.cxx clang++ -o driver driver.o person-odb.o -lodb-mysql -lodb clang++ -o driver driver.o person-odb.o -lodb-sqlite -lodb $ ./driver Hello, John Doe! Hello, Jane Doe! count : 3 min age: 31 max age: 33 So, for me, everything works pretty smoothly. Can you try these exact steps and see if they work for you? > While writing this email, something strange happened, the lib compiled with > GCC and my app with clang, no more runtime errors... I don't understand, > same code, same environment and no more libc++/glibc. This could work as long as the code doesn't throw an exception. It is definitely a bad idea to mix those things, even if it appear to work right now. Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: sizeof_funds.cxx Type: text/x-c++src Size: 1952 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20141020/f2fc666a/sizeof_funds.cxx From quentindeldycke at gmail.com Wed Oct 22 11:13:11 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Wed Oct 22 11:13:19 2014 Subject: [odb-users] Usage of lazy shared pointers in a triangle relation Message-ID: Hi, I have a problem using this kind of architecture: - class A have a lazy_shared_pointer to C - class B have a lazy_shared_pointer to another C - class C contains a int In my mysql database, we can easily see that our class A is linked to a class C with value '1' and my class 'B' is linked to a class C with value '2'. In my code, I query all class A, for each A, we query for objects B. For each B I print values of A, B and the class C of both of them. Strangely, I have only output of C == '2'. I then tried to compare the pointer of both C object stored in A and B. I found that they are the same! So for each loop on objects B, the value of A->C is updated to values of B->C. Do you have any int to avoid this problem? -- Deldycke Quentin From boris at codesynthesis.com Thu Oct 23 01:34:14 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 23 01:41:26 2014 Subject: [odb-users] Usage of lazy shared pointers in a triangle relation In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > I have a problem using this kind of architecture: > > - class A have a lazy_shared_pointer to C > - class B have a lazy_shared_pointer to another C > - class C contains a int > > In my mysql database, we can easily see that our class A > is linked to a class C with value '1' and my class 'B' is linked > to a class C with value '2'. > > In my code, I query all class A, for each A, we query for objects B. > For each B I print values of A, B and the class C of both of them. I am not sure what "for each A, we query for objects B" means since from your description above they seem to be unrelated. > Strangely, I have only output of C == '2'. > > I then tried to compare the pointer of both C object stored in A and B. > I found that they are the same! So for each loop on objects B, the value of > A->C is updated to values of B->C. I can't think of any reason why this would happen other than if both C's had the same primary key. So I would need to see the actual code that does the query. Actual class declarations could also be helpful. What happens if you print the value of A-C before you "query for objects B"? > Do you have any int to avoid this problem? int64_t helps with all kinds of problems ;-) Boris From quentindeldycke at gmail.com Thu Oct 23 03:33:34 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Thu Oct 23 03:33:41 2014 Subject: [odb-users] Usage of lazy shared pointers in a triangle relation In-Reply-To: References: Message-ID: Hi Boris, -- Quentin Deldycke Le 23 oct. 2014 07:41, "Boris Kolpackov" a ?crit : > Hi Quentin, > > Quentin Deldycke writes: > > > I have a problem using this kind of architecture: > > > > - class A have a lazy_shared_pointer to C > > - class B have a lazy_shared_pointer to another C > > - class C contains a int > > > > In my mysql database, we can easily see that our class A > > is linked to a class C with value '1' and my class 'B' is linked > > to a class C with value '2'. > > > > In my code, I query all class A, for each A, we query for objects B. > > For each B I print values of A, B and the class C of both of them. > > I am not sure what "for each A, we query for objects B" means since > from your description above they seem to be unrelated. > > We query A using some fields local to the class. Depending of these results, we query B using fields local to this class. Then we compare the internal C class of both A and B. > > > Strangely, I have only output of C == '2'. > > > > I then tried to compare the pointer of both C object stored in A and B. > > I found that they are the same! So for each loop on objects B, the value > of > > A->C is updated to values of B->C. > > I can't think of any reason why this would happen other than if both C's > had the same primary key. So I would need to see the actual code that > does the query. Actual class declarations could also be helpful. What > happens if you print the value of A-C before you "query for objects B"? > > Yes. The output of A->C is correct before the query of B. Ok, this give me the correct intptr_t to the problem. During our calculation between both our C classes, we made an assignation between both (B->C = B->A). As expected, in C++, it copied the whole shared_ptr and not the pointed to object values (as expected in our developper head). Thanks for your help! > > > Do you have any int to avoid this problem? > > int64_t helps with all kinds of problems ;-) > > Boris > From axel50397 at gmail.com Thu Oct 23 06:55:18 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Thu Oct 23 09:09:46 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception Message-ID: Hello ! So, I?ll try to reproduce everything with Yosemite on VM (Parallels Desktop) because as it?s final from few days, I will also try if it?s supported. If it?s not, I will revert to Maverick on the VM. So here as I start: 0. 1) Install Maverick from host recovery partition. 2) Copied "Install Yosemite.app? from host then installed it. 3) Copied XCode 6.0.1 from host and started it (to initialize, no CLT explicitly installed). 4) Updated Xcode from VM AppStore to 6.1 . 5) Problem with update detection with AppStore, removed and installed Xcode from VM AppStore. > MacBook-Pro-de-OSX:~ osx$ xcode-select -v > xcode-select version 2339. > > MacBook-Pro-de-OSX:~ osx$ which clang > /usr/bin/clang > > MacBook-Pro-de-OSX:~ osx$ clang --version > Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) > Target: x86_64-apple-darwin14.0.0 > Thread model: posix On 20 octobre 2014 at 14:06:07, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > 1. Install command line tools. > > One thing I could not do is first uninstall everything (e.g., > get rid of /usr/bin/{clang,gcc,...} and /usr/include/*). > Apparently there is no way to do it. In particular, running > this did not remove those tools: > > /Developer/Library/uninstall-devtools --mode=all I don?t have this path, neither in /Applications/Xcode.app . > In any case, to make sure I have the latest stuff, I ran: > > xcode-select --install Even if (from: https://developer.apple.com/library/ios/technotes/tn2339/_index.html): > If Xcode is installed on your machine, then there is no need to install them. Xcode comes bundled with all your command-line tools. OS X 10.9 includes shims or wrapper executables. These shims, installed in /usr/bin, can map any tool included in /usr/bin to the corresponding one inside Xcode. xcrun is one of such shims, which allows you to find or run any tool inside Xcode from the command line. Use it to invoke any tool within Xcode from the command line. I still have installed them via `xcode-select --install`. > And it downloaded and installed something. After that, I got: > > $ clang --version > Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) The only difference with mine is: > Target: x86_64-apple-darwin14.0.0 > 2. Then, for general undestanding, I compiled a test program called > sizeof_funds.cxx (attached) to see which mode (32/64) is the > default: > > So, by default, clang generates 64-bit code (look at size of void*) > but you can request 32-bit with -m32. Same for me, without precising ?-mXX? -> void* sizeof = 8 alignof = 8 > 3. Next I downloaded and unpacked these 4 ODB packages: > libodb-2.3.0.tar.bz2 > ./configure CC=clang CXX=clang++ && make && sudo make install OK > libodb-sqlite-2.3.0.tar.bz2 > ./configure CC=clang CXX=clang++ && make && sudo make install OK Then: > MacBook-Pro-de-OSX:hello osx$ pwd > /tmp/odb-examples-2.3.0/hello > MacBook-Pro-de-OSX:hello osx$ ../../odb-2.3.0-i686-macosx/bin/odb -d sqlite -q -s person.hxx > ../../odb-2.3.0-i686-macosx/bin/odb: error: unable to extract profile paths This error tells me that MAYBE yosemite has a problem. So I?ll try on my host ?Maverick?. ---------- To try from a cleanest as possible system, I?ve reinstalled CLT and remove EVERY homebrew package I have, so I?ll have /usr/local/{bin,include,lib} clean: > ? local git:(master) pwd > /usr/local > ? local git:(master) ls bin/ include/ lib/ > bin/: > brew* git-shell@ > brew-rmtree.rb@ git-upload-archive@ > git@ git-upload-pack@ > git-credential-osxkeychain@ github@ > git-cvsserver@ gpg@ > git-receive-pack@ > > include/: > > lib/: > perl5/ > clang -v > Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) > Target: x86_64-apple-darwin13.4.0 > Thread model: posix Then I download and compile the libodb*: > $ wget -O- -q http://www.codesynthesis.com/download/odb/2.3/libodb-2.3.0.tar.gz | tar -zx > $ cd libodb-2.3.0 > $ ./configure CC=clang CXX=clang++ > $ make && sudo make install > $ wget -O- -q http://www.codesynthesis.com/download/odb/2.3/libodb-sqlite-2.3.0.tar.gz | tar -zx > $ cd libodb-sqlite-2.3.0 > $ ./configure CC=clang CXX=clang++ > $ make && sudo make install > $ wget -O- -q http://www.codesynthesis.com/download/odb/2.3/odb-2.3.0-i686-macosx.tar.bz2 | tar -jx These are OK. Then, hello example: > $ wget -O- -q http://www.codesynthesis.com/download/odb/2.3/odb-examples-2.3.0.tar.gz | tar -zx > $ cd odb-examples-2.3.0/hello > $ ../../odb-2.3.0-i686-macosx/bin/odb -d sqlite -q -s person.hxx > clang++ -c person-odb.cxx > clang++ -DDATABASE_SQLITE -c driver.cxx // clang++ -o driver driver.o person-odb.o -lodb-mysql -lodb // I haven?t done this one > clang++ -o driver driver.o person-odb.o -lodb-sqlite -lodb > $ ./driver > Hello, John Doe! > Hello, Jane Doe! > > count : 3 > min age: 31 > max age: 33 Exact same output for me. > So, for me, everything works pretty smoothly. Can you try these exact > steps and see if they work for you? It also works. -_-' ---------- My project had some compilation issues, but this thread was about an error got only while querying relationships. So my idea will be to compile the models file, and the entire project to see what error I have. > $ pwd > /Users/Max13/Dev/System/LGC/Desktop/apps/LGC/src/Models/Category > $ cd Category > $ /tmp/odb-2.3.0-i686-macosx/bin/odb -x -F/Users/Max13/Qt/5.3/clang_64/lib -x -I/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Headers -x -I/usr/local/include -d sqlite -p qt -q -s Category.hpp > Category.xml: info: initializing changelog with base version 1 > $ cd ../Provider > /tmp/odb-2.3.0-i686-macosx/bin/odb -x -F/Users/Max13/Qt/5.3/clang_64/lib -x -I/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Headers -x -I/usr/local/include -d sqlite -p qt -q -s Provider.hpp > Provider.xml: info: initializing changelog with base version 1 > $ cd ../Product /tmp/odb-2.3.0-i686-macosx/bin/odb -x -F/Users/Max13/Qt/5.3/clang_64/lib -x -I/Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Headers -x -I/usr/local/include -d sqlite -p qt -q -s Product.hpp > Product.xml: info: initializing changelog with base version 1 Now I?ll Qt-Creator to compile my project: > Undefined symbols for architecture x86_64: > ? "odb::sqlite::delete_statement::delete_statement(odb::sqlite::connection&, std::string const&, odb::sqlite::binding&)", referenced from: > ? ? ? odb::access::object_traits_impl::erase_query(odb::database&, odb::sqlite::query_base const&) in Category-odb.o > ? ? ? odb::access::object_traits_impl::erase_query(odb::database&, odb::sqlite::query_base const&) in Provider-odb.o > ? ? ? odb::access::object_traits_impl::erase_query(odb::database&, odb::sqlite::query_base const&) in Product-odb.o > ? ? ? odb::access::object_traits_impl::erase_query(odb::database&, odb::sqlite::query_base const&) in Offer-odb.o > ? "odb::sqlite::select_statement::select_statement(odb::sqlite::connection&, std::string const&, bool, bool, odb::sqlite::binding&, odb::sqlite::binding&)", referenced from: > ? ? ? odb::access::object_traits_impl::query(odb::database&, odb::sqlite::query_base const&) in Category-odb.o > ? ? ? odb::access::object_traits_impl::query(odb::database&, odb::sqlite::query_base const&) in Provider-odb.o > ? ? ? odb::access::object_traits_impl::query(odb::database&, odb::sqlite::query_base const&) in Product-odb.o > ? ? ? odb::access::object_traits_impl::query(odb::database&, odb::sqlite::query_base const&) in Offer-odb.o > ? "odb::sqlite::database::database(std::string const&, int, bool, std::string const&, odb::details::transfer_ptr)", referenced from: > ? ? ? MasterController::checkEnv() in MasterController.o > ld: symbol(s) not found for architecture x86_64 From here, it seems to be project related. But, without touching my project, I?ve recompiled ?libodb? + ?libodb-sqlite? with gcc-4.9 (not by homebrew, but with CC and CXX flags) and by projects compiles normally without a single warning. In case of you could have an idea, I?ve attached my Category.hpp (one of the models, independent) and the generated files. I don?t attach the .cpp because it?s only getters and setters, no other calls. Something still strange is that my project crashed because of this error, only when querying an object with relations. It crashed again today, I?ve recompiled the libs with gcc-4.9 and project with clang, it?s now working. I think I?ll create another VM with Maverick and restart again the whole process with a sample project. I don?t understand ... -- 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: Category-odb.cxx Type: application/octet-stream Size: 17319 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20141023/c907508d/Category-odb-0003.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Category-odb.hxx Type: application/octet-stream Size: 6771 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20141023/c907508d/Category-odb-0004.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Category-odb.ixx Type: application/octet-stream Size: 1242 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20141023/c907508d/Category-odb-0005.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: Category.hpp Type: application/octet-stream Size: 1462 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20141023/c907508d/Category-0001.obj From erezgb at walla.com Thu Oct 23 14:02:57 2014 From: erezgb at walla.com (=?UTF-8?Q?=45=72=65=7A=20=47=42?=) Date: Fri Oct 24 05:35:56 2014 Subject: [odb-users] slow persist for bulk insert Message-ID: <1414087377.416000-7557771-2650@walla.com>


Hi Boris,


We are working with ODB and implement a complex schema and it works great :-)

However, we need better performance when we are insering 10000 of objects into our SQLite DB.


1) Can you please help with guidelines for improving ODB performance with SQLite ?

2) Is there another way for fast bulk insert of many ODB objects ?


Thank you for your help and assistance,

Erez.


From boris at codesynthesis.com Sat Oct 25 01:40:06 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Oct 25 01:47:17 2014 Subject: [odb-users] slow persist for bulk insert In-Reply-To: <1414087377.416000-7557771-2650@walla.com> References: <1414087377.416000-7557771-2650@walla.com> Message-ID: Hi Erez, Erez GB writes: > We are working with ODB and implement a complex schema and it works > great :-) Thanks, glad you are finding ODB useful! > However, we need better performance when we are insering 10000 of > objects into our SQLite DB. Can you please help with guidelines for > improving ODB performance with SQLite? Is there another way for > fast bulk insert of many ODB objects. SQLite doesn't support bulk INSERT (unlike, say, Oracle or SQL Server) so you have to execute a separate INSERT statement for each object (which is what ODB does). So the only way to optimize this is to try various way you do it. Number one is probably selecting the right transaction granularity. This earlier post has more information on this: http://www.codesynthesis.com/pipermail/odb-users/2013-May/001270.html Number two is to temporarily disable foreign key constraint checking (if you use foreign keys). You lose some safety (you need to make sure all the references are valid) but you usually gain quite a bit in performance. Here is what the code would look like: connection_ptr c (db->connection ()); c->execute ("PRAGMA foreign_keys=OFF"); transaction t(c->begin()); for(unsigned int i = 0; i < 10000; i++) { if (i % 100 == 0) { t.commit (); t.reset (c->begin ()); } ... } t.commit(); c->execute ("PRAGMA foreign_keys=ON"); If that's not sufficient, then I found this fairly exhaustive list of things you can try (most of them via the PRAGMA as above) to improve performance of INSERT in SQLite: http://stackoverflow.com/questions/1711631/how-do-i-improve-insert-per-second-performance-of-sqlite Note also that in case of SQLite doing any kind of parallel insertion (e.g., by running multiple transactions from several threads in parallel) will only make things worse (SQLite has very poor concurrency support, especially for modifications). Boris From boris at codesynthesis.com Sat Oct 25 01:58:40 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Oct 25 02:05:52 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > > ../../odb-2.3.0-i686-macosx/bin/odb: error: unable to extract > profile paths > > This error tells me that MAYBE yosemite has a problem. So I?ll > try on my host ?Maverick?. Yes, this looks like the same problem we had with the beta. I will have to look into this when I get access to Yosemite. > Now I?ll Qt-Creator to compile my project: > > Undefined symbols for architecture x86_64: Ok, so you have compiled the ODB runtimes and example with clang and everything works fine. Then you tried to use the same runtime builds from Qt-Creator and you got this linker error. To me this sounds like Qt-Creator: 1. Either builds the project with another compiler. Maybe it uses its own clang or gcc? 2. Or it builds using system clang but with some options that make it incompatible with the default build of the ODB runtimes. In either case we need to get the exact clang command line, with the executable name and all the options, that is executed by Qt-Creator. Ideally, I would like to see the complete list of commands that Qt-Creator executes to build your project (i.e., both the C++ compilation and the link command that fails). Boris From christian at gsvitec.com Sat Oct 25 05:20:18 2014 From: christian at gsvitec.com (Christian Sell) Date: Sat Oct 25 05:20:21 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: Message-ID: <245061441.1090869.1414228818337.open-xchange@patina.store> hers what comes to my mind from recent painful experience: - command line build links against libc++ - qt build links against libstdc++ (for reason of some OSX backwards compatibility) both libs are NOT compatible. Sometimes you get linker errors, other times it's app crashes. HTH Christian > Boris Kolpackov hat am 25. Oktober 2014 um 07:58 > geschrieben: > > > Hi Adnan, > > Adnan RIHAN writes: > > > > ../../odb-2.3.0-i686-macosx/bin/odb: error: unable to extract > > profile paths > > > > This error tells me that MAYBE yosemite has a problem. So I?ll > > try on my host ?Maverick?. > > Yes, this looks like the same problem we had with the beta. I will > have to look into this when I get access to Yosemite. > > > > Now I?ll Qt-Creator to compile my project: > > > Undefined symbols for architecture x86_64: > > Ok, so you have compiled the ODB runtimes and example with clang > and everything works fine. Then you tried to use the same runtime > builds from Qt-Creator and you got this linker error. To me this > sounds like Qt-Creator: > > 1. Either builds the project with another compiler. Maybe it uses > its own clang or gcc? > > 2. Or it builds using system clang but with some options that make > it incompatible with the default build of the ODB runtimes. > > In either case we need to get the exact clang command line, with > the executable name and all the options, that is executed by > Qt-Creator. Ideally, I would like to see the complete list of > commands that Qt-Creator executes to build your project (i.e., > both the C++ compilation and the link command that fails). > > Boris > From grasmanek94 at gmail.com Sun Oct 26 12:52:19 2014 From: grasmanek94 at gmail.com (Rafal Gm) Date: Sun Oct 26 14:05:33 2014 Subject: [odb-users] error: SQLite does not support altering of columns. info: first altered column is 'password' in table 'user', but field password is not being altered Message-ID: Hello, I am trying to use the database migration features of ODB on which I have been waiting a long time, but for some reason it gives alter errors after adding one more integer column to the database. This is my version 1_1 class: #include #include #define acmf(variable_type,variable_name) \ public:\ const variable_type& variable_name () const \ { \ return variable_name ## _; \ } \ void variable_name (variable_type variable_name) \ { \ variable_name ## _ = variable_name; \ }\ private:\ variable_type variable_name ## _ #define accessor(variable_name,variable_type) \ const variable_type& variable_name () const \ { \ return variable_name ## _; \ } #define ResetValue(name) name ## _(0) #define ResetValueStr(name) name ## _("") #pragma db model version(1, 1) #pragma db object class user { public: user () {} user ( std::string nickname, std::string password ): nickname_(nickname), password_(password), ResetValue(money), ResetValue(score), ResetValue(kills), ResetValue(experience), ResetValue(deaths), ResetValue(privilidges), ResetValue(bounty), ResetValue(suicides), ResetValue(respect), ResetValue(kicks), ResetValue(warns), ResetValue(playtime), ResetValue(banned), ResetValueStr(ban_reason), ResetValueStr(ban_who) {} accessor(nickname, std::string); acmf(std::string, password); acmf(signed long long,money); acmf(signed long long,score); acmf(unsigned long long,kills); acmf(unsigned long long,experience); acmf(unsigned long long,deaths); acmf(unsigned long long,privilidges); acmf(unsigned long long,bounty); acmf(unsigned long long,suicides); acmf(unsigned long long,respect); acmf(unsigned long long,kicks); acmf(unsigned long long,warns); acmf(unsigned long long,playtime); acmf(unsigned long long,banned); acmf(std::string,ban_reason); acmf(std::string,ban_who); private: friend class odb::access; #pragma db unique id index std::string nickname_; }; and this is the next version: #include #include #define acmf(variable_type,variable_name) \ public:\ const variable_type& variable_name () const \ { \ return variable_name ## _; \ } \ void variable_name (variable_type variable_name) \ { \ variable_name ## _ = variable_name; \ }\ private:\ variable_type variable_name ## _ #define accessor(variable_name,variable_type) \ const variable_type& variable_name () const \ { \ return variable_name ## _; \ } #define ResetValue(name) name ## _(0) #define ResetValueStr(name) name ## _("") #pragma db model version(1, 2) #pragma db object class user { public: user() {} user ( std::string nickname, std::string password ) : nickname_(nickname), password_(password), ResetValue(money), ResetValue(score),//unused ResetValue(kills), ResetValue(experience), ResetValue(deaths), ResetValue(privilidges), ResetValue(bounty), ResetValue(suicides), ResetValue(respect), ResetValue(kicks), ResetValue(warns), ResetValue(playtime), ResetValue(banned), ResetValueStr(ban_reason), ResetValueStr(ban_who), ResetValue(jailtime) {} accessor(nickname, std::string); acmf(std::string, password); acmf(long long, money); acmf(long long, score);//unused acmf(unsigned long long, kills); acmf(unsigned long long, experience); acmf(unsigned long long, deaths); acmf(unsigned long long, privilidges); acmf(unsigned long long, bounty); acmf(unsigned long long, suicides); acmf(long long, respect); acmf(unsigned long long, kicks); acmf(unsigned long long, warns); acmf(unsigned long long, playtime); acmf(unsigned long long, banned); acmf(std::string, ban_reason); acmf(std::string, ban_who); acmf(unsigned long long, jailtime); private: friend class odb::access; #pragma db unique id index std::string nickname_; }; as you can see I have 'only added unsigned long long jailtime'. When I throw the file onto the ODB compiler with the following command: tools\bin\odb.exe -d sqlite %filename% I get the following errors: error: SQLite does not support altering of columns info: first altered column is 'password' in table 'user' How can I fix this? Thanks in advance! :) From boris at codesynthesis.com Mon Oct 27 02:49:28 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 27 02:56:41 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: <245061441.1090869.1414228818337.open-xchange@patina.store> References: <245061441.1090869.1414228818337.open-xchange@patina.store> Message-ID: Hi Christian, Christian Sell writes: > - command line build links against libc++ > - qt build links against libstdc++ (for reason of some OSX backwards > compatibility) Thanks for sharing! This will definitely explain what we are seeing. BTW, how did you resolve this? Did you force QtCreator to use libc++ or did you re-build the ODB runtimes to use libstdc++? In the latter case I wonder if Qt uses the system libstdc++ (found in /usr/lib on my machine) or ships its own version (which will be a yet another level of pain in the butt). In the meantime I've tried to rebuild the ODB runtimes to use system libstdc++. For some reason passing -stdlib=libstdc++ to clang is not enough, one also has to explicitly link to -lstdc++: clang -stdlib=libstdc++ sizeof_funds.cxx -L/usr/lib -lstdc++ [That -L/usr/lib is necessary in my case because I have another libstdc++ in /usr/local/lib.] With that knowledge I was able to re-build the runtimes to use libstdc++: make distclean ./configure CC=clang CXX="clang++ -stdlib=libstdc++" LDFLAGS=-L/usr/lib LIBS=-lstdc++ make sudo make install And then the example: clang++ -stdlib=libstdc++ -c person-odb.cxx clang++ -stdlib=libstdc++ -c -DDATABASE_SQLITE driver.cxx clang++ -stdlib=libstdc++ -o driver person-odb.o driver.o -lodb-sqlite -lodb -L/usr/lib -lstdc++ otool -L ./driver ./driver: /usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) Boris From christian at gsvitec.com Mon Oct 27 04:18:17 2014 From: christian at gsvitec.com (Christian Sell) Date: Mon Oct 27 04:18:21 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <245061441.1090869.1414228818337.open-xchange@patina.store> Message-ID: <1565298505.1219340.1414397897858.open-xchange@patina.store> > Boris Kolpackov hat am 27. Oktober 2014 um 07:49 > geschrieben: > BTW, how did you resolve this? Did you force QtCreator to use libc++ > or did you re-build the ODB runtimes to use libstdc++? In the latter > case I wonder if Qt uses the system libstdc++ (found in /usr/lib on > my machine) or ships its own version (which will be a yet another > level of pain in the butt). we encountered this with boost and OxOrm, not with ODB. At that time, we resolved it by forcing the libraries onto libstdc++. We have now turned to configuring QMake to use libc++ (qmake.conf, something along the lines of QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.9, not 10.7). Just spent half a day recently since I didnt know this change had been done by a colleague.. No, I think Qt uses the system libstdc++ regards, Christian From boris at codesynthesis.com Mon Oct 27 04:42:55 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 27 04:50:13 2014 Subject: [odb-users] error: SQLite does not support altering of columns. info: first altered column is 'password' in table 'user', but field password is not being altered In-Reply-To: References: Message-ID: Hi Rafal, Rafal Gm writes: > Hello, I am trying to use the database migration features of ODB on which I > have been waiting a long time, but for some reason it gives alter errors > after adding one more integer column to the database. > > This is my version 1_1 class: > > [...] > > and this is the next version: > > [...] > > When I throw the file onto the ODB compiler with the following command: > > tools\bin\odb.exe -d sqlite %filename% > > I get the following errors: > error: SQLite does not support altering of columns > info: first altered column is 'password' in table 'user' First of all, if you really used the above command, you couldn't have gotten this error. You need to turn on database schema generation to enable schema evolution support (-s/--generate-schema option). Here is what I have done: I've copy-and-pasted the two versions of your class into a file called person.hxx (attached): #ifdef V1 // version 1 #else // version 2 #endif I then compiled it like so: rm person.xml odb -d sqlite -s -DV1 person.hxx person.xml: info: initializing changelog with base version 1 odb -d sqlite -s -DV2 person.hxx I got no errors and examining the changelog (person.xml) indicates that everything works as expected. Can you try this exact test yourself and see if you still get an error? Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: person.hxx Type: text/x-c++hdr Size: 4131 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20141027/eb3841fb/person.hxx From grasmanek94 at gmail.com Mon Oct 27 06:18:32 2014 From: grasmanek94 at gmail.com (Rafal Gm) Date: Mon Oct 27 06:32:23 2014 Subject: [odb-users] error: SQLite does not support altering of columns. info: first altered column is 'password' in table 'user', but field password is not being altered In-Reply-To: References: Message-ID: I did forget to say that my default.options has this: -IC:\Programs\Boost\153\include -IC:\development\SampGamemode\lib\odb\libodb-2.3.0 --std c++11 --generate-schema --generate-query And seems to work now, also, I just moved the code that doesn't change that much to the top as much as possible in the class and my current file compiles too. thanks for the help :) 2014-10-27 9:42 GMT+01:00 Boris Kolpackov : > Hi Rafal, > > Rafal Gm writes: > > > Hello, I am trying to use the database migration features of ODB on > which I > > have been waiting a long time, but for some reason it gives alter errors > > after adding one more integer column to the database. > > > > This is my version 1_1 class: > > > > [...] > > > > and this is the next version: > > > > [...] > > > > When I throw the file onto the ODB compiler with the following command: > > > > tools\bin\odb.exe -d sqlite %filename% > > > > I get the following errors: > > error: SQLite does not support altering of columns > > info: first altered column is 'password' in table 'user' > > First of all, if you really used the above command, you couldn't have > gotten this error. You need to turn on database schema generation to > enable schema evolution support (-s/--generate-schema option). > > Here is what I have done: I've copy-and-pasted the two versions of > your class into a file called person.hxx (attached): > > #ifdef V1 > > // version 1 > > #else > > // version 2 > > #endif > > I then compiled it like so: > > rm person.xml > odb -d sqlite -s -DV1 person.hxx > person.xml: info: initializing changelog with base version 1 > odb -d sqlite -s -DV2 person.hxx > > I got no errors and examining the changelog (person.xml) indicates > that everything works as expected. > > Can you try this exact test yourself and see if you still get an > error? > > Boris > From boris at codesynthesis.com Mon Oct 27 06:54:18 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 27 07:01:35 2014 Subject: [odb-users] error: SQLite does not support altering of columns. info: first altered column is 'password' in table 'user', but field password is not being altered In-Reply-To: References: Message-ID: Hi Rafal, Rafal Gm writes: > I just moved the code that doesn't change that much to the top as much > as possible in the class and my current file compiles too. One thing that is unusual about your code is that you use macros to create the list of data members. If you look at the database table that is generated by ODB, you will notice that the list of columns doesn't match that of the data members, which is normally the case. It turns out that from 4.7.0, GCC keeps track of macro expansion and ODB wasn't handling it properly. Thus the re-ordering. I have fixed this for the next release and it is possible that somehow this caused your initial problem, though I doubt it: you can re-order your data members in a class and it should not cause any schema changes. I've also tested your example before and after fixing this bug, and in both cases everything was working fine. Boris From axel50397 at gmail.com Mon Oct 27 09:49:05 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Mon Oct 27 09:49:25 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: <1565298505.1219340.1414397897858.open-xchange@patina.store> References: <245061441.1090869.1414228818337.open-xchange@patina.store> <1565298505.1219340.1414397897858.open-xchange@patina.store> Message-ID: Hi there, I saw your messages about libc++ and libstdc++. What/How do you want me to check Qt or compiled app are using which lib? otool is enough, but maybe you want me to check some things? -- 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). From boris at codesynthesis.com Mon Oct 27 10:26:32 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 27 10:33:44 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <245061441.1090869.1414228818337.open-xchange@patina.store> <1565298505.1219340.1414397897858.open-xchange@patina.store> Message-ID: Hi Adnan, Adnan RIHAN writes: > What/How do you want me to check Qt or compiled app are using which lib? You can try to rebuild the ODB runtimes to use libstdc++ as I described in my previous email and then see if that helps your application that is built from QtCreator. Boris From axel50397 at gmail.com Mon Oct 27 14:21:39 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Mon Oct 27 14:22:05 2014 Subject: [odb-users] libc++abi.dylib: terminating with uncaught foreign exception In-Reply-To: References: <245061441.1090869.1414228818337.open-xchange@patina.store> <1565298505.1219340.1414397897858.open-xchange@patina.store> Message-ID: On 27 octobre 2014 at 15:33:42, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > You can try to rebuild the ODB runtimes to use libstdc++ as I described > in my previous email and then see if that helps your application that > is built from QtCreator. For reference, configured with ?./configure?, this is the default ?otool? output for the runtime libs, on my computer (OSX 10.9.5, Xcode 6.1, using clang): > ~ % otool -L /usr/local/lib/libodb{,-sqlite,-qt}.dylib > /usr/local/lib/libodb.dylib: > /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) > /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0) > /usr/local/lib/libodb-sqlite.dylib: > /usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 158.0.0) > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) > /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0) > /usr/local/lib/libodb-qt.dylib: > /usr/local/lib/libodb-qt-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2) > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) > /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0) I?ve compiled the 3 runtime libs with: > ./configure CC=clang CXX=clang++\ -stdlib=libstdc++ LDFLAGS=-L/usr/lib LIBS=-lstdc++ To be sure, I?ve added /usr/lib because I had GCC-4.9 installed. Here is the otool: > ~ % otool -L /usr/local/lib/libodb{,-sqlite,-qt}.dylib > /usr/local/lib/libodb.dylib: > /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) > /usr/local/lib/libodb-sqlite.dylib: > /usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 158.0.0) > /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) > /usr/local/lib/libodb-qt.dylib: > /usr/local/lib/libodb-qt-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2) > /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) So it?s confirmed, runtime libs are now linked with libstdc++. Now here is my app?s otool: > ? src % otool -L /Users/Max13/Dev/System/LGC/build/Desktop_Qt_5_3_2_clang_64bit-Debug/apps/LGC/src/LGC.app/Contents/MacOS/LGC? > /Users/Max13/Dev/System/LGC/build/Desktop_Qt_5_3_2_clang_64bit-Debug/apps/LGC/src/LGC.app/Contents/MacOS/LGC: > /usr/local/lib/libodb-qt-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/local/lib/libodb-sqlite-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /usr/local/lib/libodb-2.3.dylib (compatibility version 0.0.0, current version 0.0.0) > /Users/Max13/Qt/5.3/clang_64/lib/QtSvg.framework/Versions/5/QtSvg (compatibility version 5.3.0, current version 5.3.2) > /Users/Max13/Qt/5.3/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.3.0, current version 5.3.2) > /Users/Max13/Qt/5.3/clang_64/lib/QtGui.framework/Versions/5/QtGui (compatibility version 5.3.0, current version 5.3.2) > /Users/Max13/Qt/5.3/clang_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.3.0, current version 5.3.2) > /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0) > /System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0) > /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 60.0.0) > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) I?ve done something which would crash, and it doesn?t show ?libc++abi uncaught exception? anymore, now my exception are correctly caught by odb::exception ! Many thanks :) ! -- 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). From erezgb at walla.com Tue Oct 28 05:53:38 2014 From: erezgb at walla.com (=?UTF-8?Q?=45=72=65=7A=20=47=42?=) Date: Tue Oct 28 06:18:04 2014 Subject: =?UTF-8?Q?=52=65=3A=20=52=65=3A=20=5B=6F=64=62=2D=75=73=65=72=73=5D=20=73=6C=6F=77=20=70=65=72=73=69=73=74=20=66=6F=72=20=62=75=6C=6B=20=69=6E=73=65=72=74?= Message-ID: <1414490018.648000-41823580-1493@walla.com>



Hi Boris,


Following what you suggested, we might need to consider SQLite Prepared Statement as a mean for bulk insert

in addition to ODB, we would like to continue ODB as possible.


  • Does ODB supports SQLite Prepared Statement ?

  • Assuming I will use SQLite functions to perform them, can ODB database expose it's internal SQLite Database Connection Handle so I can use the same connection with SQLite functions ?

  • Can ODB objects expose the Insert statment for external use ?

  • Anything else that might help me use ODB with SQLite Prepared Statement ?

Thank you very much,
Erez.




????: Boris Kolpackov,
????: Re: [odb-users] slow persist for bulk insert

Hi Erez,

Erez GB writes:

> We are working with ODB and implement a complex schema and it works
> great :-)

Thanks, glad you are finding ODB useful!


> However, we need better performance when we are insering 10000 of
> objects into our SQLite DB. Can you please help with guidelines for
> improving ODB performance with SQLite? Is there another way for
> fast bulk insert of many ODB objects.

SQLite doesn't support bulk INSERT (unlike, say, Oracle or SQL Server)
so you have to execute a separate INSERT statement for each object
(which is what ODB does). So the only way to optimize this is to try
various way you do it.

Number one is probably selecting the right transaction granularity.
This earlier post has more information on this:

http://www.codesynthesis.com/pipermail/odb-users/2013-May/001270.html

Number two is to temporarily disable foreign key constraint checking
(if you use foreign keys). You lose some safety (you need to make sure
all the references are valid) but you usually gain quite a bit in
performance. Here is what the code would look like:

connection_ptr c (db->connection ());

c->execute ("PRAGMA foreign_keys=OFF");

transaction t(c->begin());

for(unsigned int i = 0; i < 10000; i++)
{
if (i % 100 == 0)
{
t.commit ();
t.reset (c->begin ());
}

...
}

t.commit();

c->execute ("PRAGMA foreign_keys=ON");

If that's not sufficient, then I found this fairly exhaustive list of
things you can try (most of them via the PRAGMA as above) to improve
performance of INSERT in SQLite:

http://stackoverflow.com/questions/1711631/how-do-i-improve-insert-per-second-performance-of-sqlite

Note also that in case of SQLite doing any kind of parallel insertion
(e.g., by running multiple transactions from several threads in parallel)
will only make things worse (SQLite has very poor concurrency support,
especially for modifications).

Boris


From boris at codesynthesis.com Tue Oct 28 06:31:59 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 28 06:39:11 2014 Subject: [odb-users] slow persist for bulk insert In-Reply-To: <1414490018.648000-41823580-1493@walla.com> References: <1414490018.648000-41823580-1493@walla.com> Message-ID: Hi Erez, Erez GB writes: > Following what you suggested, we might need to consider SQLite Prepared > Statement as a mean for bulk insert ODB already uses prepared statements. It also caches/reuses prepared statements and even memory buffers. I think you will be hard-pressed to achieve better performance with hand-coded INSERTs unless you exploit some application-specific knowledge (which is, generally, quite hard to do in the case of INSERT). > * Assuming I will use SQLite functions to perform them, can ODB database > expose it's internal SQLite Database Connection Handle so I can use the > same connection with SQLite functions ? Yes, see Section 18.3, "SQLite Connection and Connection Factory". > * Can ODB objects expose the Insert statment for external use? You can use them (see libodb-sqlite/odb/sqlite/statement.hxx) though they are quite low level and optimized for the way ODB does things (e.g., caching/reusing as much as possible). > * Anything else that might help me use ODB with SQLite Prepared > Statement ? As I said, you are already using prepared statements. What you can do is show us the class you are trying to persist, your transaction, the numbers that you get, and the numbers that you would like to get. Even better way would be to create a test program that mimics your application scenario that we can try. Boris From erezgb at walla.com Tue Oct 28 08:57:43 2014 From: erezgb at walla.com (=?UTF-8?Q?=45=72=65=7A=20=47=42?=) Date: Tue Oct 28 09:38:24 2014 Subject: =?UTF-8?Q?=52=65=3A=20=52=65=3A=20=5B=6F=64=62=2D=75=73=65=72=73=5D=20=73=6C=6F=77=20=70=65=72=73=69=73=74=20=66=6F=72=20=62=75=6C=6B=20=69=6E=73=65=72=74?= Message-ID: <1414501062.611000-56740218-1535@walla.com>



Hi Boris,


First, thank you very much for your quick response and kindness, I have included bellow the code we use to Insert\Save ODB objects,

we have a template that handles some of the repeated code for use that is also used in UnitTesting (where ODB cannot be used)

so we use aliases to your objects like database, transaction etc'


Do you see any problem or things that might cause such a huge difference between prepared statements to it ?


Maybe I am missing something about ODB usage ?


-------------------------------------------------------------------------------------------


bool SaveOwnData(ODBDatabase data_base)

{

if(data_base == NULL)

{

return false;

}


long new_id = 0;

bool bOperationSuccessfulFlag = true;


ODBTransaction save_transaction(data_base->begin ());


// this template cannot use shared_from_this, we pass the actual instance of the "this" pointer casted to it's real class

ORMClass& this_casted_reference = *((ORMClass*)this);


bool bIsNewObject = getIsNewObjectFlag();


// actually save this object

try

{

if(!getIsNewObjectFlag())

{

//

// updating an existing object

data_base->update(this_casted_reference);

}

else

{

//

// inserting a new object

new_id = data_base->persist(this_casted_reference);

//

// after saving it, this object is not new anymore

setIsNewObjectFlag(false);

}

}

catch (const odb::exception& e)

{

//

// log the error in e->what()

const char* sCause = e.what();

string sError("ORMPersistData::SaveOwnData - ODB Exception ");

sError += sCause;

BOOST_ASSERT_MSG(0, sError.c_str());

// 

bOperationSuccessfulFlag = false;

}

catch(...)

{

BOOST_ASSERT_MSG(0, "ORMPersistData::SaveOwnData - Unspecified Exception");

bOperationSuccessfulFlag = false;

}

//

save_transaction.commit();


return bOperationSuccessfulFlag;

}


-------------------------------------------------------------------------------------------



????: Boris Kolpackov,
????: Re: [odb-users] slow persist for bulk insert

Hi Erez,

Erez GB writes:

> Following what you suggested, we might need to consider SQLite Prepared
> Statement as a mean for bulk insert

ODB already uses prepared statements. It also caches/reuses prepared
statements and even memory buffers. I think you will be hard-pressed
to achieve better performance with hand-coded INSERTs unless you
exploit some application-specific knowledge (which is, generally,
quite hard to do in the case of INSERT).


> * Assuming I will use SQLite functions to perform them, can ODB database
> expose it's internal SQLite Database Connection Handle so I can use the
> same connection with SQLite functions ?

Yes, see Section 18.3, "SQLite Connection and Connection Factory".


> * Can ODB objects expose the Insert statment for external use?

You can use them (see libodb-sqlite/odb/sqlite/statement.hxx) though
they are quite low level and optimized for the way ODB does things
(e.g., caching/reusing as much as possible).


> * Anything else that might help me use ODB with SQLite Prepared
> Statement ?

As I said, you are already using prepared statements. What you can
do is show us the class you are trying to persist, your transaction,
the numbers that you get, and the numbers that you would like to get.
Even better way would be to create a test program that mimics your
application scenario that we can try.

Boris


From boris at codesynthesis.com Tue Oct 28 09:41:05 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 28 09:48:17 2014 Subject: [odb-users] slow persist for bulk insert In-Reply-To: <1414501062.611000-56740218-1535@walla.com> References: <1414501062.611000-56740218-1535@walla.com> Message-ID: Hi Erez, Erez GB writes: > First, thank you very much for your quick response and kindness, No problem. Can ask you one favor: can you refrain from sending your emails to me/odb-users in HTML-only format? > Do you see any problem or things that might cause such a huge difference Yes, I see a big problem: you are creating a new transaction for each persist() call. This is bad for performance. In fact, in my initial reply to this thread I pointed you to an email that shows how to batch multiple database operations into several transactions. I guess you weren't paying attention. Here is this email again: http://www.codesynthesis.com/pipermail/odb-users/2013-May/001270.html Boris From boris at codesynthesis.com Wed Oct 29 06:36:56 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 29 06:44:10 2014 Subject: [odb-users] slow persist for bulk insert In-Reply-To: <1414511349.404000-76053829-16393@walla.com> References: <1414511349.404000-76053829-16393@walla.com> Message-ID: Hi Erez, Please keep your replies CC'ed to the odb-users mailing list, as discussed in the posting guidelines: http://codesynthesis.com/support/posting-guidelines.xhtml Erez GB writes: > My web client is sending the HTML format, not sure I can change :-( Perhaps get a better mail client? We don't have such problems with GMail, for example. > I get a big differance by grouping together many inserts using a single > transaction commit, testing with different batch numbers seems 100K-200K > is the right limit, as the commit time gets longer as the batch grows. > > There is still a little advantage to prepared query inserts but not as big, You keep implying that ODB doesn't use prepared statements while I keep telling you that it only uses prepared statements. If you want to continue to receive my help you need to start paying attention to what I am saying and stop repeating things that I have already told you are false. > 17 secs in prepared query to 46 secs to ODB when inserting 200k records, > 10 secs in prepared query to 22 secs to ODB when inserting 100k records. > > What do you think can be the cause of this ? My guess is you are comparing apples to oranges. Show me the following three things and I will take a look: 1. Your hand-coded transaction (the one you call "prepared query inserts"). 2. Your ODB-based transaction. 3. Your persistent class that you are using in #2. Boris From sean.clarke at sec-consulting.co.uk Wed Oct 29 06:14:11 2014 From: sean.clarke at sec-consulting.co.uk (Sean Clarke) Date: Wed Oct 29 09:52:17 2014 Subject: [odb-users] "out of the box" project Message-ID: Hi all, returning to C++ after several years in the Java space I am very much enjoying the renaissance and fresh new feel offered by the C++11 and C++14 changes. I am, however finding it time consuming getting back to grappling with make and cmake (which is completely new to me). Are there any "out of the box" ODB projects using cmake where all the ORM code generation is all taken care of? I have hobbled together an old style make project, however it seems to rebuild the ORM files everytime it is run - something pre built and downloadable with CMAKE (eg a HelloWorld style) would be a great help. Regards Sean Clarke From boris at codesynthesis.com Wed Oct 29 10:03:52 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 29 10:11:03 2014 Subject: [odb-users] "out of the box" project In-Reply-To: References: Message-ID: Hi Sean, Sean Clarke writes: > Are there any "out of the box" ODB projects using cmake where all the ORM > code generation is all taken care of? The place to look for everything ODB+CMake-related is this Wiki page: http://wiki.codesynthesis.com/Using_ODB_with_CMake The current "leader" in CMake support for ODB is Timo Rothenpieler's module (listed at the top of the page). It even includes the example that is based on ODB's stock "Hello, World"! Out of curiosity (I, myself, don't use CMake) I've downloaded his project ("Download Zip" in the right hand size) and then did: cd OdbCmake-master cmake . make ./odbcmake unknown database schema '' A quick look around revealed that the example CMakeLists.txt is missing the GENERATE_SCHEMA, umm, what would one call it, flag? After changing this line: odb_compile(OdbCMake_SOURCES FILES ${OdbCMake_ODB_HEADERS} DB sqlite GENERATE_QUERY GENERATE_SESSION) To read: odb_compile(OdbCMake_SOURCES FILES ${OdbCMake_ODB_HEADERS} DB sqlite GENERATE_QUERY GENERATE_SESSION GENERATE_SCHEMA) And re-running cmake and make: cmake . make I get: ./odbcmake Hello, John Doe! Hello, Jane Doe! count : 3 min age: 31 max age: 33 Boris From grasmanek94 at gmail.com Wed Oct 29 11:00:10 2014 From: grasmanek94 at gmail.com (Rafal Gm) Date: Wed Oct 29 13:14:13 2014 Subject: [odb-users] Is there a amalgamation package available? Message-ID: Just like sqlite3 does have amalgamation packages, does ODB (preferably main and sqlite) also have it? (or a script, preferably runnable on Windows, to generate the amalgamation) Just curious and would be quite handy :) alos another thing I am curious of: what does ODB stand for? I can't find that anywhere :P From boris at codesynthesis.com Thu Oct 30 05:27:41 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 30 05:34:53 2014 Subject: [odb-users] Is there a amalgamation package available? In-Reply-To: References: Message-ID: <20141030092741.GA12651@codesynthesis.com> Hi Rafal, Rafal Gm writes: > Just like sqlite3 does have amalgamation packages, does ODB (preferably > main and sqlite) also have it? Having something like this for ODB would be problematic for two reasons: 1. Different people use different databases (and sometime combinations of multiple databases). Maintaining all possible combinations (especially once you throw in libodb-boost and libodb-qt) will be too much of a burden. 2. Having ODB partitioned into multiple small modules makes it very cheap (procedurally) for us to release targeted bug fixes. For example, if there is a bug in libodb-sqlite, we can test and release just this one library. If there were also a number of amalgamations to release, this will become a much bigger burden. > (or a script, preferably runnable on Windows, to generate the amalgamation) I think a much more straightforward thing to do would be to write a script (batch file) that builds every ODB package that you need using VC++ batch build and then creates a "build amalgamation". For the first part (build with DEVENV) you can use, as an inspiration, the build.bat file from the odb-tests package. There are also more similar scripts in odb-etc[1] (internally we build entire ODB and then run all the tests and examples for all the databases in batch mode). For the second part ("build amalgamation") what you can do is copy the bin/, lib/ (or bin64/, lib64/) and odb/ sub-directories of libodb and libodb-sqlite into one directory. This way you will merge headers and libraries for these two packages into a single location which you can then use in VC++ Directories or some such. > What does ODB stand for? It is not an acronym, just a name. If you must have some meaning associated with it, you can think of it as "Object DataBase". [1] http://scm.codesynthesis.com/?p=odb/odb-etc.git;a=tree;f=test/windows Boris From grasmanek94 at gmail.com Thu Oct 30 06:45:49 2014 From: grasmanek94 at gmail.com (Rafal Gm) Date: Thu Oct 30 08:40:08 2014 Subject: [odb-users] Is there a amalgamation package available? In-Reply-To: <20141030092741.GA12651@codesynthesis.com> References: <20141030092741.GA12651@codesynthesis.com> Message-ID: Thank you for the explainations :) Also a quick question, because I'm expanding my database but forgot to enable the version pragma for one of my tables, how can I upgrade it without having to delete and reimport all data? 2014-10-30 10:27 GMT+01:00 Boris Kolpackov : > Hi Rafal, > > Rafal Gm writes: > > > Just like sqlite3 does have amalgamation packages, does ODB (preferably > > main and sqlite) also have it? > > Having something like this for ODB would be problematic for two reasons: > > 1. Different people use different databases (and sometime combinations of > multiple databases). Maintaining all possible combinations (especially > once you throw in libodb-boost and libodb-qt) will be too much of a > burden. > > 2. Having ODB partitioned into multiple small modules makes it very > cheap (procedurally) for us to release targeted bug fixes. For example, > if there is a bug in libodb-sqlite, we can test and release just this > one library. If there were also a number of amalgamations to release, > this will become a much bigger burden. > > > > (or a script, preferably runnable on Windows, to generate the > amalgamation) > > I think a much more straightforward thing to do would be to write a > script (batch file) that builds every ODB package that you need using > VC++ batch build and then creates a "build amalgamation". For the > first part (build with DEVENV) you can use, as an inspiration, the > build.bat file from the odb-tests package. There are also more similar > scripts in odb-etc[1] (internally we build entire ODB and then run all > the tests and examples for all the databases in batch mode). > > For the second part ("build amalgamation") what you can do is copy the > bin/, lib/ (or bin64/, lib64/) and odb/ sub-directories of libodb and > libodb-sqlite into one directory. This way you will merge headers and > libraries for these two packages into a single location which you > can then use in VC++ Directories or some such. > > > > What does ODB stand for? > > It is not an acronym, just a name. If you must have some meaning > associated with it, you can think of it as "Object DataBase". > > > [1] http://scm.codesynthesis.com/?p=odb/odb-etc.git;a=tree;f=test/windows > > Boris > From sean.clarke at sec-consulting.co.uk Thu Oct 30 08:47:06 2014 From: sean.clarke at sec-consulting.co.uk (Sean Clarke) Date: Thu Oct 30 08:47:14 2014 Subject: [odb-users] Initial load with join Message-ID: Hi, doing some more evaluation with ODB, I don't know if I have missed something - but is there a way to perform initial loads with a join? Similiar to teh Hibernate eager cache..... as an example: 3 classes and tables: Job JobSheet Address A job has a jobsheet and an address: When I load a job is there away to get the other two entities populated from the same initial load. Presently I seem to get 3 separate SQL statements per load and this hugely effects performance, especially over a WAN. In Hibernate you can set the one-to-one mappings to be eagerly loaded and the initial load would be structured with a join meaning only one query is needed. Is this possible with ODB? Many thanks Regards Sean Clarke From boris at codesynthesis.com Thu Oct 30 08:56:40 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 30 09:03:51 2014 Subject: [odb-users] Is there a amalgamation package available? In-Reply-To: References: <20141030092741.GA12651@codesynthesis.com> Message-ID: Hi Rafal, Rafal Gm writes: > Also a quick question, Please in the future start another thread with proper subject line when you have another "quick question" (I know it is much easier to simply hit reply but that doesn't make for nice archives). See posting guidelines for detail: http://codesynthesis.com/support/posting-guidelines.xhtml > because I'm expanding my database but forgot to enable the version > pragma for one of my tables, how can I upgrade it without having > to delete and reimport all data? By hand. There is nothing ODB can do here. Boris From boris at codesynthesis.com Thu Oct 30 09:17:53 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 30 09:25:04 2014 Subject: [odb-users] Initial load with join In-Reply-To: References: Message-ID: Hi Sean, Sean Clarke writes: > doing some more evaluation with ODB, I don't know if I have missed > something - but is there a way to perform initial loads with a join? > Similiar to teh Hibernate eager cache..... as an example: > > 3 classes and tables: > > Job > JobSheet > Address > > > A job has a jobsheet and an address: When I load a job is there away to get > the other two entities populated from the same initial load. Presently I > seem to get 3 separate SQL statements per load and this hugely effects > performance, especially over a WAN. Yes, ODB will use three separate statements to load each object. This is geared towards lazy loading (Section 6.4, "Lazy Pointers"). The ODB way to achieve what you want is to use views (Chapter 10). They not only allow you to load data from multiple objects, but you can also only load the data that you actually need. Now if you need to load all three objects completely, views can be quite awkward. To resolve this we are planning to add what we call object loading views. The syntax will be along these lines (not finalized yet): #pragma db view object(Job) object(JobSheet) object(Address) struct JobAndRelated { std::shared_ptr job; }; This feature is pretty high up on our TODO list. Boris From sean.clarke at sec-consulting.co.uk Thu Oct 30 09:29:35 2014 From: sean.clarke at sec-consulting.co.uk (Sean Clarke) Date: Thu Oct 30 09:29:43 2014 Subject: [odb-users] Initial load with join In-Reply-To: References: Message-ID: That sounds like an *excellent* feature Boris - have you an approx. timeframe? Regards Sean Clarke --------------------------------------------- SEC Consulting Limited Phone: +44 (0)23 8040 5599 Website: http://www.sec-consulting.co.uk Email: sean.clarke@sec-consulting.co.uk On 30 October 2014 13:17, Boris Kolpackov wrote: > Hi Sean, > > Sean Clarke writes: > > > doing some more evaluation with ODB, I don't know if I have missed > > something - but is there a way to perform initial loads with a join? > > Similiar to teh Hibernate eager cache..... as an example: > > > > 3 classes and tables: > > > > Job > > JobSheet > > Address > > > > > > A job has a jobsheet and an address: When I load a job is there away to > get > > the other two entities populated from the same initial load. Presently I > > seem to get 3 separate SQL statements per load and this hugely effects > > performance, especially over a WAN. > > Yes, ODB will use three separate statements to load each object. This is > geared towards lazy loading (Section 6.4, "Lazy Pointers"). > > The ODB way to achieve what you want is to use views (Chapter 10). They > not only allow you to load data from multiple objects, but you can also > only load the data that you actually need. > > Now if you need to load all three objects completely, views can be quite > awkward. To resolve this we are planning to add what we call object > loading views. The syntax will be along these lines (not finalized yet): > > #pragma db view object(Job) object(JobSheet) object(Address) > struct JobAndRelated > { > std::shared_ptr job; > }; > > This feature is pretty high up on our TODO list. > > Boris > From boris at codesynthesis.com Thu Oct 30 09:38:07 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 30 09:45:18 2014 Subject: [odb-users] Initial load with join In-Reply-To: References: Message-ID: Hi Sean, Sean Clarke writes: > That sounds like an *excellent* feature Boris - have you an approx. > timeframe? I can't promise it will make it into the next release (planned for end-Nov), but I will try. Boris From PStath at Axxcelera.com Thu Oct 30 15:02:41 2014 From: PStath at Axxcelera.com (Stath, Paul) Date: Thu Oct 30 15:02:44 2014 Subject: [odb-users] Initial load with join Message-ID: <5B5D636C5F0AA747B37D0EFC72B563C42D5E0C01@RIC-MS02.MWSG.int> Boris writes: > The ODB way to achieve what you want is to use views (Chapter 10). They > not only allow you to load data from multiple objects, but you can also > only load the data that you actually need. > > Now if you need to load all three objects completely, views can be quite > awkward. To resolve this we are planning to add what we call object > loading views. The syntax will be along these lines (not finalized yet): > > #pragma db view object(Job) object(JobSheet) object(Address) > struct JobAndRelated > { > std::shared_ptr job; > }; > > This feature is pretty high up on our TODO list. Boris -- I assume this "object loading view" would result in a new VIEW in the database schema that is contains an INNER JOIN with the related tables with appropriate join conditions for the relationships. So the above example simply means that columns from the Job, JobSheet, and Address tables are added to the view implicitly rather than explicitly? Please correct me if I'm not following. -- Paul From boris at codesynthesis.com Fri Oct 31 03:38:10 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Oct 31 03:45:21 2014 Subject: [odb-users] Initial load with join In-Reply-To: <5B5D636C5F0AA747B37D0EFC72B563C42D5E0C01@RIC-MS02.MWSG.int> References: <5B5D636C5F0AA747B37D0EFC72B563C42D5E0C01@RIC-MS02.MWSG.int> Message-ID: Hi Paul, Stath, Paul writes: > I assume this "object loading view" would result in a new VIEW in the > database schema that is contains an INNER JOIN with the related tables > with appropriate join conditions for the relationships. No, ODB views are not mapped to database views. Quoting from Chapter 10 in the ODB manual: "Many relational databases also define the concept of views. Note, however, that ODB views are not mapped to database views. Rather, by default, an ODB view is mapped to an SQL SELECT query. However, if desired, it is easy to create an ODB view that is based on a database view." In this particular case you will have a single SELECT statement with two JOIN's (one for JobSheet and the other for Address) which will load all three objects at once. Boris From PStath at Axxcelera.com Fri Oct 31 08:26:40 2014 From: PStath at Axxcelera.com (Stath, Paul) Date: Fri Oct 31 08:26:44 2014 Subject: [odb-users] Initial load with join In-Reply-To: <5B5D636C5F0AA747B37D0EFC72B563C42D5E0FC7@RIC-MS02.MWSG.int> References: <5B5D636C5F0AA747B37D0EFC72B563C42D5E0C74@RIC-MS02.MWSG.int>, , <5B5D636C5F0AA747B37D0EFC72B563C42D5E0FC7@RIC-MS02.MWSG.int> Message-ID: <5B5D636C5F0AA747B37D0EFC72B563C42D5E0FD8@RIC-MS02.MWSG.int> Boris -- > No, ODB views are not mapped to database views. Quoting from Chapter 10 > in the ODB manual: > > In this particular case you will have a single SELECT statement with > two JOIN's (one for JobSheet and the other for Address) which will load > all three objects at once. Excellent. It just goes to show that even if you think you have completely read the manual, how easy it is to miss something. Thanks. -- Paul From andrew.shy.lee at gmail.com Fri Oct 31 23:52:49 2014 From: andrew.shy.lee at gmail.com (andrew.shy.lee@gmail.com) Date: Thu Nov 6 04:30:26 2014 Subject: [odb-users] help Message-ID: <2014110111524566220917@gmail.com> hello everyone, when i use multi-database support feature of ODB, I get into trouble! I follow the introduction of odb-manual to try to learn how to implement multiple databases support, but when i create the database instance, a bad_alloc exception is throwed by my complier (visual studio 2012), the part source code as follows : //......................... if (db == "mysql") r.reset (new odb::mysql::database (argc, argv)); //bad_alloc exception is throwed //...................... I don't know why, because when i use single database, there is no exception throwed. I am very appreciate for your answers. andrew.shy.lee@gmail.com