From boris at codesynthesis.com Mon Sep 1 02:47:58 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 1 02:53:57 2014 Subject: [odb-users] error: =?utf-8?Q?redefinit?= =?utf-8?Q?ion_of_=E2=80=98bool?= odb::create_schema In-Reply-To: <45E0E325-82AC-4E21-B1F4-1F652C5510D4@gmail.com> References: <45E0E325-82AC-4E21-B1F4-1F652C5510D4@gmail.com> Message-ID: Hi Willem, WA van Doesburg writes: > When linking my program I?m getting the error: > error: redefinition of ?bool odb::create_schema > the compiler is citing two different -odb.cxx files both defining this > function. create_schema() function is generated by ODB as static which means it should be local to the translation unit (.cxx file). Can you verify that they are indeed static? That is, the signature should be: static bool create_schema (...) If they are, then it would appear that your C++ compiler is ignoring static for some reason. Which C++ compiler/platform are you using? It could also be something silly, like defining a pre-processor macro named 'static'. Boris From boris at codesynthesis.com Mon Sep 1 03:11:11 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 1 03:17:10 2014 Subject: [odb-users] Gentoo ebuilds and overlay In-Reply-To: <5401ECCA.7000206@rothenpieler.org> References: <5401ECCA.7000206@rothenpieler.org> Message-ID: Hi Timo, Timo Rothenpieler writes: > I updated the old odb 2.2.0 gentoo ebuilds to the current versions and > put them into an overlay: Thanks! Do you think it makes sense to create a Wiki page for using ODB on Gentoo? It doesn't seems like this is "discoverable" from Gentoo itself by someone looking for ODB ebuilds. > The ebuilds for libodb-mssql and the examples were removed, because it > seems like the neccesary dependencies for mssql were removed from portage. Yes, this makes sense. I was surprised this was possible initially since the Microsoft's ODBC driver for Linux is proprietary. Boris From wvandoesburg at gmail.com Tue Sep 2 16:25:12 2014 From: wvandoesburg at gmail.com (WA van Doesburg) Date: Wed Sep 3 03:24:32 2014 Subject: =?windows-1252?Q?Re=3A_=5Bodb-users=5D_error=3A_redefinition_of_?= =?windows-1252?Q?=91bool_odb=3A=3Acreate=5Fschema?= In-Reply-To: References: <45E0E325-82AC-4E21-B1F4-1F652C5510D4@gmail.com> Message-ID: <388BE032-D93C-49B5-81F7-3CC31651C80C@gmail.com> Hello Boris, Thank you for your replying to my question. I?ve checked the generated code. The function signature is indeed static bool create_schema (...) My platform is Ubuntu 12.04 and my compiler version is: c++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ? Willem On 01 Sep 2014, at 08:47, Boris Kolpackov wrote: > Hi Willem, > > WA van Doesburg writes: > >> When linking my program I?m getting the error: >> error: redefinition of ?bool odb::create_schema >> the compiler is citing two different -odb.cxx files both defining this >> function. > > create_schema() function is generated by ODB as static which means it > should be local to the translation unit (.cxx file). Can you verify > that they are indeed static? That is, the signature should be: > > static bool > create_schema (...) > > If they are, then it would appear that your C++ compiler is ignoring > static for some reason. Which C++ compiler/platform are you using? > > It could also be something silly, like defining a pre-processor > macro named 'static'. > > Boris From boris at codesynthesis.com Wed Sep 3 03:35:47 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 3 03:42:04 2014 Subject: [odb-users] error: =?utf-8?Q?redefinit?= =?utf-8?Q?ion_of_=E2=80=98bool?= odb::create_schema In-Reply-To: <388BE032-D93C-49B5-81F7-3CC31651C80C@gmail.com> References: <45E0E325-82AC-4E21-B1F4-1F652C5510D4@gmail.com> <388BE032-D93C-49B5-81F7-3CC31651C80C@gmail.com> Message-ID: <20140903073547.GA13628@codesynthesis.com> Hi Willem, WA van Doesburg writes: > I?ve checked the generated code. The function signature is indeed > > static bool > create_schema (...) > > My platform is Ubuntu 12.04 and my compiler version is: > c++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 Ok, you are using a fairly recent GCC. I searched for any issues/bugs with static functions but there doesn't seem to be any. So this is probably not the compiler. Can you try/do the following for me: 1. Add these three lines into one of the generated -odb.cxx files that cause the conflict and try to build (don't re-build so that that there is no run of the ODB compiler since that would overwrite your modifications). Add them just before the create_schema() function: #ifdef static #error static is defined as a macro #endif 2. Can you show me the list of headers you are compiling with ODB. That is the ${ODB_HEADERS} expansion in this: odb -d sqlite -DDATABASE_SQLITE -I../libs/libodb-boost-2.3.0 -o .. \ --generate-schema --generate-query --profile boost ${ODB_HEADERS} Or, better yet, show the actual ODB command line that gets executed. 3. Can you show the linker command line and the complete error listing? Thanks, Boris From wvandoesburg at gmail.com Wed Sep 3 08:57:37 2014 From: wvandoesburg at gmail.com (WA van Doesburg) Date: Wed Sep 3 09:23:52 2014 Subject: =?windows-1252?Q?Re=3A_=5Bodb-users=5D_error=3A_redefinition_of_?= =?windows-1252?Q?=91bool_odb=3A=3Acreate=5Fschema?= In-Reply-To: <20140903073547.GA13628@codesynthesis.com> References: <45E0E325-82AC-4E21-B1F4-1F652C5510D4@gmail.com> <388BE032-D93C-49B5-81F7-3CC31651C80C@gmail.com> <20140903073547.GA13628@codesynthesis.com> Message-ID: <6A159870-7000-470F-A1C6-6E031ED3D007@gmail.com> Hi Boris, I?m a little further along in pinpointing what is causing this. I?m using cmake as my build system. In order to only have to change my code and not my CMakeList.txt each time I add a persistable class I?m including the generated -odb.cxx files to my own .cxx files where I?m using that class. Apparently this produces the name clash. So the my question is why is this producing the name clash? And, is there a way to automatically update my CMakeList.txt based on the output of my ODB build step? If desired I can prepare a sample test case. Best regards, ? Willem On 03 Sep 2014, at 09:35, Boris Kolpackov wrote: > Hi Willem, > > WA van Doesburg writes: > >> I?ve checked the generated code. The function signature is indeed >> >> static bool >> create_schema (...) >> >> My platform is Ubuntu 12.04 and my compiler version is: >> c++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3 > > Ok, you are using a fairly recent GCC. I searched for any issues/bugs > with static functions but there doesn't seem to be any. So this is > probably not the compiler. > > Can you try/do the following for me: > > 1. Add these three lines into one of the generated -odb.cxx files that > cause the conflict and try to build (don't re-build so that that > there is no run of the ODB compiler since that would overwrite your > modifications). > > Add them just before the create_schema() function: > > #ifdef static > #error static is defined as a macro > #endif > > 2. Can you show me the list of headers you are compiling with ODB. That > is the ${ODB_HEADERS} expansion in this: > > odb -d sqlite -DDATABASE_SQLITE -I../libs/libodb-boost-2.3.0 -o .. \ > --generate-schema --generate-query --profile boost ${ODB_HEADERS} > > Or, better yet, show the actual ODB command line that gets executed. > > 3. Can you show the linker command line and the complete error listing? > > Thanks, > Boris From boris at codesynthesis.com Wed Sep 3 09:46:18 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 3 09:52:36 2014 Subject: [odb-users] error: =?utf-8?Q?redefinit?= =?utf-8?Q?ion_of_=E2=80=98bool?= odb::create_schema In-Reply-To: <6A159870-7000-470F-A1C6-6E031ED3D007@gmail.com> References: <45E0E325-82AC-4E21-B1F4-1F652C5510D4@gmail.com> <388BE032-D93C-49B5-81F7-3CC31651C80C@gmail.com> <20140903073547.GA13628@codesynthesis.com> <6A159870-7000-470F-A1C6-6E031ED3D007@gmail.com> Message-ID: Hi Willem, WA van Doesburg writes: > I?m using cmake as my build system. In order to only have to change > my code and not my CMakeList.txt each time I add a persistable class > I?m including the generated -odb.cxx files to my own .cxx files where > I?m using that class. Yeah, you should have mentioned that from the beginning. > Apparently this produces the name clash. > > So the my question is why is this producing the name clash? My guess is if you include two -odb.cxx files into the same .cxx file, then you will end up with two identically-named static functions in the same translation unit. I am surprised you didn't get a compile error to this effect. > And, is there a way to automatically update my CMakeList.txt based on > the output of my ODB build step? The output of the ODB compiler is very regular. You pass it foo.hxx, it produces foo-odb.{h,i,c}xx. Surely it is possible in CMake to take a list of files in the form "foo.hxx bar.hxx" and transform it to a list in the form "foo-odb.cxx bar-odb.cxx". If that doesn't work for you for some reason, you may want to look into the --at-once ODB compiler option. This way you can generate one giant -odb.cxx file for all your header files. Boris From timo at rothenpieler.org Wed Sep 3 11:49:50 2014 From: timo at rothenpieler.org (Timo Rothenpieler) Date: Wed Sep 3 11:49:53 2014 Subject: [odb-users] error: redefinition of =?windows-1252?Q?=91bool_?= =?windows-1252?Q?odb=3A=3Acreate=5Fschema?= In-Reply-To: <6A159870-7000-470F-A1C6-6E031ED3D007@gmail.com> References: <45E0E325-82AC-4E21-B1F4-1F652C5510D4@gmail.com> <388BE032-D93C-49B5-81F7-3CC31651C80C@gmail.com> <20140903073547.GA13628@codesynthesis.com> <6A159870-7000-470F-A1C6-6E031ED3D007@gmail.com> Message-ID: <5407389E.2020209@rothenpieler.org> > Hi Boris, > > I?m a little further along in pinpointing what is causing this. > > I?m using cmake as my build system. In order to only have to change my code and not my CMakeList.txt each time I add a persistable class I?m including the generated -odb.cxx files to my own .cxx files where I?m using that class. > > Apparently this produces the name clash. > > So the my question is why is this producing the name clash? And, is there a way to automatically update my CMakeList.txt based on the output of my ODB build step? > > If desired I can prepare a sample test case. How do you integrate odb with cmake? The find and use module i made automaticaly add the generated cpp files to a sources list variable of your choice, so you only have to maintain a list of headers odb has to run on. See https://github.com/BtbN/OdbCmake for an example and the module. Timo From cresanta at me.com Thu Sep 4 12:34:50 2014 From: cresanta at me.com (Bruce Cresanta) Date: Thu Sep 4 12:42:23 2014 Subject: [odb-users] Prerequisites Message-ID: <43C65CF2-B591-4BD2-84FE-9CEBC4B847B9@me.com> Boris, Just getting to the testing stage of ODB. Using Mac OSX. The gcc compiler for my system wasn?t compiled with plugin support. Having trouble working with a custom compiler. Wondered if you could tell me the highest gcc distro that will work with ODB? I need to compile gcc from source. Tried 4.9.1, but that is bleeding edge. Thanks, Bruce From cresanta at me.com Thu Sep 4 16:38:28 2014 From: cresanta at me.com (Bruce Cresanta) Date: Fri Sep 5 06:14:45 2014 Subject: [odb-users] Re: Prerequisites In-Reply-To: <43C65CF2-B591-4BD2-84FE-9CEBC4B847B9@me.com> References: <43C65CF2-B591-4BD2-84FE-9CEBC4B847B9@me.com> Message-ID: <57140A41-9FA6-4B7D-8F77-60F36BA240F3@me.com> Hi, Got gcc 4.9.1 installed and can configure ODB by specifying CXX=/usr/local/gcc491/bin/g++ Getting the following errors on make? make Making all in odb /Applications/Xcode.app/Contents/Developer/usr/bin/make all-am depbase=`echo cxx-lexer.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ../libtool --tag=CXX --mode=compile /usr/local/gcc491/bin/g++ -DHAVE_CONFIG_H -I'..' -I'..' -I/usr/local/gcc491/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/plugin/include -g -O2 -MT cxx-lexer.lo -MD -MP -MF $depbase.Tpo -c -o cxx-lexer.lo cxx-lexer.cxx &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: /usr/local/gcc491/bin/g++ -DHAVE_CONFIG_H -I.. -I.. -I/usr/local/gcc491/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/plugin/include -g -O2 -MT cxx-lexer.lo -MD -MP -MF .deps/cxx-lexer.Tpo -c cxx-lexer.cxx -fno-common -DPIC -o .libs/cxx-lexer.o In file included from ../odb/gcc-fwd.hxx:10:0, from ../odb/gcc.hxx:8, from cxx-lexer.cxx:5: /usr/local/gcc491/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/plugin/include/coretypes.h:46:9: error: 'HOST_WIDEST_INT' does not name a type typedef HOST_WIDEST_INT gcov_type; ^ /usr/local/gcc491/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/plugin/include/coretypes.h:47:34: error: expected initializer before 'gcov_type_unsigned' typedef unsigned HOST_WIDEST_INT gcov_type_unsigned; ^ cxx-lexer.cxx: In member function 'virtual cpp_ttype cxx_string_lexer::next(std::string&, tree_node**)': cxx-lexer.cxx:266:36: error: 'get_identifier' was not declared in this scope tree id (get_identifier (name)); Not sure why the errors are happening. Can you elaborate? Thanks, Bruce On Sep 4, 2014, at 9:34 AM, Bruce Cresanta wrote: > Boris, > > Just getting to the testing stage of ODB. Using Mac OSX. The gcc compiler for my system wasn?t compiled with plugin support. Having trouble working with a custom compiler. Wondered if you could tell me the highest gcc distro that will work with ODB? I need to compile gcc from source. Tried 4.9.1, but that is bleeding edge. > > Thanks, > > Bruce From cresanta at me.com Fri Sep 5 00:40:59 2014 From: cresanta at me.com (Bruce Cresanta) Date: Fri Sep 5 06:14:45 2014 Subject: [odb-users] Re: Prerequisites In-Reply-To: <57140A41-9FA6-4B7D-8F77-60F36BA240F3@me.com> References: <43C65CF2-B591-4BD2-84FE-9CEBC4B847B9@me.com> <57140A41-9FA6-4B7D-8F77-60F36BA240F3@me.com> Message-ID: <17CBCF24-5E41-4797-94A0-202D4F5637F2@me.com> Boris, Retrograded gcc to 4.8.3? Looking good? Thanks, Bruce On Sep 4, 2014, at 1:38 PM, Bruce Cresanta wrote: > Hi, > > Got gcc 4.9.1 installed and can configure ODB by specifying CXX=/usr/local/gcc491/bin/g++ Getting the following errors on make? > > > make > Making all in odb > /Applications/Xcode.app/Contents/Developer/usr/bin/make all-am > depbase=`echo cxx-lexer.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ > /bin/sh ../libtool --tag=CXX --mode=compile /usr/local/gcc491/bin/g++ -DHAVE_CONFIG_H -I'..' -I'..' -I/usr/local/gcc491/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/plugin/include -g -O2 -MT cxx-lexer.lo -MD -MP -MF $depbase.Tpo -c -o cxx-lexer.lo cxx-lexer.cxx &&\ > mv -f $depbase.Tpo $depbase.Plo > libtool: compile: /usr/local/gcc491/bin/g++ -DHAVE_CONFIG_H -I.. -I.. -I/usr/local/gcc491/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/plugin/include -g -O2 -MT cxx-lexer.lo -MD -MP -MF .deps/cxx-lexer.Tpo -c cxx-lexer.cxx -fno-common -DPIC -o .libs/cxx-lexer.o > In file included from ../odb/gcc-fwd.hxx:10:0, > from ../odb/gcc.hxx:8, > from cxx-lexer.cxx:5: > /usr/local/gcc491/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/plugin/include/coretypes.h:46:9: error: 'HOST_WIDEST_INT' does not name a type > typedef HOST_WIDEST_INT gcov_type; > ^ > /usr/local/gcc491/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/plugin/include/coretypes.h:47:34: error: expected initializer before 'gcov_type_unsigned' > typedef unsigned HOST_WIDEST_INT gcov_type_unsigned; > ^ > cxx-lexer.cxx: In member function 'virtual cpp_ttype cxx_string_lexer::next(std::string&, tree_node**)': > cxx-lexer.cxx:266:36: error: 'get_identifier' was not declared in this scope > tree id (get_identifier (name)); > > Not sure why the errors are happening. Can you elaborate? > > Thanks, > > Bruce > > > > > > On Sep 4, 2014, at 9:34 AM, Bruce Cresanta wrote: > >> Boris, >> >> Just getting to the testing stage of ODB. Using Mac OSX. The gcc compiler for my system wasn?t compiled with plugin support. Having trouble working with a custom compiler. Wondered if you could tell me the highest gcc distro that will work with ODB? I need to compile gcc from source. Tried 4.9.1, but that is bleeding edge. >> >> Thanks, >> >> Bruce > From boris at codesynthesis.com Fri Sep 5 06:26:53 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 5 06:23:53 2014 Subject: [odb-users] Re: Prerequisites In-Reply-To: <17CBCF24-5E41-4797-94A0-202D4F5637F2@me.com> References: <43C65CF2-B591-4BD2-84FE-9CEBC4B847B9@me.com> <57140A41-9FA6-4B7D-8F77-60F36BA240F3@me.com> <17CBCF24-5E41-4797-94A0-202D4F5637F2@me.com> Message-ID: Hi Bruce, Bruce Cresanta writes: > The gcc compiler for my system wasn?t compiled with plugin support. > Having trouble working with a custom compiler. I am not sure what you mean by "custom compiler", but have you tried the ODB compiler binary for MacOS X (it includes a private copy of GCC). Is this what's giving your trouble? If so, could you elaborate on what kind of trouble? I would like to make sure this works since that's the most straightforward way of getting started with ODB on Mac OS. > Retrograded gcc to 4.8.3. Looking good. Yes, there were some changes in GCC 4.9 that broke ODB 2.3.0 (it was release before 4.9 and while we tested against early pre-releases of GCC, things still got changed afterwards). While you should be able to use ODB 2.3.0 with GCC 4.9.x by applying these patches: http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=97281fd4454596834142fa43f83af38695b38e5b http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=4617f8f3b0c07a40d46bb04ab4b66e8446a8250b http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=4f54aea0a7a1735502c845524ae5d650eb630181 I don't think you will miss much by sticking with 4.8. Boris From cresanta at me.com Fri Sep 5 06:42:43 2014 From: cresanta at me.com (Bruce Cresanta) Date: Fri Sep 5 06:55:28 2014 Subject: [odb-users] Re: Prerequisites In-Reply-To: References: <43C65CF2-B591-4BD2-84FE-9CEBC4B847B9@me.com> <57140A41-9FA6-4B7D-8F77-60F36BA240F3@me.com> <17CBCF24-5E41-4797-94A0-202D4F5637F2@me.com> Message-ID: <06FE9E5C-ECF9-4C13-BA51-4D14D06F6409@me.com> Boris, The Xcode toolchain does not have a gcc with ?enable-plugin configured. I compiled 2 compilers yesterday in the hope that I could simply compile odb. Tried gcc4.9.1 and had a lot of trouble. So? I tried gcc4.8.3 and that worked. I had to pass the g++ binary for gcc 4.8.3 to ./configure for odb. like this: cd /odb-2.3.0 ./configure CXX=/path/to/gcc483/bin/g++ Worked on the first pass. In order to compile gcc, I did the following in the gcc4.8.3 source distribution. ./configure --prefix=/usr/local/gcc483 --enable-plugin You want to use ?prefix to keep the gcc toolchain in it?s own directory once installed. Thanks Bruce On Sep 5, 2014, at 3:26 AM, Boris Kolpackov wrote: > Hi Bruce, > > Bruce Cresanta writes: > >> The gcc compiler for my system wasn?t compiled with plugin support. >> Having trouble working with a custom compiler. > > I am not sure what you mean by "custom compiler", but have you tried > the ODB compiler binary for MacOS X (it includes a private copy of > GCC). Is this what's giving your trouble? If so, could you elaborate > on what kind of trouble? I would like to make sure this works since > that's the most straightforward way of getting started with ODB on > Mac OS. > > >> Retrograded gcc to 4.8.3. Looking good. > > Yes, there were some changes in GCC 4.9 that broke ODB 2.3.0 (it was > release before 4.9 and while we tested against early pre-releases of > GCC, things still got changed afterwards). > > While you should be able to use ODB 2.3.0 with GCC 4.9.x by applying > these patches: > > http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=97281fd4454596834142fa43f83af38695b38e5b > http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=4617f8f3b0c07a40d46bb04ab4b66e8446a8250b > http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=4f54aea0a7a1735502c845524ae5d650eb630181 > > I don't think you will miss much by sticking with 4.8. > > Boris From boris at codesynthesis.com Fri Sep 5 07:25:20 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 5 07:22:21 2014 Subject: [odb-users] Re: Prerequisites In-Reply-To: <06FE9E5C-ECF9-4C13-BA51-4D14D06F6409@me.com> References: <43C65CF2-B591-4BD2-84FE-9CEBC4B847B9@me.com> <57140A41-9FA6-4B7D-8F77-60F36BA240F3@me.com> <17CBCF24-5E41-4797-94A0-202D4F5637F2@me.com> <06FE9E5C-ECF9-4C13-BA51-4D14D06F6409@me.com> Message-ID: Hi Bruce, Bruce Cresanta writes: > The Xcode toolchain does not have a gcc with --enable-plugin configured. > I compiled 2 compilers yesterday in the hope that I could simply compile > odb... The point I was trying to make is that there is the ODB compiler binary (odb-2.3.0-i686-macosx.tar.bz2) that already includes a private copy of GCC with plugin support enabled. So you could have just downloaded and used that without having to build GCC nor ODB (compiler) yourself. But thanks for providing further details on how to build custom GCC for MacOS and then use it with ODB. Boris From cresanta at me.com Fri Sep 5 07:23:38 2014 From: cresanta at me.com (Bruce Cresanta) Date: Fri Sep 5 07:40:37 2014 Subject: [odb-users] Re: Prerequisites In-Reply-To: References: <43C65CF2-B591-4BD2-84FE-9CEBC4B847B9@me.com> <57140A41-9FA6-4B7D-8F77-60F36BA240F3@me.com> <17CBCF24-5E41-4797-94A0-202D4F5637F2@me.com> <06FE9E5C-ECF9-4C13-BA51-4D14D06F6409@me.com> Message-ID: Hi Boris, I found that option out much later. I like to go from sources whenever possible. Bruce On Sep 5, 2014, at 4:25 AM, Boris Kolpackov wrote: > Hi Bruce, > > Bruce Cresanta writes: > >> The Xcode toolchain does not have a gcc with --enable-plugin configured. >> I compiled 2 compilers yesterday in the hope that I could simply compile >> odb... > > The point I was trying to make is that there is the ODB compiler binary > (odb-2.3.0-i686-macosx.tar.bz2) that already includes a private copy of > GCC with plugin support enabled. So you could have just downloaded and > used that without having to build GCC nor ODB (compiler) yourself. > > But thanks for providing further details on how to build custom GCC > for MacOS and then use it with ODB. > > Boris From Anthony.Ha at ga-asi.com Fri Sep 5 18:33:45 2014 From: Anthony.Ha at ga-asi.com (Ha, Anthony) Date: Sat Sep 6 04:52:04 2014 Subject: [odb-users] odb - stored procedure issue Message-ID: <6E2EFD5F6191A3438E08507BE119EC90183256A02A@ASGEXCH02.ga.com> Hi, Appreciate any pointer on getting stored procedure called from ODB "view" to work on mySql We have many legacy stored procedures and hope to move forward using ORM but being able to continue using legacy SQL. I'm not even sure I'm taking the right approach but I have seen this issue mentioned once at stackoverflow and trying to use that as a starting point. What I have done: * Goal : call a stored procedure from ODB "view" * Stored procedure: example from mysqltutorial * Loaded the test database "classicmodels" * Test calling the SP from the mysql> promt - success * Created a simple example from the "view/employee" Tried to build the example and got the following compiling error: make -k odb -d mysql --generate-schema --generate-query -s -q -p boost/date-time --default-pointer std::tr1::shared_ptr employee.hxx g++ -DDATABASE_MYSQL -W -Wall -Wno-unknown-pragmas -O3 -c driver.cxx -o driver.o driver.cxx: In function 'int main(int, char**)': driver.cxx:29:18: error: invalid use of 'class odb::query' Result r( db.query( Query::_val(1) ) ); ^ make: *** [driver.o] Error 1 g++ -DDATABASE_MYSQL -W -Wall -Wno-unknown-pragmas -O3 -c employee-odb.cxx -o employee-odb.o employee-odb.cxx: In static member function 'static odb::access::view_traits_impl::query_base_type odb::access::view_traits_impl::query_statement(const query_base_type&)': employee-odb.cxx:773:32: error: expected ')' before string constant "exec getallproducts" + q";"); ^ make: *** [employee-odb.o] Error 1 make: Target `driver' not remade because of errors. Employee.hxx: #pragma db view query("exec getallproducts(?);") struct StoredProc { int cust_no; std::string cust_name; }; Driver.cxx int main (int argc, char* argv[]) { try { auto_ptr db (create_database (argc, argv)); typedef odb::result Result; typedef odb::query Query; transaction t (db->begin()); Result r( db.query( Query::_val(1) ) ); } catch (const odb::exception& e) { cerr << e.what () << endl; return 1; } } mailto:Anthony.Ha@ga-asi.com [cid:image001.jpg@01CFC91C.EA73D240] -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.jpg Type: image/jpeg Size: 1936 bytes Desc: image001.jpg Url : http://codesynthesis.com/pipermail/odb-users/attachments/20140905/256b1541/image001.jpg From boris at codesynthesis.com Sat Sep 6 15:46:12 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Sep 6 15:43:17 2014 Subject: [odb-users] See you at CppCon 2014 Message-ID: Hi, I am attending CppCon 2014[1] and giving a two part talk on ODB[2][3]. If anyone from this list is also attending, I would be happy to meet you! [1] http://cppcon.org [2] http://sched.co/TBcTky [3] http://sched.co/TvkRM9 Boris From boris at codesynthesis.com Sun Sep 7 18:02:10 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Sep 7 17:59:05 2014 Subject: [odb-users] odb - stored procedure issue In-Reply-To: <6E2EFD5F6191A3438E08507BE119EC90183256A02A@ASGEXCH02.ga.com> References: <6E2EFD5F6191A3438E08507BE119EC90183256A02A@ASGEXCH02.ga.com> Message-ID: Hi Anthony, Ha, Anthony writes: > Appreciate any pointer on getting stored procedure called from ODB > "view" to work on mySql The bad news is MySQL stored procedures require some extra work in the runtime (i.e., one cannot just handle them like SELECT, which is the case in, say, PostgreSQL and SQL Server). The good news is I've added this support (will be in the next ODB release) and also described how everything works (and the limitations) in the ODB manual. So what I suggest you do is check the new section in the manual to see if the new support is sufficient for your use case. I've uploaded the updated .pdf here: http://codesynthesis.com/~boris/tmp/odb/odb-manual.pdf Look at section 17.7. If this looks good, then you can let me know which platform you are on and I can build you pre-release packages with this support. Boris From cresanta at me.com Mon Sep 8 09:26:24 2014 From: cresanta at me.com (Bruce Cresanta) Date: Mon Sep 8 23:29:49 2014 Subject: [odb-users] Basic concept. Message-ID: <1914D818-C1BC-435C-A962-907DC06FC990@me.com> Hello, I?ve made it through the documentation. I?m stuck on a trivial concept. I want to create a one-to-many relationship between two tables. I want to add a record on the one side with an auto id. How do you capture this id on insert? Bruce From cresanta at me.com Mon Sep 8 09:31:11 2014 From: cresanta at me.com (Bruce Cresanta) Date: Mon Sep 8 23:29:50 2014 Subject: [odb-users] Order and Group by... Message-ID: Hello, How do you order and group by using ODB query syntax? Bruce From cresanta at me.com Mon Sep 8 09:33:27 2014 From: cresanta at me.com (Bruce Cresanta) Date: Mon Sep 8 23:29:50 2014 Subject: [odb-users] Re: Basic concept. In-Reply-To: <1914D818-C1BC-435C-A962-907DC06FC990@me.com> References: <1914D818-C1BC-435C-A962-907DC06FC990@me.com> Message-ID: Never mind, Looked more closely at the persist overloads. On Sep 8, 2014, at 6:26 AM, Bruce Cresanta wrote: > Hello, > > I?ve made it through the documentation. I?m stuck on a trivial concept. I want to create a one-to-many relationship between two tables. I want to add a record on the one side with an auto id. How do you capture this id on insert? > > Bruce From boris at codesynthesis.com Mon Sep 8 23:45:35 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 8 23:42:29 2014 Subject: [odb-users] Order and Group by... In-Reply-To: References: Message-ID: Hi Bruce, Bruce Cresanta writes: > How do you order and group by using ODB query syntax? You would use a view to run an aggregate query. See Section 10.4, "View Query Conditions" for details. Also the 'view' example in the odb-examples package shows how to do GROUP BY. Boris From cresanta at me.com Tue Sep 9 10:01:02 2014 From: cresanta at me.com (Bruce Cresanta) Date: Tue Sep 9 11:31:11 2014 Subject: [odb-users] Basic issue Message-ID: <3A732E59-C84E-4F2C-A073-B98D13BD1687@me.com> Boris, I?ve looked at composite types. These seem to be packed into one column. I write schema?s by hand normally and I have a need for a composite primary key across two columns with foreign key constraints to two other tables (the one sides). How, if possible, do you do this? The answer to this question will tell me if I can actually use your product. I also have a need for Left and Right Outer Joins. Thanks, Bruce From Anthony.Ha at ga-asi.com Tue Sep 9 08:32:10 2014 From: Anthony.Ha at ga-asi.com (Ha, Anthony) Date: Tue Sep 9 12:59:21 2014 Subject: [odb-users] odb - stored procedure issue In-Reply-To: References: <6E2EFD5F6191A3438E08507BE119EC90183256A02A@ASGEXCH02.ga.com> Message-ID: <6E2EFD5F6191A3438E08507BE119EC9018BE48E9E8@ASGEXCH02.ga.com> Hi Boris, Thanks very much for adding this support. We're using Redhat: RHEL 6.5 mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1 We can upgrade mysql to whatever version that ODB supports. Appreciate a pre-build package. Anthony -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Sunday, September 07, 2014 3:02 PM To: Ha, Anthony Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] odb - stored procedure issue Hi Anthony, Ha, Anthony writes: > Appreciate any pointer on getting stored procedure called from ODB > "view" to work on mySql The bad news is MySQL stored procedures require some extra work in the runtime (i.e., one cannot just handle them like SELECT, which is the case in, say, PostgreSQL and SQL Server). The good news is I've added this support (will be in the next ODB release) and also described how everything works (and the limitations) in the ODB manual. So what I suggest you do is check the new section in the manual to see if the new support is sufficient for your use case. I've uploaded the updated .pdf here: http://codesynthesis.com/~boris/tmp/odb/odb-manual.pdf Look at section 17.7. If this looks good, then you can let me know which platform you are on and I can build you pre-release packages with this support. Boris From boris at codesynthesis.com Tue Sep 9 13:23:54 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Sep 9 13:21:40 2014 Subject: [odb-users] Basic issue In-Reply-To: <3A732E59-C84E-4F2C-A073-B98D13BD1687@me.com> References: <3A732E59-C84E-4F2C-A073-B98D13BD1687@me.com> Message-ID: Hi Bruce, Bruce Cresanta writes: > I?ve looked at composite types. These seem to be packed into one column. Where do you get your information? Here is the first paragraph from the section describing composite value types (Section 7.2, "Composite Value Types"): "A composite value type is a class or struct type that is mapped to more than one database column." > I write schema?s by hand normally and I have a need for a composite > primary key across two columns with foreign key constraints to two > other tables (the one sides). Section 7.2.1, "Composite Object Ids". If I understood you correctly, you want to have a composite primary key that is also two foreign keys. In ODB that would translate to a composite object id which consists of two pointers to objects. This is not supported and is also the kind of complexity that we would like not to get into. However, remember, pointers to objects is just an "OO" way to represent relationships. Nothing prevents you from "stepping one level down" and modelling the relationship as just a pair of object ids: #pragma db value struct table_a_id { int table_b_id; int table_c_id; }; #pragma db object struct table_a { #pragma db id table_a_id id; }; You can then load the pointed-to objects given their ids: table_a_id id = ...; shared_ptr ta (db.load (id)); shared_ptr tb (db.load (ta.id.table_b_id)); shared_ptr tc (db.load (ta.id.table_c_id)); In fact, if you want to be fancy, you can emulate the OO pointers to objects by having transient pointers in the class and then using database operation callbacks to automatically persist/load/update these pointers. > The answer to this question will tell me if I can actually use your > product. If you can't use ODB, that's fine. We are not trying to be all things to all people. > I also have a need for Left and Right Outer Joins. You can do pretty much anything with a view. At the lowest level you can spell out literal SQL query with ODB just providing help for parameter binding and result set extraction. Boris From adnan at rihan.fr Sat Sep 13 13:23:45 2014 From: adnan at rihan.fr (Adnan RIHAN) Date: Sat Sep 13 13:24:10 2014 Subject: [odb-users] "unable to extract profile paths" Message-ID: Hi everybody, I?m on OS X 10.10 (Yosemite), and I?ve reinstalled ODB (compiler), libodb, libodb-qt and libodb-sqlite. Now I?m trying to compile one file, and I have an error: "unable to extract profile paths". Did I miss something ? -- 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 Sat Sep 13 14:43:28 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Sep 13 14:40:20 2014 Subject: [odb-users] "unable to extract profile paths" In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > I?m on OS X 10.10 (Yosemite), and I?ve reinstalled ODB (compiler), > libodb, libodb-qt and libodb-sqlite. Did you build the ODB compiler yourself or did you use the pre-built ODB compiler binary for Mac OS? > Now I?m trying to compile one file, and I have an error: "unable to > extract profile paths". This normally means that the ODB compiler was unable to execute the g++ executable. And the way to figure out why this happens depends on the answer to the above questions. Generally: 1. If you are using the pre-built ODB package, then try to run g++ that comes with it on some test C++ file (e.g., a "Hello World" program): odb-2.3.0-i686-macosx/lib/odb/i686-apple-darwin8/bin/g++ -c hello.cpp And see if it works. If it fails, try again with the -v option and then send the complete diagnostics that you see. 2. If you built your own ODB/GCC, then try to specify the g++ executable that ODB should use on the command line, for example: odb -x /path/to/g++ ... Boris From nima0102 at gmail.com Sat Sep 13 14:43:40 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Sat Sep 13 14:43:49 2014 Subject: [odb-users] Error in compile Message-ID: Hi everybody, This is my first email to this mailing list. I intend use ODB in my project.(will be a open source network tools). So I am checking and writing some test program. I could compile sample code without any issue. In the structure of my code, I have 2 classes, person and contact(the attached). The person class contains contact class as a member. I did compile the header of classes with "odb" compile. but during compiling of "person-odb.cxx" I have got the error below: ----------------------------------------------------------- In file included from /usr/local/include/odb/database.hxx:499:0, from /usr/local/include/odb/mysql/database.hxx:14, from person-odb.cxx:14: /usr/local/include/odb/database.ixx: In instantiation of 'typename odb::object_traits::pointer_type odb::database::find_(const typename odb::object_traits::id_type&) [with T = Contact; odb::database_id DB = (odb::database_id)0u; typename odb::object_traits::pointer_type = Contact*; typename odb::object_traits::id_type = long unsigned int]': /usr/local/include/odb/database.txx:82:38: required from 'typename odb::object_traits::pointer_type odb::database::load_(const typename odb::object_traits::id_type&) [with T = Contact; odb::database_id DB = (odb::database_id)0u; typename odb::object_traits::pointer_type = Contact*; typename odb::object_traits::id_type = long unsigned int]' /usr/local/include/odb/mysql/database.ixx:100:36: required from 'typename odb::object_traits::pointer_type odb::mysql::database::load(const typename odb::object_traits::id_type&) [with T = Contact; typename odb::object_traits::pointer_type = Contact*; typename odb::object_traits::id_type = long unsigned int]' person-odb.cxx:381:42: required from here /usr/local/include/odb/database.ixx:570:54: error: no matching function for call to 'odb::object_traits_impl::find(odb::database&, const id_type&)' /usr/local/include/odb/database.ixx:570:54: note: candidate is: In file included from person-odb.hxx:18:0, from person-odb.cxx:7: contact-odb.hxx:247:5: note: static bool odb::access::object_traits_impl::find(odb::database&, const id_type&, odb::access::object_traits::object_type&) contact-odb.hxx:247:5: note: candidate expects 3 arguments, 2 provided --------------------------------------------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: contact.h Type: text/x-chdr Size: 471 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20140913/16ee9bf7/contact.h -------------- next part -------------- A non-text attachment was scrubbed... Name: person.h Type: text/x-chdr Size: 536 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20140913/16ee9bf7/person.h From boris at codesynthesis.com Sat Sep 13 17:24:01 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Sep 13 17:20:54 2014 Subject: [odb-users] Error in compile In-Reply-To: References: Message-ID: Hi Nima, nima chavooshi writes: > /usr/local/include/odb/database.ixx:570:54: error: no matching function for > call to 'odb::object_traits_impl (odb::database_id)0u>::find(odb::database&, const id_type&)' If you look at the line of code that this error points to, just above it you will see this comment: // Compiler error pointing here? Perhaps the object doesn't have the // default constructor? // Looking at your Contact class, it indeed doesn't have a default constructor. When you add it, you can make it private since you have a friend declaration. You can read more on this requirement in Section 3.2, "Declaring Persistent Objects and Values" in the ODB manual. Boris From adnan at rihan.fr Sun Sep 14 03:53:09 2014 From: adnan at rihan.fr (Adnan RIHAN) Date: Sun Sep 14 03:53:37 2014 Subject: [odb-users] "unable to extract profile paths" In-Reply-To: References: Message-ID: Le 13 septembre 2014 ? 20:40:31, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) a ?crit: > Did you build the ODB compiler yourself or did you use the pre-built > ODB compiler binary for Mac OS? I?ve downloaded the pre-built, as before I update to 10.10 > 1. If you are using the pre-built ODB package, then try to run g++ > that comes with it on some test C++ file (e.g., a "Hello World" > program): > > odb-2.3.0-i686-macosx/lib/odb/i686-apple-darwin8/bin/g++ -c hello.cpp > > And see if it works. If it fails, try again with the -v option and > then send the complete diagnostics that you see. It segfaults with odb's included ??g++??, but not with my XCode's one: > ? ?hello ?/usr/local/lib/odb/i686-apple-darwin8/bin/g++ -c -v driver.cxx > [1] ? ?90424 segmentation fault ?/usr/local/lib/odb/i686-apple-darwin8/bin/g++ -c -v driver.cxx > 2. If you built your own ODB/GCC, then try to specify the g++ executable > that ODB should use on the command line, for example: > > odb -x /path/to/g++ ... I don?t know if it?s useful, but I tried that line specifying my Xcode?s g++ executable, and I got other errors:?http://pastebin.com/KugamGAV I?m updating Xcode to see if there is a change. -- 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 nima0102 at gmail.com Sun Sep 14 13:04:50 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Sun Sep 14 13:04:59 2014 Subject: [odb-users] Error in compile In-Reply-To: References: Message-ID: Dear Boris, Thanks for your reply. But I have defined a default constructor. I attached the header of classes. On Sun, Sep 14, 2014 at 1:54 AM, Boris Kolpackov wrote: > Hi Nima, > > nima chavooshi writes: > > > /usr/local/include/odb/database.ixx:570:54: error: no matching function > for > > call to 'odb::object_traits_impl > (odb::database_id)0u>::find(odb::database&, const id_type&)' > > If you look at the line of code that this error points to, just above > it you will see this comment: > > // Compiler error pointing here? Perhaps the object doesn't have the > // default constructor? > // > > Looking at your Contact class, it indeed doesn't have a default > constructor. When you add it, you can make it private since you > have a friend declaration. > > You can read more on this requirement in Section 3.2, "Declaring > Persistent Objects and Values" in the ODB manual. > > Boris > From boris at codesynthesis.com Sun Sep 14 13:17:44 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Sep 14 13:14:36 2014 Subject: [odb-users] "unable to extract profile paths" In-Reply-To: References: Message-ID: <20140914171744.GA26811@codesynthesis.com> Hi Adnan, Adnan RIHAN writes: > I?ve downloaded the pre-built, as before I update to 10.10 > > [...] > > It segfaults with odb's included g++ [...] Ok, this is interesting. We build both ODB and GCC on a really old MacOS X version so that it works everywhere. Until now this worked quite well. So I will have to look into this. Can you tell me what was the version of MacOS before you upgraded (and where ODB worked fine)? > I don?t know if it?s useful, but I tried that line specifying my > Xcode?s g++ executable, and I got other errors 'g++' that ships with XCode is actually Clang. This won't work with ODB. So the two options are: 1. Wait for me to figure out and hopefully fix the pre-built package. I won't be able to look into this until the end of the week (I am currently travelling from CppCon). 2. Build GCC and ODB from source yourself. As was recently reported by several users, this is actually quite easy. Here are the instructions from Bruce Cresanta: http://www.codesynthesis.com/pipermail/odb-users/2014-September/002055.html Just to expand on building from source, make sure you are using GCC 4.8.X and not 4.9.X (vanilla ODB 2.3.0 is not compatible with GCC 4.9; this is fixed for the next release and there are patches but I don't think it is worth the trouble patching 2.3.0 in most cases). Let's say you want to install ODB to /opt/odb-2.3.0. First, download and build GCC (we install it to /opt/gcc-4.8.3): ./configure --prefix=/opt/gcc-4.8.3 --enable-plugin make sudo make install At this point check that the GCC compiler is functional by trying to compile a test program: /opt/gcc-4.8.3/bin/g++ -c hello.cpp Then download and build the ODB compiler: ./configure CXX=/opt/gcc-4.8.3/bin/g++ make sudo make install Of course you can change the installation directories to something else (e.g., /usr/local). Let us know how it goes. Boris From boris at codesynthesis.com Sun Sep 14 13:21:08 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Sep 14 13:17:59 2014 Subject: [odb-users] Error in compile In-Reply-To: References: Message-ID: Hi Nima, nima chavooshi writes: > But I have defined a default constructor. I attached the header of > classes. Looking at your Contact class I see only this constructor: Contact(string Addr,string PhoneNum); This is not the default constructor. The default constructor is the one that can be called without any arguments. In your case, simply add this to Contact: private: Contact() {} You will also want to do the same for your other class(es). Boris From adnan at rihan.fr Sun Sep 14 13:28:56 2014 From: adnan at rihan.fr (Adnan RIHAN) Date: Sun Sep 14 13:29:22 2014 Subject: [odb-users] "unable to extract profile paths" In-Reply-To: <20140914171744.GA26811@codesynthesis.com> References: <20140914171744.GA26811@codesynthesis.com> Message-ID: Le 14 septembre 2014 ? 19:14:38, Boris Kolpackov (boris@codesynthesis.com) a ?crit: Can you tell me what? was the version of MacOS before you upgraded (and where ODB worked? fine)?? I was on 10.9 (Mavericks), with Xcode 5 I think. It worked well without doing anything special. 'g++' that ships with XCode is actually Clang. This won't work with? ODB.? Yea right... So the two options are:? 1. Wait for me to figure out and hopefully fix the pre-built? package. I won't be able to look into this until the end? of the week (I am currently travelling from CppCon). It won?t hurt if you look into it ;) 2. Build GCC and ODB from source yourself.? http://www.codesynthesis.com/pipermail/odb-users/2014-September/002055.html Just to expand on building from source, make sure you are using? GCC 4.8.X and not 4.9.X First,?download and build GCC (we install it to /opt/gcc-4.8.3):? ./configure --prefix=/opt/gcc-4.8.3 --enable-plugin? make? sudo make install? At this point check that the GCC compiler is functional by? trying to compile a test program:? /opt/gcc-4.8.3/bin/g++ -c hello.cpp? Then download and build the ODB compiler:? ./configure CXX=/opt/gcc-4.8.3/bin/g++? make? sudo make install? I will try it and keep you updated. --? 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 nima0102 at gmail.com Sun Sep 14 14:16:37 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Sun Sep 14 14:16:45 2014 Subject: [odb-users] Error in compile In-Reply-To: References: Message-ID: Hi Boris, Thanks a lot for your assistance on this issue. I could compile without any issue On Sun, Sep 14, 2014 at 9:51 PM, Boris Kolpackov wrote: > Hi Nima, > > nima chavooshi writes: > > > But I have defined a default constructor. I attached the header of > > classes. > > Looking at your Contact class I see only this constructor: > > Contact(string Addr,string PhoneNum); > > This is not the default constructor. The default constructor is the > one that can be called without any arguments. In your case, simply > add this to Contact: > > private: > Contact() {} > > You will also want to do the same for your other class(es). > > Boris > From nima0102 at gmail.com Sun Sep 14 15:19:27 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Sun Sep 14 15:19:35 2014 Subject: [odb-users] Pointer as a member of Class Message-ID: Hi In my test program, I created a class that contains a pointer to another class as a member. I compiled with odb and imported related schema to DB and compile my main program. The pointer member is not inserted correctly to associated table on DB and just inserted a big number in DB and the table of another class is not inserted any data!! If ODB supports a pointer as a member and could map it to db data type, please kindly guide me. Best Regards, Nima Chavoshi From quentindeldycke at gmail.com Mon Sep 15 09:58:26 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Mon Sep 15 09:58:35 2014 Subject: [odb-users] Print SQL statement before they are sent to server Message-ID: Hi, I have a problem with a request where it fails with error: 1054. My request is quite complicated. And i would like to have a trace before it is sent to the server. Is this possible? I have enabled trace as in chapter 3.13. but it is not shown! Is there any way to be sure my request is print before it is sent to the connector / server? -- Deldycke Quentin From boris at codesynthesis.com Mon Sep 15 10:02:55 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 15 09:59:54 2014 Subject: [odb-users] Pointer as a member of Class In-Reply-To: References: Message-ID: Hi Nima, nima chavooshi writes: > In my test program, I created a class that contains a pointer to another > class as a member. I compiled with odb and imported related schema to DB > and compile my main program. The pointer member is not inserted correctly > to associated table on DB and just inserted a big number in DB and the > table of another class is not inserted any data!! What you are probably expecting is for ODB to automatically persist the pointed-to object (AKA cascading persist). ODB doesn't do that. With ODB we tried to stick to the "one ORM operation translates to one database operation" design as closely as possible. So what you need to do to make this work is to first persist the pointed-to object and then the objected itself. Something along these lines: person p = ... db.persist (p->contact); db.persists (p); > If ODB supports a pointer as a member and could map it to db data > type, please kindly guide me. All this is discussed in the relevant parts of the ODB manual. Boris From boris at codesynthesis.com Mon Sep 15 10:21:16 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 15 10:18:14 2014 Subject: [odb-users] Print SQL statement before they are sent to server In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > I have a problem with a request where it fails with error: 1054. > My request is quite complicated. And i would like to have a trace > before it is sent to the server. Is this possible? I have enabled trace > as in chapter 3.13. but it is not shown! The reason it is not printed is because the error is probably detected during preparation, not execution. And the default stderr_tracer only traces statement executions. So what you can do is create your own tracer that prints the statements being prepared. Something along these lines: #include struct diag_tracer: odb::tracer { virtual void prepare (odb::connection&, const odb::statement& s) { cerr << "PREPARE " << s.text () << endl; } virtual void execute (odb::connection&, const char* statement) { cerr << statement << endl; } }; I've also added an entry to our TODO to support this with stderr_tracer somehow since this is probably a fairly common scenario. Boris From quentindeldycke at gmail.com Mon Sep 15 10:47:07 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Mon Sep 15 10:47:14 2014 Subject: [odb-users] Print SQL statement before they are sent to server In-Reply-To: References: Message-ID: Boris, I implemented this class. But it sill fails without any error... If i modify my request to remove most of my 'WHERE' i can see the different queries. But it still doesn't print when the execution fails! Yes, i think it is best to print at both moments. -- Deldycke Quentin On 15 September 2014 16:21, Boris Kolpackov wrote: > Hi Quentin, > > Quentin Deldycke writes: > > > I have a problem with a request where it fails with error: 1054. > > My request is quite complicated. And i would like to have a trace > > before it is sent to the server. Is this possible? I have enabled trace > > as in chapter 3.13. but it is not shown! > > The reason it is not printed is because the error is probably detected > during preparation, not execution. And the default stderr_tracer only > traces statement executions. > > So what you can do is create your own tracer that prints the statements > being prepared. Something along these lines: > > #include > > struct diag_tracer: odb::tracer > { > virtual void > prepare (odb::connection&, const odb::statement& s) > { > cerr << "PREPARE " << s.text () << endl; > } > > virtual void > execute (odb::connection&, const char* statement) > { > cerr << statement << endl; > } > }; > > I've also added an entry to our TODO to support this with stderr_tracer > somehow since this is probably a fairly common scenario. > > Boris > From boris at codesynthesis.com Mon Sep 15 14:40:36 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 15 14:37:33 2014 Subject: [odb-users] Print SQL statement before they are sent to server In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > I implemented this class. But it sill fails without any error... > If i modify my request to remove most of my 'WHERE' i can see the different > queries. But it still doesn't print when the execution fails! Ok, I think I know what the problem is. Can you confirm that you are using MySQL? Boris From quentindeldycke at gmail.com Mon Sep 15 15:13:13 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Mon Sep 15 15:13:24 2014 Subject: [odb-users] Print SQL statement before they are sent to server In-Reply-To: References: Message-ID: Boris, I do use mysql (mariadb from rhel7). It is quite annoying, because I can see working statement but not failing ones... I can give you exact version tomorrow... Le 15 sept. 2014 20:37, "Boris Kolpackov" a ?crit : > Hi Quentin, > > Quentin Deldycke writes: > > > I implemented this class. But it sill fails without any error... > > If i modify my request to remove most of my 'WHERE' i can see the > different > > queries. But it still doesn't print when the execution fails! > > Ok, I think I know what the problem is. Can you confirm that you are > using MySQL? > > Boris > From nima0102 at gmail.com Tue Sep 16 01:14:50 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Tue Sep 16 01:14:59 2014 Subject: [odb-users] Pointer as a member of Class In-Reply-To: References: Message-ID: Hi Boris, Thanks a lot for your attention. I think I could not explain what I expect. Please kindly see my classes: ////////////////////////////////Person///////////////// #pragma db object class Person { private: #pragma db id auto unsigned long id_; int Age; string FirstName; string LastName; Contact * ContactPerson; public: friend class odb::access; Person(int AgeNumber,string FName,string LName,string Addr,string PhoneNum); ~Person(); void Get(); }; /////////////////////////////Person//////////////////////// ////////////////////////////Contact///////////////////////// #pragma db object class Contact { private: friend class odb::access; public: #pragma db id auto unsigned long id_; string Address; string PhoneNumber; Contact(string Addr,string PhoneNum); const char * GetAddr(); const char * GetPhone(); }; /////////////////////////Contact///////////////////////// And also I doubt about generated schema, because there is no any "REFERENCE" keyword in schema then there is no defined relationship between 2 tables. On Mon, Sep 15, 2014 at 6:32 PM, Boris Kolpackov wrote: > Hi Nima, > > nima chavooshi writes: > > > In my test program, I created a class that contains a pointer to another > > class as a member. I compiled with odb and imported related schema to DB > > and compile my main program. The pointer member is not inserted correctly > > to associated table on DB and just inserted a big number in DB and the > > table of another class is not inserted any data!! > > What you are probably expecting is for ODB to automatically persist the > pointed-to object (AKA cascading persist). ODB doesn't do that. With > ODB we tried to stick to the "one ORM operation translates to one > database operation" design as closely as possible. > > So what you need to do to make this work is to first persist the > pointed-to object and then the objected itself. Something along > these lines: > > person p = ... > > db.persist (p->contact); > db.persists (p); > > > > If ODB supports a pointer as a member and could map it to db data > > type, please kindly guide me. > > All this is discussed in the relevant parts of the ODB manual. > > Boris > From boris at codesynthesis.com Tue Sep 16 09:11:13 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Sep 16 09:08:10 2014 Subject: [odb-users] Print SQL statement before they are sent to server In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > I do use mysql (mariadb from rhel7). It is quite annoying, because I can > see working statement but not failing ones... Here is a small patch for libodb-mysql that fixes this (also fixed for the upcoming version): http://scm.codesynthesis.com/?p=odb/libodb-mysql.git;a=patch;h=21c181a6bab942b95e7b8c169fcf14acc0cbb3fd Boris From boris at codesynthesis.com Tue Sep 16 11:48:51 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Sep 16 11:45:48 2014 Subject: [odb-users] Pointer as a member of Class In-Reply-To: References: Message-ID: Hi Nima, nima chavooshi writes: > I think I could not explain what I expect. Please kindly see my classes: You are still not telling me what you do and when you expect! I see your classes and there is nothing particularly wrong with them (there is a lot of room for improvement from the "good C++" point of view, but that's another story). So based on your previous email I am guessing what you are trying to do is something like this: Person p; p.ContactPerson = new Contact; db.persist (p); And expect this call to persist() to store both Person and Contact in the database. If so, then re-read my previous reply, which sums up to: "this is not how ODB works". Instead, you need to do: db.persist (p.ContactPerson); db.persist (p); > And also I doubt about generated schema, because there is no any > "REFERENCE" keyword in schema then there is no defined relationship > between 2 tables. There should be a foreign key defined in the table for Person. Make sure also that you #include your Contact header into Person header. If that doesn't work, tell me exactly what is wrong. And I mean exactly: exact command lines that you use to invoke ODB, the schema that you get, etc. Boris From nima0102 at gmail.com Tue Sep 16 12:58:53 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Tue Sep 16 12:59:02 2014 Subject: [odb-users] Pointer as a member of Class In-Reply-To: References: Message-ID: Hi Boris, Thanks a lot for your attention. About improvement, I agree with you, but this is only a test program.What I am trying in my main program is : Person * PersonObject; PersonObject = new Person(30,"Nima","Chavoshi","Tehran","09127907641"); auto_ptr db (create_database (argc, argv)); transaction t (db->begin ()); t.commit (); About including contact header file to person, I must say, yes. it is already included. Regarding the commands I executed: odb -d mysql --generate-query --generate-schema person.h odb -d mysql --generate-query --generate-schema contact.h Best Regards, Nima Chavoshi On Tue, Sep 16, 2014 at 8:18 PM, Boris Kolpackov wrote: > Hi Nima, > > nima chavooshi writes: > > > I think I could not explain what I expect. Please kindly see my classes: > > You are still not telling me what you do and when you expect! I > see your classes and there is nothing particularly wrong with > them (there is a lot of room for improvement from the "good > C++" point of view, but that's another story). > > So based on your previous email I am guessing what you are trying > to do is something like this: > > Person p; > p.ContactPerson = new Contact; > > db.persist (p); > > And expect this call to persist() to store both Person and > Contact in the database. If so, then re-read my previous > reply, which sums up to: "this is not how ODB works". > Instead, you need to do: > > db.persist (p.ContactPerson); > db.persist (p); > > > > And also I doubt about generated schema, because there is no any > > "REFERENCE" keyword in schema then there is no defined relationship > > between 2 tables. > > There should be a foreign key defined in the table for Person. Make > sure also that you #include your Contact header into Person header. > If that doesn't work, tell me exactly what is wrong. And I mean > exactly: exact command lines that you use to invoke ODB, the > schema that you get, etc. > > Boris > From nima0102 at gmail.com Tue Sep 16 14:59:05 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Tue Sep 16 14:59:14 2014 Subject: [odb-users] Pointer as a member of Class In-Reply-To: References: Message-ID: Hi again, I compiled again my header files with odb and this time, I passed 2 headers at once into odb. The generated schema has foreign key and reference to contact table. On Tue, Sep 16, 2014 at 9:28 PM, nima chavooshi wrote: > Hi Boris, > > Thanks a lot for your attention. About improvement, I agree with you, but > this is only a test program.What I am trying in my main program is : > > Person * PersonObject; > PersonObject = new Person(30,"Nima","Chavoshi","Tehran","09127907641"); > > > auto_ptr db (create_database (argc, argv)); > transaction t (db->begin ()); > t.commit (); > > > About including contact header file to person, I must say, yes. it is > already included. > Regarding the commands I executed: > > odb -d mysql --generate-query --generate-schema person.h > odb -d mysql --generate-query --generate-schema contact.h > > > Best Regards, > Nima Chavoshi > > > On Tue, Sep 16, 2014 at 8:18 PM, Boris Kolpackov > wrote: > >> Hi Nima, >> >> nima chavooshi writes: >> >> > I think I could not explain what I expect. Please kindly see my classes: >> >> You are still not telling me what you do and when you expect! I >> see your classes and there is nothing particularly wrong with >> them (there is a lot of room for improvement from the "good >> C++" point of view, but that's another story). >> >> So based on your previous email I am guessing what you are trying >> to do is something like this: >> >> Person p; >> p.ContactPerson = new Contact; >> >> db.persist (p); >> >> And expect this call to persist() to store both Person and >> Contact in the database. If so, then re-read my previous >> reply, which sums up to: "this is not how ODB works". >> Instead, you need to do: >> >> db.persist (p.ContactPerson); >> db.persist (p); >> >> >> > And also I doubt about generated schema, because there is no any >> > "REFERENCE" keyword in schema then there is no defined relationship >> > between 2 tables. >> >> There should be a foreign key defined in the table for Person. Make >> sure also that you #include your Contact header into Person header. >> If that doesn't work, tell me exactly what is wrong. And I mean >> exactly: exact command lines that you use to invoke ODB, the >> schema that you get, etc. >> >> Boris >> > > From nima0102 at gmail.com Tue Sep 16 15:56:00 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Tue Sep 16 15:56:07 2014 Subject: [odb-users] Pointer as a member of Class In-Reply-To: References: Message-ID: Hi again, Thanks for your guidance. I could resolve the issues. On Tue, Sep 16, 2014 at 11:29 PM, nima chavooshi wrote: > Hi again, > > I compiled again my header files with odb and this time, I passed 2 > headers at once into odb. The generated schema has foreign key and > reference to contact table. > > > > On Tue, Sep 16, 2014 at 9:28 PM, nima chavooshi > wrote: > >> Hi Boris, >> >> Thanks a lot for your attention. About improvement, I agree with you, but >> this is only a test program.What I am trying in my main program is : >> >> Person * PersonObject; >> PersonObject = new Person(30,"Nima","Chavoshi","Tehran","09127907641"); >> >> >> auto_ptr db (create_database (argc, argv)); >> transaction t (db->begin ()); >> t.commit (); >> >> >> About including contact header file to person, I must say, yes. it is >> already included. >> Regarding the commands I executed: >> >> odb -d mysql --generate-query --generate-schema person.h >> odb -d mysql --generate-query --generate-schema contact.h >> >> >> Best Regards, >> Nima Chavoshi >> >> >> On Tue, Sep 16, 2014 at 8:18 PM, Boris Kolpackov > > wrote: >> >>> Hi Nima, >>> >>> nima chavooshi writes: >>> >>> > I think I could not explain what I expect. Please kindly see my >>> classes: >>> >>> You are still not telling me what you do and when you expect! I >>> see your classes and there is nothing particularly wrong with >>> them (there is a lot of room for improvement from the "good >>> C++" point of view, but that's another story). >>> >>> So based on your previous email I am guessing what you are trying >>> to do is something like this: >>> >>> Person p; >>> p.ContactPerson = new Contact; >>> >>> db.persist (p); >>> >>> And expect this call to persist() to store both Person and >>> Contact in the database. If so, then re-read my previous >>> reply, which sums up to: "this is not how ODB works". >>> Instead, you need to do: >>> >>> db.persist (p.ContactPerson); >>> db.persist (p); >>> >>> >>> > And also I doubt about generated schema, because there is no any >>> > "REFERENCE" keyword in schema then there is no defined relationship >>> > between 2 tables. >>> >>> There should be a foreign key defined in the table for Person. Make >>> sure also that you #include your Contact header into Person header. >>> If that doesn't work, tell me exactly what is wrong. And I mean >>> exactly: exact command lines that you use to invoke ODB, the >>> schema that you get, etc. >>> >>> Boris >>> >> >> > From quentindeldycke at gmail.com Wed Sep 17 11:06:33 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Wed Sep 17 11:06:40 2014 Subject: [odb-users] Performance issues for large sets Message-ID: Hi, I have some performance issues with ODB when using very large sets of data. I have a class, itself linked to multiple sub-classes, when i iterate over them, i only acces fields from the 'root' table. I don't understand how odb works at this moment. At the global scope, ODB queries the 'root' object, then at each iterator, ODB select the different sub-objects. Is there any way to: - disable select for sub objects when they are not directly accessed? - force select for sub objects at global scope? Using odb, to make my research, i need only 4 seconds, but at least 0.01 second by iteration on results. (~180 000 results) -- Deldycke Quentin From boris at codesynthesis.com Thu Sep 18 03:31:43 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Sep 18 03:38:05 2014 Subject: [odb-users] Performance issues for large sets In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > I have a class, itself linked to multiple sub-classes, when i iterate over > them, i only acces fields from the 'root' table. > > I don't understand how odb works at this moment. At the global scope, > ODB queries the 'root' object, then at each iterator, ODB select the > different sub-objects. Ok, I assume you are using polymorphic inheritance in which case, for derived classes, their data members are stored in multiple tables. So when you query for a base class, ODB loads you actual, dynamic instances of the objects. To put it another way, when you query for the base, the result of the query is a mixture of various derived objects (returned as their base interface). > Is there any way to: > > - disable select for sub objects when they are not directly accessed? > - force select for sub objects at global scope? I am not sure what you mean by the last item, but the best way to achieve what you want is with ODB views. Not only can you select just the data members from the base class only, you can go a step further and only select a subset of data members that you actually need. See Chapter 10, "Views" in the ODB manual. Also, generally, when you have a performance/database load issue with a query, ODB views are the answer. Boris From boris at codesynthesis.com Thu Sep 18 05:00:45 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Sep 18 05:07:09 2014 Subject: [odb-users] Re: ODB compiler crash In-Reply-To: <9876650174bd4becb890de24c3061fea@QEX.qosmotec.com> References: <3cfd4d880c8a42f9a468be9a35956c50@QEX.qosmotec.com> <9876650174bd4becb890de24c3061fea@QEX.qosmotec.com> Message-ID: <20140918090045.GA20810@codesynthesis.com> Hi Marcel, [I've CC'ed ODB users since others might have similar questions.] Marcel Nehring writes: > 1) For a custom type (boost::posix_time::ptime or boost::posix_time:: > time_period in my example), when I specify the database column type with the > type pragma is there a way to do it on a portable way? For example if I want > to have a text column and I am using Oracle I would write something like > VARCHAR2(X) but when switching to MySQL this would fail. The data types in various databases are inherently non-portable. So what you can do is specify a suitable type for each database that you plan to support. To achieve this ODB allows you to prefix a pragma with the database name, for example: #pragma db oracle:type("VARCHAR2(10)") mysql:type("TEXT") You can still use the unprefixed pragma (which must come before any prefixed ones) as the default, catch-all type for all the other databases: #pragma db type("TEXT") oracle:type("VARCHAR2(10)") One trick that you can do with this catch-all semantics is to specify an invalid type for all the databases that you currently do not support: #pragma db type("BADTYPE") oracle:type("VARCHAR2(10)") This way, if in the future you port to a new database, you will get compile-time errors pointing to the places where you need to decided which types to use. A couple of other notes: 1. You can specify the database type both on the member and C++ type basis (or both), for example: #pragma db value (std::string) oracle:type("VARCHAR2(100)") class person { #pragma db oracle:type("VARCHAR2(10)") std::string first_; std::string last_; // VARCHAR2(100) } 2. Not all (re)mappings from C++ types to database types will work out of the box. For example, if you want to store boost::posix_time::ptime in Oracle as VARCHAR2, then simply specifying one of the above pragmas won't be enough since ODB doesn't know what format it should be in nor does it include code for every such C++/database type combination (which alternative mappings are provided is mentioned in the documentation; for example, for Oracle, ptime can be mapped to DATE in addition to the default TIMESTAMP). But you can always implement such a mapping code yourself as described in this article: http://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/ > 2) The --sql-name-case switch of the ODB compiler does not apply to the > schema version table. Is this by design? Yes, this is by design since the name of this table is used in the ODB runtime (libodb). But you can give this table a custom name. From the ODB compiler command line manual (man pages): --schema-version-table Specify the alternative schema version table name instead of the default schema_version. If you specify this option then you are also expected to manually specify the schema version table name at runtime using the odb::database::schema_version_table() function. The table name can be qualified. > 3) When using the --at-once switch of the ODB compiler I have to manually > provide all persistent class headers by hand? Would it be possible to make > ODB ignore any header file that contains only classes that are not > persisted? One could then simply use *.h or similar and ODB would > automatically filter out the subset to use. At the moment I am using a > custom script to pass the correct filenames to ODB. Yes, this will work with a few caveats: 1. If you are using the at-once mode for schema generation, then the only drawback is longer ODB compilation time since it has to compile these "no-persistent" files. 2. If you are using the at-once mode for C++ code generation (i.e., one huge -odb.cxx file; generally not recommended), then in addition to the above drawback the generated code will also #include the "no- persistent" files which will at least increase the C++ compilation time and may have other consequences depending on what's inside those files. For general understanding, what ODB does under the hood in the at-once mode is simply synthesize a header file that #include's all the input files and then compiles that. Boris From quentindeldycke at gmail.com Thu Sep 18 09:04:08 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Thu Sep 18 09:04:16 2014 Subject: [odb-users] Performance issues for large sets In-Reply-To: References: Message-ID: Hi Boris, You are right, the difference of performance is impressive: - Without views: 50s - With views: 1.2s I will try to modify my system to better use views. -- Deldycke Quentin On 18 September 2014 09:31, Boris Kolpackov wrote: > Hi Quentin, > > Quentin Deldycke writes: > > > I have a class, itself linked to multiple sub-classes, when i iterate > over > > them, i only acces fields from the 'root' table. > > > > I don't understand how odb works at this moment. At the global scope, > > ODB queries the 'root' object, then at each iterator, ODB select the > > different sub-objects. > > Ok, I assume you are using polymorphic inheritance in which case, for > derived classes, their data members are stored in multiple tables. So > when you query for a base class, ODB loads you actual, dynamic instances > of the objects. To put it another way, when you query for the base, the > result of the query is a mixture of various derived objects (returned as > their base interface). > > > > Is there any way to: > > > > - disable select for sub objects when they are not directly accessed? > > - force select for sub objects at global scope? > > I am not sure what you mean by the last item, but the best way to > achieve what you want is with ODB views. Not only can you select > just the data members from the base class only, you can go a step > further and only select a subset of data members that you actually > need. See Chapter 10, "Views" in the ODB manual. > > Also, generally, when you have a performance/database load issue > with a query, ODB views are the answer. > > Boris > From quentindeldycke at gmail.com Thu Sep 18 09:59:01 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Thu Sep 18 09:59:08 2014 Subject: [odb-users] value classes in views Message-ID: Hi, I need to create views using sub-objects. For instance, like this: // a value object class B { std::string test; std::string test2; } // My view class A { B object1; B object2; } Is this possible with odb? I need to keep the form of code for the end user like such: odb::result::iterator it; it->object1.test; -- Deldycke Quentin From mne at qosmotec.com Thu Sep 18 11:14:36 2014 From: mne at qosmotec.com (Marcel Nehring) Date: Thu Sep 18 11:15:49 2014 Subject: [odb-users] AW: ODB compiler crash In-Reply-To: <20140918090045.GA20810@codesynthesis.com> References: <3cfd4d880c8a42f9a468be9a35956c50@QEX.qosmotec.com> <9876650174bd4becb890de24c3061fea@QEX.qosmotec.com> <20140918090045.GA20810@codesynthesis.com> Message-ID: <77c48a6b4e7740119024b38b3d59ce82@QEX.qosmotec.com> Hi Boris, Thank you for your answer. Ad 1) I will use the database name prefixes. I had already written code to map my custom types to their corresponding database types. Ad 2) I saw the --schema-version-table option but it looked a bit too complicated for what I was trying to do. So I think I will stick to the default name. But just for curiosity, what is the rationale to force case-sensitive table names etc. in Oracle DDLs? Some tools seem to have problems with case-sensitive names. Ad 3) Hmm, a few days back when I tried it, it gave me an error for a non-persistent class. However, now it seems to work so this error was probably unrelated to this topic. In addition to these three things I ran into some other problems: 4) When I persist a map ODB will generate a separate table for this mapping. But if the surrounding class is solely a wrapper around the map for insertion, deletion etc. and also a singleton I do not need a separate table. Is it somehow possible to avoid ending up with three different tables here? Two should suffice from a database point of view I think. 5) I have problems persisting nested containers. For example a map of maps. A member like std::map> results in an ODB error message similar to: unable to map C++ type '::MyClass::MyMapTypeDef::mapped_type' used in data member 'm_member' to a Oracle database type 6) Additionally it looks like I did not yet fully understand the whole template class workaround you proposed a few messages earlier. Let's suppose I have two template classes. OuterTemplate and InnerTemplate. Furthermore I want OuterTemplate to have a member of type std::shared_ptr>. I have added typedefs for all template instantiations for both classes and each typedef has the corresponding pragmas. When running the ODB compiler for OuterTemplate.h I get the error: unable to map C++ type '::std::shared_ptr< ::InnerTemplate< int > >' used in data member 'm_member' to a Oracle database type. How can I tell ODB how to persist this class? 7) The source code attached below produces several compile errors in Visual Studio when I try to compile the code generated by ODB. Did I make a mistake or is this a bug? Looks like it can be solved by renaming the member variables to not have the same name. Thank you very much for the support. Regards, Marcel #pragma db value class InnerValueType { public: #pragma db column("") int m_number; }; #pragma db value class OuterValueType { public: #pragma db column("VALUE") InnerValueType m_value; }; #pragma db object class PersistentObj { public: #pragma db id auto long id; #pragma db column("") OuterValueType m_value; }; From nima0102 at gmail.com Thu Sep 18 11:45:58 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Thu Sep 18 11:46:06 2014 Subject: [odb-users] CASCADE on delete/update Message-ID: Hi In my database design, I must use CASCADE on delete or update of some tables. I found the "CASCADE" term only in section 8 "Polymorphism" that odb compiled the code. But I do not use polymorphism in my code. So I do not know how I must write my classes so that odb could add cascade to the generated schema. Please kindly advise me on this matter. Best Regards, Nima Chavoshi From mne at qosmotec.com Thu Sep 18 11:52:43 2014 From: mne at qosmotec.com (Marcel Nehring) Date: Thu Sep 18 11:53:32 2014 Subject: AW: [odb-users] CASCADE on delete/update In-Reply-To: References: Message-ID: Hi Nima, did you have a look at section 14.4.15 of the ODB manual? The on_delete specifier might be what you are looking for. Regards, Marcel From boris at codesynthesis.com Fri Sep 19 03:05:40 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 19 03:12:02 2014 Subject: [odb-users] Performance issues for large sets In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > You are right, the difference of performance is impressive: > > - Without views: 50s > - With views: 1.2s Yes, ODB views are awesome ;-). Thanks for sharing the numbers. Boris From boris at codesynthesis.com Fri Sep 19 03:12:34 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 19 03:18:57 2014 Subject: [odb-users] CASCADE on delete/update In-Reply-To: References: Message-ID: Hi Nima, Marcel Nehring writes: > did you have a look at section 14.4.15 of the ODB manual? The > on_delete specifier might be what you are looking for. Yes, except that this is only available in the pre-release. Here is the pre-release distribution with the Windows binary of the ODB compiler. If you need a binary for some other platform, let me know: http://codesynthesis.com/~boris/tmp/odb/pre-release/ Here is also the pre-release manual where you can find Section 14.4.15: http://codesynthesis.com/~boris/tmp/odb/odb-manual.pdf As for the 'ON UPDATE' clause, this is not really needed in ODB since we assume that object ids (which translate to primary keys) are immutable (which is also generally a good idea). Boris From boris at codesynthesis.com Fri Sep 19 03:22:52 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 19 03:29:13 2014 Subject: [odb-users] value classes in views In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > I need to create views using sub-objects. For instance, like this: > > // a value object > class B > { > std::string test; > std::string test2; > } > > // My view > class A > { > B object1; > B object2; > } If B is a composite value type and is also used in the object on which A is based, then this works out of the box. See Section 10.6, "Other View Features and Limitations" for an example. If some of the above doesn't hold, then it is still possible but will require a bit more effort. See Section 14.4.13, "virtual" for a Swiss army knife of packing/unpacking data members. Boris From quentindeldycke at gmail.com Fri Sep 19 05:24:34 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Fri Sep 19 05:24:40 2014 Subject: [odb-users] value classes in views In-Reply-To: References: Message-ID: Hi Boris, Ok, I started to modify a bit my work, but there is some things i don't understand or do correctly: My situation is as followed: #pragma db value class A { //some int / string and stuff... } #pragma db object class B { //some int / string and stuff... } #pragma db object class C { A classA; shared_ptr classB; } I want to build a view, equivalent to object C (i displayed only usefull data) My view is built like this: #pragma db view object(C) object(B = classB: A::classB) class view_C { A classA; B classB; } But i have a compilation error as followed: error: unable to map C++ type '::B' used in data member 'classB' to a MySQL database type info: use '#pragma db type' to specify the database type -- Deldycke Quentin On 19 September 2014 09:22, Boris Kolpackov wrote: > Hi Quentin, > > Quentin Deldycke writes: > > > I need to create views using sub-objects. For instance, like this: > > > > // a value object > > class B > > { > > std::string test; > > std::string test2; > > } > > > > // My view > > class A > > { > > B object1; > > B object2; > > } > > If B is a composite value type and is also used in the object on which > A is based, then this works out of the box. See Section 10.6, "Other > View Features and Limitations" for an example. > > If some of the above doesn't hold, then it is still possible but will > require a bit more effort. See Section 14.4.13, "virtual" for a Swiss > army knife of packing/unpacking data members. > > Boris > From quentindeldycke at gmail.com Fri Sep 19 05:42:40 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Fri Sep 19 05:42:47 2014 Subject: [odb-users] Performance issues for large sets In-Reply-To: References: Message-ID: Yes, but sadly they doesn't suits all my needs and limit quite much our usage of ODB. Our 'old' system used C-ISAM. It can perform a "while" of 1000 elements in 0.003s - 0.007s. The same request with odb iterate this 1000 elements in 1.3s - 2.6s. The use of odb views allows me to perform this iteration in 0.01s - 0.03s. - But this mode take only the data i want (i don't know exactly the user will need in the root object!) The main advantage i see of views, is because they don't resolve dependency at 'iteration' but at 'query' While the basic way of working select data of root object at 'query' then resolve dependency at 'iteration'. This behavior seems to be a performance-crasher... In fact, to be honest my main problem is the 5 select i have by iteration on my query... I don't care i the select takes 20seconds, but this traffic of request is too much high... -- Deldycke Quentin On 19 September 2014 09:05, Boris Kolpackov wrote: > Hi Quentin, > > Quentin Deldycke writes: > > > You are right, the difference of performance is impressive: > > > > - Without views: 50s > > - With views: 1.2s > > Yes, ODB views are awesome ;-). Thanks for sharing the numbers. > > Boris > From nima0102 at gmail.com Fri Sep 19 05:52:54 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Fri Sep 19 05:53:02 2014 Subject: [odb-users] CASCADE on delete/update In-Reply-To: References: Message-ID: Hi Marcel, Thanks for your attention. So With this version, I can not do what I expected about automate add CASCADE to my schema, right? and I must use the pre-release version that is not stable yet. On Fri, Sep 19, 2014 at 11:42 AM, Boris Kolpackov wrote: > Hi Nima, > > Marcel Nehring writes: > > > did you have a look at section 14.4.15 of the ODB manual? The > > on_delete specifier might be what you are looking for. > > Yes, except that this is only available in the pre-release. Here is > the pre-release distribution with the Windows binary of the ODB > compiler. If you need a binary for some other platform, let me > know: > > http://codesynthesis.com/~boris/tmp/odb/pre-release/ > > Here is also the pre-release manual where you can find Section 14.4.15: > > http://codesynthesis.com/~boris/tmp/odb/odb-manual.pdf > > As for the 'ON UPDATE' clause, this is not really needed in ODB since > we assume that object ids (which translate to primary keys) are immutable > (which is also generally a good idea). > > Boris > From boris at codesynthesis.com Fri Sep 19 07:04:51 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 19 07:11:15 2014 Subject: [odb-users] Performance issues for large sets In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > Yes, but sadly they doesn't suits all my needs and limit quite much our > usage of ODB. ODB is not magic. It cannot somehow deliver advanced, high-level functionality (like polymorphism) at zero cost. Views allow you to execute tailor-made queries that can (a) load only data members that you need and (b) load multiple related objects with a single query. > Our 'old' system used C-ISAM. It can perform a "while" of 1000 elements in > 0.003s - 0.007s. > The same request with odb iterate this 1000 elements in 1.3s - 2.6s. > > The use of odb views allows me to perform this iteration in 0.01s - 0.03s. Was the 'old', C-ISAM system using the same MySQL database that you are using with ODB? > But this mode take only the data i want (i don't know exactly the user > will need in the root object!) Then load all of them. Or, if some of them are expensive to load (e.g., huge BLOBs), then load them with a separate view if and when necessary. > The main advantage i see of views, is because they don't resolve dependency > at 'iteration' but at 'query' > > While the basic way of working select data of root object at 'query' then > resolve dependency at 'iteration'. If by dependencies you mean related objects, then you can also control their loading with lazy pointers (Section 6.4, "Lazy Pointers"). Another useful feature is object sections (Chapter 9, "Sections"). They allow you to lazy-load huge BLOBs, etc. Boris From boris at codesynthesis.com Fri Sep 19 07:18:23 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 19 07:24:45 2014 Subject: [odb-users] value classes in views In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > #pragma db value > class A > { > //some int / string and stuff... > } > > #pragma db object > class B > { > //some int / string and stuff... > } > > #pragma db object > class C > { > A classA; > shared_ptr classB; > } > > I want to build a view, equivalent to object C (i displayed only usefull > data) > > My view is built like this: > > #pragma db view object(C) object(B = classB: A::classB) > class view_C > { > A classA; > B classB; > } You cannot (yet) use an object (B) as data member in view. This is what we call an "object-loading view" and is still on the TODO list. What you can do is something like this: #pragma db object class B { #pragma db value struct Data { //some int / string and stuff... } data_; } #pragma db view object(C) object(B = classB: C::classB) class view_C { A classA; #pragma db column(classB::data_) B::Data classB; }; Or, if you really, absolutely must have 'B classB', then you can do this: #pragma db object class B { #pragma db value struct Data { //some int / string and stuff... } data_; const Data& getData () const {return data_;} void setData (const Data& d) {data_ = d;} }; #pragma db view object(C) object(B = classB: C::classB) class view_C { A classA; #pragma db transient B classB; #pragma db member(classBData) virtual(B::Data) column(classB::data_) \ get(this.getData ()) set (this.setData((?))) }; Boris From boris at codesynthesis.com Fri Sep 19 07:19:53 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 19 07:26:15 2014 Subject: [odb-users] CASCADE on delete/update In-Reply-To: References: Message-ID: Hi Nima, nima chavooshi writes: > So With this version, I can not do what I expected about automate > add CASCADE to my schema, right? Correct, this feature is not available in 2.3.0. > and I must use the pre-release version that is not stable yet. It is pretty stable. Boris From nima0102 at gmail.com Fri Sep 19 07:27:05 2014 From: nima0102 at gmail.com (nima chavooshi) Date: Fri Sep 19 07:27:13 2014 Subject: [odb-users] CASCADE on delete/update In-Reply-To: References: Message-ID: Thanks a lot for your good support. On Fri, Sep 19, 2014 at 3:49 PM, Boris Kolpackov wrote: > Hi Nima, > > nima chavooshi writes: > > > So With this version, I can not do what I expected about automate > > add CASCADE to my schema, right? > > Correct, this feature is not available in 2.3.0. > > > > and I must use the pre-release version that is not stable yet. > > It is pretty stable. > > Boris > From boris at codesynthesis.com Fri Sep 19 09:13:09 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Sep 19 09:19:32 2014 Subject: [odb-users] AW: ODB compiler crash In-Reply-To: <77c48a6b4e7740119024b38b3d59ce82@QEX.qosmotec.com> References: <3cfd4d880c8a42f9a468be9a35956c50@QEX.qosmotec.com> <9876650174bd4becb890de24c3061fea@QEX.qosmotec.com> <20140918090045.GA20810@codesynthesis.com> <77c48a6b4e7740119024b38b3d59ce82@QEX.qosmotec.com> Message-ID: <20140919131309.GA20975@codesynthesis.com> Hi Marcel, Marcel Nehring writes: > Ad 2) > I saw the --schema-version-table option but it looked a bit too > complicated for what I was trying to do. So I think I will stick to the > default name. But just for curiosity, what is the rationale to force > case-sensitive table names etc. in Oracle DDLs? Some tools seem to have > problems with case-sensitive names. The main reason is to avoid conflicts. There could be data members named 'Name' and 'name' which we need to map to columns somehow. But, if you want case-insensitive, there is an easy way to achieve this with the --sql-name-case option. > 4) When I persist a map ODB will generate a separate table for this > mapping. But if the surrounding class is solely a wrapper around the > map for insertion, deletion etc. and also a singleton I do not need > a separate table. Is it somehow possible to avoid ending up with > three different tables here? Two should suffice from a database > point of view I think. A class with a map will be mapped to two tables. What is the third table that you are getting? If the class is just a wrapper around a map and is a singleton, then one way to get rid of the useless object table would be to emulate the map yourself, for example: #pragma db object struct map_entry { #pragma db id std::string key; int value; }; Or, if you want it to seamlessly integrate with std::map, you can do something like this: typedef std::pair map_entry; #pragma db object(map_entry) #pragma db member(map_entry::first) id column("key") #pragma db member(map_entry::second) column("value") > 5) I have problems persisting nested containers. For example a map of > maps. A member like std::map> results > in an ODB error message similar to: unable to map C++ type > '::MyClass::MyMapTypeDef::mapped_type' used in data member 'm_member' > to a Oracle database type Nested containers are not supported since there is no natural mapping for them in a relational database. Some database systems support container-like column types, so it is possible, with a bit of effort, to implement two-level nesting in such databases. In Oracle, for example, there is VARRAY which you can store in a single column. There is a test in odb-tests package in oracle/custom/ that shows how to map VARRAY to std::vector. Perhaps there is also a similar type that can be used to represent a map. Maybe a table type? The general ODB mechanism that is used to work with such extended types is described here: http://www.codesynthesis.com/~boris/blog/2012/07/18/custom-database-to-cxx-type-mapping-in-odb/ > 6) Additionally it looks like I did not yet fully understand the whole > template class workaround you proposed a few messages earlier. Let's suppose > I have two template classes. OuterTemplate and > InnerTemplate. Furthermore I want OuterTemplate to have a member of > type std::shared_ptr>. I have added typedefs for all > template instantiations for both classes and each typedef has the > corresponding pragmas. When running the ODB compiler for OuterTemplate.h I > get the error: unable to map C++ type '::std::shared_ptr< ::InnerTemplate< > int > >' used in data member 'm_member' to a Oracle database type. How can I > tell ODB how to persist this class? Let's say [T=int] then the pragmas that you will need would look like this: typedef InnerTemplate Inner; #pragma db object(Inner) pointer(std::shared_ptr) #pragma db member(Inner::m_id) id typedef OuterTemplate Outer; #pragma db object(Outer) #pragma db member(Outer::m_id) id The order is not really important but ODB must "see" the pragmas for Inner (so that it knows Inner is an object) when compiling Outer. > 7) The source code attached below produces several compile errors in > Visual Studio when I try to compile the code generated by ODB. Fixed (another name conflict). I've uploaded the binary to the usual place: http://codesynthesis.com/~boris/tmp/odb/pre-release/odb-2.4.0.a3-i686-windows.zip Boris From quentindeldycke at gmail.com Fri Sep 19 10:49:16 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Fri Sep 19 10:49:25 2014 Subject: [odb-users] Performance issues for large sets In-Reply-To: References: Message-ID: Hi boris -- Deldycke Quentin On 19 September 2014 13:04, Boris Kolpackov wrote: > Hi Quentin, > > Quentin Deldycke writes: > > > Yes, but sadly they doesn't suits all my needs and limit quite much our > > usage of ODB. > > ODB is not magic. It cannot somehow deliver advanced, high-level > functionality (like polymorphism) at zero cost. Views allow you > to execute tailor-made queries that can (a) load only data members > that you need and (b) load multiple related objects with a single > query. > > You are right. From my own personnal point of view, i really like the way of ODB is working. The only bad thing is the high quantity of user code i have. And to modify all this code is not something possible for me. > > > Our 'old' system used C-ISAM. It can perform a "while" of 1000 elements > in > > 0.003s - 0.007s. > > The same request with odb iterate this 1000 elements in 1.3s - 2.6s. > > > > The use of odb views allows me to perform this iteration in 0.01s - > 0.03s. > > Was the 'old', C-ISAM system using the same MySQL database that you > are using with ODB? > > No actually it is a different system. Really old school one, but the data we are treating are exactly the same beetween both. > > > But this mode take only the data i want (i don't know exactly the user > > will need in the root object!) > > Then load all of them. Or, if some of them are expensive to load (e.g., > huge BLOBs), then load them with a separate view if and when necessary. > > > > The main advantage i see of views, is because they don't resolve > dependency > > at 'iteration' but at 'query' > > > > While the basic way of working select data of root object at 'query' then > > resolve dependency at 'iteration'. > > If by dependencies you mean related objects, then you can also control > their loading with lazy pointers (Section 6.4, "Lazy Pointers"). Another > useful feature is object sections (Chapter 9, "Sections"). They allow > you to lazy-load huge BLOBs, etc. > > Yes, it is what i mean. I think that lazy pointers are a good option for me. I will just modify the way of working so it lazy load when the '->' operator gets used. So my users won't need to change their code. > Boris > From brianbourke75 at gmail.com Fri Sep 19 17:22:28 2014 From: brianbourke75 at gmail.com (Brian Bourke-Martin) Date: Sat Sep 20 04:00:13 2014 Subject: [odb-users] Issue getting relashonships off the ground Message-ID: I have a very simple relationship setup which I cannot get the odb output to compile and it's giving me the below compiler error. I am using Qt smart pointers to implement the relationship and I always seem to be running into the same error no matter how many permutations I go through. In file included from /usr/local/include/odb/database.hxx:499:0, from /usr/local/include/odb/sqlite/database.hxx:16, from /home/brian/darkfield/NxtGen5/build/odb_gen/Part-odb.cxx:15: /usr/local/include/odb/database.ixx: In member function ?typename odb::object_traits::pointer_type odb::database::find_(const typename odb::object_traits::id_type&) [with T = Inspection, odb::database_id DB = (odb::database_id)1u, typename odb::object_traits::pointer_type = QSharedPointer, typename odb::object_traits::id_type = QUuid]?: /usr/local/include/odb/database.txx:82:38: instantiated from ?typename odb::object_traits::pointer_type odb::database::load_(const typename odb::object_traits::id_type&) [with T = Inspection, odb::database_id DB = (odb::database_id)1u, typename odb::object_traits::pointer_type = QSharedPointer, typename odb::object_traits::id_type = QUuid]? /usr/local/include/odb/sqlite/database.ixx:100:37: instantiated from ?typename odb::object_traits::pointer_type odb::sqlite::database::load(const typename odb::object_traits::id_type&) [with T = Inspection, typename odb::object_traits::pointer_type = QSharedPointer, typename odb::object_traits::id_type = QUuid]? /home/brian/darkfield/NxtGen5/build/odb_gen/Part-odb.cxx:246:42: instantiated from here /usr/local/include/odb/database.ixx:570:54: error: no matching function for call to ?odb::object_traits_impl::find(odb::database&, const id_type&)? /usr/local/include/odb/database.ixx:570:54: note: candidate is: /home/brian/darkfield/NxtGen5/build/odb_gen/Inspection-odb.hxx:372:5: note: static bool odb::access::object_traits_impl::find(odb::database&, const id_type&, odb::access::object_traits::object_type&) /home/brian/darkfield/NxtGen5/build/odb_gen/Inspection-odb.hxx:372:5: note: candidate expects 3 arguments, 2 provided here is the the parent class #ifndef PART_H #define PART_H class Part; #include #include #include #include #include #include #include #include #include #include "Inspection.h" /** this class represents the atomic parts which are acquired */ #pragma db object class Part{ public: /** public constructor */ Part(QString id); /** gets the id */ const QString Id() const; /** Get (or create) the inspection for a given system name */ QSharedPointer GetInspection(QString systemName = ""); private: /** constructor */ Part(){} /** odb needed reference */ friend class odb::access; /** a list of all of the inspections for this part */ //#pragma db value_not_null inverse(parent) QList > inspections; /** holds a unique name/id for this object */ #pragma db id QString id; }; #endif // PART_H And here is the child #ifndef INSPECTION_H #define INSPECTION_H class Inspection; #include #include #include #include #include #include #include #include #include //#include "SurfaceDefect.h" #include "vec2f.h" #include "Part.h" #include "MILImage.h" using namespace std; #pragma db object class Inspection{ public: /** gets the full image object for this inspection */ const QWeakPointer GetFullImage() const; /** gets the start time of the inspection */ const QDateTime GetStarted() const; /** gets the end time of the inspection */ const QDateTime GetEnded() const; /** Gets the system name on which the inspection was acquired */ const QString GetSystemName() const; /** sets the full image and takes ownership of it */ void SetFullImage(MILImage* fullImage); /** sets the start time of the inspection */ void SetStarted(QDateTime started); /** Sets the end time of the inspection */ void SetEnded(QDateTime ended); private: /** constructor */ Inspection(QString systemName); /** odb needed reference */ friend class odb::access; /** we give access to the part class to allow for construction */ friend class Part; /** A unique identifier for the inspection */ #pragma db id QUuid id; /** the name of the system which acquired the inspection */ QString systemName; /** The time and date the inspection was recorded to disk */ QDateTime Recorded; /** A vector of all defects */ //#pragma db inverse(Source) //QVector< QLazyWeakPointer > SurfaceDefects; /** The username of the person inspecting the sheet */ QString Username; /** All the metadata crammed into one QString */ QString MetaData; /** The positions of the 4 corners of a sheet */ // TODO: this should not be transient #pragma db transient Vec2f Corners[4]; /** The time and date the inspection started */ QDateTime started; /** the time and date the inspection ended */ QDateTime ended; /** the full inspection image */ #pragma db transient QSharedPointer fullImage; /** the parent part of this object */ #pragma db not_null QSharedPointer parent; }; #endif // INSPECTION_H Any help which could be given would be great! From boris at codesynthesis.com Sat Sep 20 04:21:06 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Sep 20 04:27:28 2014 Subject: [odb-users] Issue getting relashonships off the ground In-Reply-To: References: Message-ID: Hi Brian, Brian Bourke-Martin writes: > /usr/local/include/odb/database.ixx:570:54: error: no matching function for > call to ?odb::object_traits_impl (odb::database_id)1u>::find(odb::database&, const id_type&)? If you look at line 570 in database.ixx, just above it you will see this comment: // Compiler error pointing here? Perhaps the object doesn't have the // default constructor? // So your problem is the fact that class Inspection doesn't have the default constructor. Object without default constructors cannot be used in relationships. Seeing that you have a circular relationship, you may also find Section 6.3, "Circular Relationships" in the ODB manual relevant. Boris From boris at codesynthesis.com Sat Sep 20 04:30:36 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Sep 20 04:36:58 2014 Subject: [odb-users] Performance issues for large sets In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > > > Our 'old' system used C-ISAM. It can perform a "while" of 1000 elements > > > in 0.003s - 0.007s. > > > The same request with odb iterate this 1000 elements in 1.3s - 2.6s. > > > > > > The use of odb views allows me to perform this iteration in 0.01s - > > > 0.03s. > > > > Was the 'old', C-ISAM system using the same MySQL database that you > > are using with ODB? > > > > No actually it is a different system. Really old school one, but the data > we are treating are exactly the same beetween both. Well, if it was a different database, then the above comparison is apples to oranges. The difference you observe between ODB views and C-ISAM is because of the different underlying databases, not APIs. I am sure if you used, say, SQLite instead of MySQL for ODB tests you would get at least an order of magnitude better performance than C-ISAM. > I think that lazy pointers are a good option for me. I will just modify > the way of working so it lazy load when the '->' operator gets used. So > my users won't need to change their code. Just keep in mind that when you load a lazy pointer, it has to happen within a transaction. That's why the ODB lazy pointers don't provide such implicit loading. Boris From quentindeldycke at gmail.com Sat Sep 20 05:02:38 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Sat Sep 20 05:02:44 2014 Subject: [odb-users] Performance issues for large sets In-Reply-To: References: Message-ID: Hi Boris, -- Deldycke Quentin On 20 September 2014 10:30, Boris Kolpackov wrote: > Hi Quentin, > > Quentin Deldycke writes: > > > > > Our 'old' system used C-ISAM. It can perform a "while" of 1000 > elements > > > > in 0.003s - 0.007s. > > > > The same request with odb iterate this 1000 elements in 1.3s - 2.6s. > > > > > > > > The use of odb views allows me to perform this iteration in 0.01s - > > > > 0.03s. > > > > > > Was the 'old', C-ISAM system using the same MySQL database that you > > > are using with ODB? > > > > > > > No actually it is a different system. Really old school one, but the data > > we are treating are exactly the same beetween both. > > Well, if it was a different database, then the above comparison is apples > to oranges. The difference you observe between ODB views and C-ISAM is > because of the different underlying databases, not APIs. I am sure if > you used, say, SQLite instead of MySQL for ODB tests you would get at > least an order of magnitude better performance than C-ISAM. > > You are right. Sadly it is not of my own choice. It needs to be a MySQL server as we want to unify all our database system. Sadly ODB is used, for the moment, as a layer in a more complex (old and ugly) ORM from user point of view... Anyway, where performance is really bad, I will use real ODB code, and not the "compatibility" API i try to provide for existing code. And i know that at this moment, I will achieve better performance and functionallity. By the way for my point of view, it is still interesting to see the difference of performance ODB could acquire with different databases systems. If i have time, i will try to make some testing to see the difference of performance depending of the underlying database. and give you some results. It can always be interesting.... > > I think that lazy pointers are a good option for me. I will just modify > > the way of working so it lazy load when the '->' operator gets used. So > > my users won't need to change their code. > > Just keep in mind that when you load a lazy pointer, it has to happen > within a transaction. That's why the ODB lazy pointers don't provide > such implicit loading. > Yes, i made some tries, and it seems to work nearly without problems. I subclassed your lazy_shared_ptr class to provide the functionnality i wanted. I only had a weird compilation problem. (I will verify if it is not my side and, if not, i will send a mail about). For transactions, my first tries show me that it is ok. FYI: We have improved from 1.3-2.6s to 0.3-0.5s by 1000 iteration. I still have 1 request going each iteration because i have a std::map inside my object. I will try to lazy-load it also. I am sure i can still reduce iteration time! If the user want to access more deep objects, It is not a problem for me that it perform a "select" at this moment. Anyway, thanks for your help! The performance issue I have for large sets going to be "a past story"! > > Boris > From brianbourke75 at gmail.com Sat Sep 20 10:53:33 2014 From: brianbourke75 at gmail.com (Brian Bourke-Martin) Date: Mon Sep 22 01:19:40 2014 Subject: [odb-users] Issue getting relashonships off the ground In-Reply-To: References: Message-ID: Thanks for the response Boris! I will look into this on Monday when I am back in the office! On Sat, Sep 20, 2014 at 4:21 AM, Boris Kolpackov wrote: > Hi Brian, > > Brian Bourke-Martin writes: > > > /usr/local/include/odb/database.ixx:570:54: error: no matching function > for > > call to ?odb::object_traits_impl > (odb::database_id)1u>::find(odb::database&, const id_type&)? > > If you look at line 570 in database.ixx, just above it you will see > this comment: > > // Compiler error pointing here? Perhaps the object doesn't have the > // default constructor? > // > > So your problem is the fact that class Inspection doesn't have the > default constructor. Object without default constructors cannot be > used in relationships. > > Seeing that you have a circular relationship, you may also find > Section 6.3, "Circular Relationships" in the ODB manual relevant. > > Boris > From quentindeldycke at gmail.com Mon Sep 22 03:31:19 2014 From: quentindeldycke at gmail.com (Quentin Deldycke) Date: Mon Sep 22 03:31:26 2014 Subject: [odb-users] Compilation error with custom lazy_shared_ptr Message-ID: Hi, I created a reimplementation of odb::tr1::lazy_shared_ptr. (I derivate from it.) I have a compilation error: ../../../../include/odb/tr1/lazy-ptr.ixx:189:12: error: no match for ?operator=? (operand types are ?std::tr1::shared_ptr? and ?odb::object_traits::pointer_type {aka OTIdentifiant*}?) p_ = i_.template load (true); // Reset id. Do i have a missing operator= or a copy constructor? -- Deldycke Quentin From boris at codesynthesis.com Mon Sep 22 04:39:12 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 22 04:45:36 2014 Subject: [odb-users] Compilation error with custom lazy_shared_ptr In-Reply-To: References: Message-ID: Hi Quentin, Quentin Deldycke writes: > I created a reimplementation of odb::tr1::lazy_shared_ptr. (I derivate from > it.) > > I have a compilation error: > > ../../../../include/odb/tr1/lazy-ptr.ixx:189:12: error: no match for > ?operator=? (operand types are ?std::tr1::shared_ptr? and > ?odb::object_traits::pointer_type {aka OTIdentifiant*}?) > p_ = i_.template load (true); // Reset id. You are getting this error because OTIdentifiant's object pointer is the raw pointer and not std::tr1::shared_ptr. See Section 3.3, "Object and View Pointers" in the ODB manual. Boris From esbenzeuthen at gmail.com Tue Sep 23 16:55:59 2014 From: esbenzeuthen at gmail.com (Esben Zeuthen) Date: Tue Sep 23 16:56:06 2014 Subject: [odb-users] Probably a BUG in libodb-boost-2.3.0/odb/boost/multi-index/container-traits.hxx - EASY TO FIX Message-ID: When compiling with option "--profile boost", I got a mapping error for any multi_index_container member: ../model/Automat.h:113:11: error: unable to map C++ type '::tinemo::model::Automat::emails' used in data member 'emails_' to a MySQL database type ../model/Automat.h:113:11: info: use '#pragma db type' to specify the database type I looked in the file libodb-boost-2.3.0/odb/boost/multi-index/container-traits.hxx trying to figure out why my multi index container was not mapped correctly, and I found this in the very start of the header file: #ifndef ODB_BOOST_UNORDERED_CONTAINER_TRAITS_HXX #define ODB_BOOST_UNORDERED_CONTAINER_TRAITS_HXX Now, this is not the unordered container traits definitions, it is the multi index container definitions. I looked into file libodb-boost-2.3.0/odb/boost/unordered/container-traits.hxx and found the exact same directives as listed above. The multi index container header definitions are not included, if the unordered container header has been previously included. I verified this by compiling with profiles boost/smart-ptr and boost/multi-index only. This time I got no mapping error, and SQL code for my multi index container table has been generated. Unless the two subprofiles are mutually exclusive, I suggest changing the #ifndef/#define directives to allow them to co-exist. Best, Esben From brianbourke75 at gmail.com Tue Sep 23 14:25:40 2014 From: brianbourke75 at gmail.com (Brian Bourke-Martin) Date: Wed Sep 24 01:12:40 2014 Subject: [odb-users] Issue getting relashonships off the ground In-Reply-To: References: Message-ID: Adding the default constructor did the trick! Looks like stupid mistake on my part. Thanks! On Sat, Sep 20, 2014 at 4:21 AM, Boris Kolpackov wrote: > Hi Brian, > > Brian Bourke-Martin writes: > > > /usr/local/include/odb/database.ixx:570:54: error: no matching function > for > > call to ?odb::object_traits_impl > (odb::database_id)1u>::find(odb::database&, const id_type&)? > > If you look at line 570 in database.ixx, just above it you will see > this comment: > > // Compiler error pointing here? Perhaps the object doesn't have the > // default constructor? > // > > So your problem is the fact that class Inspection doesn't have the > default constructor. Object without default constructors cannot be > used in relationships. > > Seeing that you have a circular relationship, you may also find > Section 6.3, "Circular Relationships" in the ODB manual relevant. > > Boris > From boris at codesynthesis.com Wed Sep 24 07:33:27 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 24 07:39:53 2014 Subject: [odb-users] Probably a BUG in libodb-boost-2.3.0/odb/boost/multi-index/container-traits.hxx - EASY TO FIX In-Reply-To: References: Message-ID: Hi Esben, Esben Zeuthen writes: > I looked in the file > libodb-boost-2.3.0/odb/boost/multi-index/container-traits.hxx trying to > figure out why my multi index container was not mapped correctly, and I > found this in the very start of the header file: > > #ifndef ODB_BOOST_UNORDERED_CONTAINER_TRAITS_HXX > #define ODB_BOOST_UNORDERED_CONTAINER_TRAITS_HXX Yep, that's copy-n-paste. I've fixed it now: http://scm.codesynthesis.com/?p=odb/libodb-boost.git;a=commit;h=3c5e0b25053a8dd4af5e47faada8b503cf3df83e Thanks for reporting this! BTW, other than this, how is Boost multi-index and ODB working out for you? The ODB mapping for this container is quite interesting in that it is mapped differently depending on whether it has a "sequenced" index. Being able to handle this using standard the ODB container traits mechanism (and a bit of template meta-programming) felt really good ;-). Boris From boris at codesynthesis.com Wed Sep 24 07:35:21 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Sep 24 07:41:47 2014 Subject: [odb-users] Issue getting relashonships off the ground In-Reply-To: References: Message-ID: Hi Brian, Brian Bourke-Martin writes: > Adding the default constructor did the trick! Looks like stupid mistake on > my part. This is actually something that the ODB compiler can and should diagnose. I've added an item to our TODO and I will make sure it makes it into 2.4.0. Boris From adnan at rihan.fr Thu Sep 25 10:38:48 2014 From: adnan at rihan.fr (Adnan RIHAN) Date: Thu Sep 25 10:39:17 2014 Subject: [odb-users] Undefined symbols Message-ID: Hi there ! After having a hard time making odb and everything work, I?m trying to compile a Qt project, with few odb lines (using libodb-qt and libodb-sqlite). Here is my error: > Undefined symbols for architecture x86_64: > ? "odb::sqlite::database::database(std::string const&, int, bool, std::string const&, odb::details::transfer_ptr)", referenced from: > ? ? ? MasterController::createDb() in MasterController.o > ld: symbol(s) not found for architecture x86_64 Starting with the .pro file, the libodb lib and libodb-sqlite libs are correctly sent to gcc (clang) on compilation: > INCLUDEPATH += ?/usr/local/include > LIBS ? ? ? ?+= ?-L/usr/local/lib -lodb -lodb-qt -lodb-sqlite Now my code: > #include > #include > #include > #include "Models/Category/Category.hpp" // My model with #pragmas > #include "Models/Category/Category-odb.hxx" // The generated code, by odb And the failing code: > odb::database *db(new odb::sqlite::database(":memory:")); Could anyone tell me what did I do wrong please ? -- 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 Sep 25 13:57:40 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Sep 25 14:04:04 2014 Subject: [odb-users] Undefined symbols In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > Undefined symbols for architecture x86_64: My first guess is that you have built 32-bit ODB runtimes. I don't know what is the default target for your compiler. Perhaps you need to add something like '-m 64' to CXXFLAGS when running configure for libodb, libodb-qt, and libodb-sqlite. > > LIBS += -L/usr/local/lib -lodb -lodb-qt -lodb-sqlite Doesn't really matter for shared libraries, but, generally, you would want to list libraries in the most specific to most generic order, that is: libodb-qt -lodb-sqlite -lodb. Boris From adnan at rihan.fr Fri Sep 26 04:33:05 2014 From: adnan at rihan.fr (Adnan RIHAN) Date: Fri Sep 26 04:33:35 2014 Subject: [odb-users] Undefined symbols In-Reply-To: References: Message-ID: ? Hi, On 25 septembre 2014 at 20:04:06, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > Perhaps you need to add > something like '-m 64' to CXXFLAGS when running configure for libodb, > libodb-qt, and libodb-sqlite. It works thanks ! > > > LIBS += -L/usr/local/lib -lodb -lodb-qt -lodb-sqlite > > Doesn't really matter for shared libraries, but, generally, you would > want to list libraries in the most specific to most generic order, that > is: libodb-qt -lodb-sqlite -lodb. Thanks for the hint, but unfortunately, without -lodb, I get some other undefined symbols > Undefined symbols for architecture x86_64: > ? "odb::vector_impl::erase(unsigned long, unsigned long)", referenced from: > ? ? ? QOdbList >::takeAt(int) in CategoryTableModel.o > ? "odb::vector_impl::insert(unsigned long, unsigned long)", referenced from: > ? ? ? QOdbList >::insert(int, QSharedPointer const&) in CategoryTableModel.o > ld: symbol(s) not found for architecture x86_64 So I?ve added the other libs also. Even after building with -m64, I still get this error if I don?t add ??-lodb?? =/ 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 adnan at rihan.fr Fri Sep 26 05:58:54 2014 From: adnan at rihan.fr (Adnan RIHAN) Date: Fri Sep 26 05:59:31 2014 Subject: [odb-users] Undefined symbols In-Reply-To: References: Message-ID: ? Finally, I?ve rebuilt every lib with gcc-4.9 and -m64 on CPPFLAGS. And I need to add the -lodb to avoid some undefined symbols. On 26 septembre 2014 at 10:33:22, Adnan RIHAN (adnan@rihan.fr(mailto:adnan@rihan.fr)) wrote: > > Hi, > > > On 25 septembre 2014 at 20:04:06, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > > > Perhaps you need to add > > something like '-m 64' to CXXFLAGS when running configure for libodb, > > libodb-qt, and libodb-sqlite. > > It works thanks ! > > > > > LIBS += -L/usr/local/lib -lodb -lodb-qt -lodb-sqlite > > > > Doesn't really matter for shared libraries, but, generally, you would > > want to list libraries in the most specific to most generic order, that > > is: libodb-qt -lodb-sqlite -lodb. > > Thanks for the hint, but unfortunately, without -lodb, I get some other undefined symbols > > Undefined symbols for architecture x86_64: > > "odb::vector_impl::erase(unsigned long, unsigned long)", referenced from: > > QOdbList >::takeAt(int) in CategoryTableModel.o > > "odb::vector_impl::insert(unsigned long, unsigned long)", referenced from: > > QOdbList >::insert(int, QSharedPointer const&) in CategoryTableModel.o > > ld: symbol(s) not found for architecture x86_64 > > So I?ve added the other libs also. Even after building with -m64, I still get this error if I don?t add ? -lodb ? =/ > > 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). -- 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 Sat Sep 27 08:09:18 2014 From: christian at gsvitec.com (Christian Sell) Date: Sat Sep 27 08:09:31 2014 Subject: [odb-users] accessing meta information Message-ID: <1349699782.785398.1411819758607.open-xchange@omgreatgod.store> Hello, we are evaluating options for a C++ ORM product. One requirement would be the availability of meta information about the mapped classes, from which we could generate a UI. The required information would be stuff along the lines of "what mapped attributes are there, of what types are they", and "what relationships exist". My question would be whether ODB has anything to offer along that path. As I see it, there are 2 conceivable approaches for obtaining the information, i.e. during parsing or at runtime. Runtime would rely completely on existant ODB APIs, and parse time could be achieved by integrating with the ODB parser. What do you say? Thanks, Christian Sell From axel50397 at gmail.com Sun Sep 28 06:51:52 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Sun Sep 28 06:52:34 2014 Subject: [odb-users] Some other undefined symbols on x86_64 Message-ID: Hello there ! I feel like not being capable of compiling correctly a simple code? I have compiled all odb related libs (odb compiler, libodb, libodb-sqlite, libodb-qt) with GCC 4.9, for 64bit (-m64), on OS X 10.10 (Yosemite developer preview, I know ugly but I?m considering downgrading to Mavericks). I?m on my first app using ODB, and using an ORM, and I?m continuing having some undefined symbols: > Undefined symbols for architecture x86_64: > ? "odb::access::object_traits_impl::query(odb::database&, odb::sqlite::query_base const&)", referenced from: > ? ? ? odb::result odb::database::query_::call >(odb::database&, odb::query const&) in WarehouseWidget.o > ld: symbol(s) not found for architecture x86_64 With the following snippets .pro file: > INCLUDEPATH += ?/usr/local/include > LIBS ? ? ? ?+= ?-L/usr/local/lib -lodb-qt -lodb-sqlite -lodb Warehouse.hpp: > # include ? > # include ? >? > # include ? "Models/Category/CategoryTableModel.hpp" >? >?class WarehouseWidget : public QWidget >?{ >?? ? Q_OBJECT >?? ? private: >?? ? ? ? QScopedPointer ? m_db; >? >?? ? public: >?? ? ? ? WarehouseWidget(QWidget *parent = 0); >?} Warehouse.cpp: >?#include "WarehouseWidget.hpp" >? > #include > #include >? >?#include "Models/Category/Category.hpp" >?#include "Models/Category/Category-odb.hxx" >? >?WarehouseWidget::WarehouseWidget(QWidget *parent) : QWidget(parent) >?{ >?? ? try { >?? ? ? ? this->m_db.reset(new odb::sqlite::database("databaseName")); >?? ? ? ? odb::transaction ? ? ? ?t(this->m_db->begin()); >? >?? ? ? ? odb::result ? c(this->m_db->query()); >?? ? } catch (const odb::exception &e) { >?? ? ? ? qDebug() << "ODB Exception:" << e.what(); >?? ? } >?} Any idea :/ ? 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 Mon Sep 29 04:57:33 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 29 05:03:59 2014 Subject: [odb-users] accessing meta information In-Reply-To: <1349699782.785398.1411819758607.open-xchange@omgreatgod.store> References: <1349699782.785398.1411819758607.open-xchange@omgreatgod.store> Message-ID: Hi Christian, Christian Sell writes: > One requirement would be the availability of meta information about the > mapped classes, from which we could generate a UI. The required information > would be stuff along the lines of "what mapped attributes are there, of what > types are they", and "what relationships exist". > > My question would be whether ODB has anything to offer along that path. As > I see it, there are 2 conceivable approaches for obtaining the information, > i.e. during parsing or at runtime. Runtime would rely completely on > existant ODB APIs, and parse time could be achieved by integrating with the > ODB parser. I think it will have to be something that you generate (e.g., C++ code). Currently, ODB doesn't provide any meta-information about the persistent classes. But even if it did, I don't think just knowing what data members there are and their types will be sufficient. Next you will probably want to be able to access/modify these data members from your UI. And that would be even further out of the ODB's scope. So that's why I think code generation is the way to go for this. You have mentioned customizing the ODB parser (more precisely, you would customize the ODB's C++ code generator). This is definitely doable and will give you the most control. There will be very few things you won't know about the mapped classes or won't be able to do. But, this may require some effort, depending on how far away from the way ODB does things now you want to take it. There is also another interesting option that will be a lot easier to implement than ODB customization. ODB supports database schema evolution (Chapter 13 in the ODB manual) and for that it keeps a changelog. The changelog is an XML file that consists of the base model description and a changeset for each version. And that base model description is essentially the mapping of your C++ classes to the database. As an example, say we have these two classes: #pragma db object struct user { #pragma db id std::string email_; std::string name_; #pragma db inverse(reporter_) std::vector> reported_bugs_; }; #pragma db object struct bug { #pragma db id auto unsigned long long id_; status status_; std::string summary_; std::string description_; std::shared_ptr reporter_; }; The base model for these classes will look like this (using PostgreSQL in this example):
Now this is clearly a description of the database schema, not C++ classes. But, given that you follow a consistent convention in your code (e.g., that all data members end with '_', use std::string to represent text, etc), then it is fairly easy to reconstruct the C++ classes that this has been generated from. And once you have this, you can generate UI layouts, C++ code, etc. If I were you, I would seriously consider if this simpler approach will work. Boris From boris at codesynthesis.com Mon Sep 29 05:00:33 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 29 05:06:57 2014 Subject: [odb-users] Undefined symbols In-Reply-To: References: Message-ID: Hi Adnan, Adnan RIHAN writes: > On 25 septembre 2014 at 20:04:06, Boris Kolpackov (boris@codesynthesis.com(mailto:boris@codesynthesis.com)) wrote: > > > > > LIBS += -L/usr/local/lib -lodb -lodb-qt -lodb-sqlite > > > > Doesn't really matter for shared libraries, but, generally, you would > > want to list libraries in the most specific to most generic order, that > > is: libodb-qt -lodb-sqlite -lodb. > > Thanks for the hint, but unfortunately, without -lodb, [...] Where do you see me saying that you shouldn't link to libodb? Boris From boris at codesynthesis.com Mon Sep 29 05:04:57 2014 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Sep 29 05:11:19 2014 Subject: [odb-users] Some other undefined symbols on x86_64 In-Reply-To: References: Message-ID: <20140929090457.GA6837@codesynthesis.com> Hi Adnan, Adnan RIHAN writes: > I?m on my first app using ODB, and using an ORM, and I?m continuing having > some undefined symbols: > > > Undefined symbols for architecture x86_64: > > "odb::access::object_traits_impl::query(odb::database&, odb::sqlite::query_base const&)", referenced from: 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). Boris From axel50397 at gmail.com Mon Sep 29 05:34:42 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Mon Sep 29 05:34:53 2014 Subject: [odb-users] Undefined symbols In-Reply-To: References: Message-ID: <58A54E8D-0D4C-4872-A699-4C2035808B58@gmail.com> Hi Boris > Le 29 sept. 2014 ? 11:00, Boris Kolpackov a ?crit : > Where do you see me saying that you shouldn't link to libodb? It because of: >>>> LIBS += -L/usr/local/lib -lodb -lodb-qt -lodb-sqlite >> >> Doesn't really matter for shared libraries Just a misunderstanding apparently. -- 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 axel50397 at gmail.com Tue Sep 30 20:07:24 2014 From: axel50397 at gmail.com (Adnan RIHAN) Date: Thu Oct 2 08:34:16 2014 Subject: [odb-users] odb: error: unable to locate options file for profile 'qt' (-p) Message-ID: Hi all, I really think either Nature is against me, or I?m really being dumb? Yesterday I?ve downgraded to 10.9 (Maverick) the last final OSX (10.10 was too laggy, but they have released a GM today (>_>?) and I?m using Xcode 6.0.1 (App Store). Now, I?ve recompiled everything as expected, with GCC4.9, just like I did on 10.10? Unlike http://codesynthesis.com/pipermail/odb-users/2014-September/002068.html, I have a NEW odb error: > odb: error: unable to locate options file for profile ?qt' Using: > odb --changelog apps/LGC/schemas/odb-changelog.xml -d sqlite -p qt -q -s --schema-name categories -o . Category.hpp So basically, the SAME line as on 10.10 (as it?s executed automatically when Qt?s builds the project)? Do you have an idea? :X Maybe my fate doesn?t want me to use ODB, which is a shame... 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).