From christian at gsvitec.com Thu Oct 1 11:50:29 2015 From: christian at gsvitec.com (Christian Sell) Date: Thu Oct 1 11:50:34 2015 Subject: [odb-users] odb persistence in a library / cross-model dependencies In-Reply-To: <359492180.430846.1443631477487.JavaMail.open-xchange@ptangptang.store> References: <1793361386.9709959.1443432199513.JavaMail.open-xchange@patina.store> <359492180.430846.1443631477487.JavaMail.open-xchange@ptangptang.store> Message-ID: <382648564.637235.1443714629651.JavaMail.open-xchange@ptangptang.store> Hello, I have looked into this further and added "cross-model dependencies" to the subject line of this mail because I think that is what this problem boils down to. Since I found no solution in the ODB manual, I decided to run an experiment to determine the technical feasibility. Note that I am using pragma-only files, no #pragma markup in normal source files. What I did is this: - first compile the library, with Class1, Class2 and Class3 declared and mapped - then compile libraryuser, with mappings for Class1 and Class4 - then go to the libraryuser generated source files and remove the Class1 code section. Also remove the CREATE/DROP TABLE for Class1 now I ran my libraryuser application, which first lets the library run its database creation code, and then runs its own. Everything works well, I was able to add Class4 instances to the Class3::poly_container and load them again. So, there seems to be no fundamental issue with my approach. My Question: are cross-model references really unsupported or did I miss something? If they are unsupported, could that be changed? My idea would be something like a "#pragma db object polymorphic external" where the "external" part would tell ODB the given mapping is already present in another model. thanks, Christian > Christian Sell hat am 30. September 2015 um 18:44 > geschrieben: > > > Hello, > > still working on the "persistence in library" subject. Here's a problem I > encountered during my first test run: > > we have an abstract, polymorphic superclass that is mapped inside the library. > Now we want to allow the user of the library to extend the object model by > adding new subclasses, which should also be made persistent AND be accessible > through the same polymorphic relationship. Graphically: > > Library > Class1 polymorphic > id > name > > Class2 extends Class1 > > Class3 > id > vector poly_container > > LibraryUser > Class4 extends Class1 > > > this immediately fails during odb compilation of the LibraryUser files, > because > odb complains that Class4 does not designate an object id. The reason is > obvious > - odb doesn't know that Class1 has been mapped polymorphically elsewhere. Can > this situation be solved somehow? > > thanks, > Christian > Christian Sell GS Vitec GmbH Im Ziegelhaus 6-8 D-63571 Gelnhausen mail: christian@gsvitec.com mobil: +49 (0) 173 5384289 Tel: +49 (0) 6051 601.26-90 Fax: +49 (0) 6051 601.26-91 From boris at codesynthesis.com Fri Oct 2 10:32:22 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Oct 2 10:32:31 2015 Subject: [odb-users] odb persistence in a library / cross-model dependencies In-Reply-To: <382648564.637235.1443714629651.JavaMail.open-xchange@ptangptang.store> References: <1793361386.9709959.1443432199513.JavaMail.open-xchange@patina.store> <359492180.430846.1443631477487.JavaMail.open-xchange@ptangptang.store> <382648564.637235.1443714629651.JavaMail.open-xchange@ptangptang.store> Message-ID: Hi Christian, Christian Sell writes: > My Question: are cross-model references really unsupported or did I miss > something? What exactly does "cross-model references" mean, anyway? If you think about it, ODB schema evolution support is not that involved (and we would like to keep it that way): 1. ODB will keep track of the schema version in a special table. 2. ODB will automatically generate schema migration SQL from version to version. 3. ODB will allow you to hook data migration in-between those steps. As an extra, you can have several named, independent schema sub-sets for which all this can be done. And that's it. Specifically, there is no (and most likely never will be) any kind of support for hierarchical versions where some changes from one sub-set are also propagated to another, or some such. Even thinking about this makes me nauseous ;-). One thing to keep in mind is that it all boils down to the database schema. In fact, if you are not generating the schema, then there is no schema evolution support (the changelog is only maintained if/when you request database schema generation). And you have a pretty good control over for which classes the schema is generated. What this means specifically to your situation is that: 1. If you place the base class in a separate header. 2. Make sure it does not change (i.e., don't version the base). 3. And don't generate its schema in the versioned subset. Then there is no reason why this won't work. Boris From christian at gsvitec.com Fri Oct 2 12:38:42 2015 From: christian at gsvitec.com (Christian Sell) Date: Fri Oct 2 12:38:45 2015 Subject: [odb-users] odb persistence in a library / cross-model dependencies In-Reply-To: References: <1793361386.9709959.1443432199513.JavaMail.open-xchange@patina.store> <359492180.430846.1443631477487.JavaMail.open-xchange@ptangptang.store> <382648564.637235.1443714629651.JavaMail.open-xchange@ptangptang.store> Message-ID: <23734871.835070.1443803922226.JavaMail.open-xchange@ptangptang.store> Hello Boris, note that this issue isn't about schema versioning (although it may have implications) > What exactly does "cross-model references" mean, anyway? in essence, in this case it means that a class from one model wants to subclass a class from another model. the same would go for relationships, pointers and the like. Again: I have model 1, which in my case is compiled into a shared library. Model 1 consist of ClassA long number id ClassB vector> poly_container with mappings defined in a pragma-only header "lib_pragmas.h" #include #include #pragma db object(ClassA) ypolymorphic #pragma db member(ClassA::number) id #pragma db object(ClassB) Now, my application, which uses the above mentioned shared lib, wants to define a class ClassC which subclasses ClassA. All this should go to the same database, of course (into the ClassB::poly_container) ClassC -extends->ClassA with mappings defined as #include #pragma db object(ClassC) Now, when compiling my application, the odb compiler balks that ClassC doesn't define an id column. The reason is obvious: odb doesn't see the "lib_pragmas.h" mapping header and thus doesn't know that ClassC's superclass is actually (polymorphically) mapped and has an id column. If I then change my application mapping header to #include #include #pragma db object(ClassC) I can compile, but the generated code replicates the full machinery for ClassA (and ClassB, for that matter), including CREATE TABLE statements. I don't see what I can do from here other than manually editing the generated files.. thanks, Christian From christian at gsvitec.com Fri Oct 2 15:17:03 2015 From: christian at gsvitec.com (Christian Sell) Date: Fri Oct 2 15:17:07 2015 Subject: [odb-users] odb persistence in a library / cross-model dependencies In-Reply-To: References: <1793361386.9709959.1443432199513.JavaMail.open-xchange@patina.store> <359492180.430846.1443631477487.JavaMail.open-xchange@ptangptang.store> <382648564.637235.1443714629651.JavaMail.open-xchange@ptangptang.store> Message-ID: <1662139401.848265.1443813423991.JavaMail.open-xchange@ptangptang.store> > you request database schema generation). And you have a pretty good > control over for which classes the schema is generated. umh, what control do I have? All I know about is schema_catalog::create_schema, where tables for all classes from one model (identified by the name passed to the odb --schema-name option) are created. Since I have to pass in the lib_pragmas.h file to compile my application class, those get re-created as well. Not good. > 3. And don't generate its schema in the versioned subset. how, other than by editing the generated database schema creation code? thanks, Christian From boris at codesynthesis.com Mon Oct 5 12:21:30 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 5 12:21:40 2015 Subject: [odb-users] odb persistence in a library / cross-model dependencies In-Reply-To: <23734871.835070.1443803922226.JavaMail.open-xchange@ptangptang.store> References: <1793361386.9709959.1443432199513.JavaMail.open-xchange@patina.store> <359492180.430846.1443631477487.JavaMail.open-xchange@ptangptang.store> <382648564.637235.1443714629651.JavaMail.open-xchange@ptangptang.store> <23734871.835070.1443803922226.JavaMail.open-xchange@ptangptang.store> Message-ID: Hi Christian, Christian Sell writes: > > What exactly does "cross-model references" mean, anyway? > > in essence, in this case it means that a class from one model wants to > subclass a class from another model. the same would go for relationships, > pointers and the like. Ok, in ODB, you cannot change the id column of an object in any way other than by creating a new class. And polymorphic inheritance, underneath, is a essentially a relationship. So all this is not an issue when schema evolution is concerned except for one case: you can remove a class, be it a base class or a pointed-to class. So imagine a situation where you have the base class in one "schema" (e.g., your application) and a derived class in another (e.g., your extension library). Then you go ahead and remove the base class. ODB has no support for detecting or handling this case. But then, again, neither does C++ ;-) > Again: [...] Seeing that you are using mapping headers, you can use the 'definition' pragma to control what schema gets generated where: // lib_pragmas.h // #include #include #pragma db object(ClassA) ypolymorphic #pragma db member(ClassA::number) id #pragma db object(ClassB) #ifdef LIB_SCHEMA #pragma db object(ClassA) definition #pragma db object(ClassB) definition #endif // app_pragmas.h // #include #include #pragma db object(ClassC) definition odb ... -DLIB_SCHEMA --schema-name lib lib_pragmas.h odb ... --schema-name app app_pragmas.h Boris From finjulhich at gmail.com Tue Oct 6 02:38:02 2015 From: finjulhich at gmail.com (MM) Date: Tue Oct 6 02:38:10 2015 Subject: [odb-users] query on column of c++ type char[N] Message-ID: Hello, I have an object O with a char[N] member a, that gets mapped to a TEXT column in sqlite. I try to run this query: void f(const std::string& criteria) { typedef odb::query OQuery; O* o = db.query_one( OQuery::a == criteria ); } There is a compile error: no match for ?operator==? (operand types are ?const id_type_ {aka const odb::sqlite::query_column}? and ?const string {aka const std::basic_string}?) Should I provide this overload for operator==? How can I access the value of a from the query_column object? Or should I express the query differently? Regards, From boris at codesynthesis.com Mon Oct 12 09:59:02 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 12 09:59:05 2015 Subject: [odb-users] query on column of c++ type char[N] In-Reply-To: References: Message-ID: Hi, MM writes: > void f(const std::string& criteria) > { > typedef odb::query OQuery; > O* o = db.query_one( OQuery::a == criteria ); > } > > There is a compile error: > > no match for ?operator==? (operand types are ?const id_type_ {aka const > odb::sqlite::query_column}? > and ?const string {aka const std::basic_string}?) You should be able to do: OQuery::a == criteria.c_str () Or: OQuery::a == OQuery::_val (criteria) Boris From leo.leoxnidas.c.14 at gmail.com Mon Oct 12 22:40:34 2015 From: leo.leoxnidas.c.14 at gmail.com (Javier Estalis) Date: Tue Oct 13 09:20:54 2015 Subject: [odb-users] libodb-qt error... QtCore not found... Message-ID: hi, i want to use odb with qt... but, i have a big problem... i am working under debian distribution. when i use ./configure CPPFLAGS=-I/home/leoxnidas/Qt/5.5/gcc/include LDFLAGS=-L/home/leoxnidas/qt/5.5/gcc/lib --prefix /home/leoxnidas/Qt/5.5/gcc this is the output configure: error: QtCore is not found; consider using CPPFLAGS/LDFLAGS to specify its location... any help? From christian at gsvitec.com Tue Oct 13 12:54:51 2015 From: christian at gsvitec.com (Christian Sell) Date: Tue Oct 13 12:54:56 2015 Subject: [odb-users] libodb-qt error... QtCore not found... In-Reply-To: References: Message-ID: <1994834680.2755659.1444755292129.JavaMail.open-xchange@patina.store> urgh, all I can say is that I have run across this issue twice already. Every time I hacked around until it worked and then forgot how I did it! All I remember is that examining the configure log and following all info (README, output) finally gave me the answer. good luck, Chris > Javier Estalis hat am 13. Oktober 2015 um 04:40 > geschrieben: > > > hi, i want to use odb with qt... but, i have a big problem... > > i am working under debian distribution. > > when i use ./configure CPPFLAGS=-I/home/leoxnidas/Qt/5.5/gcc/include > LDFLAGS=-L/home/leoxnidas/qt/5.5/gcc/lib --prefix /home/leoxnidas/Qt/5.5/gcc > > this is the output > > configure: error: QtCore is not found; consider using CPPFLAGS/LDFLAGS to > specify its location... > > any help? Christian Sell GS Vitec GmbH Im Ziegelhaus 6-8 D-63571 Gelnhausen mail: christian@gsvitec.com mobil: +49 (0) 173 5384289 Tel: +49 (0) 6051 601.26-90 Fax: +49 (0) 6051 601.26-91 From boris at codesynthesis.com Wed Oct 14 09:29:09 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 14 09:29:11 2015 Subject: [odb-users] libodb-qt error... QtCore not found... In-Reply-To: References: Message-ID: HI Javier, Javier Estalis writes: > when i use ./configure CPPFLAGS=-I/home/leoxnidas/Qt/5.5/gcc/include > LDFLAGS=-L/home/leoxnidas/qt/5.5/gcc/lib --prefix /home/leoxnidas/Qt/5.5/gcc > > this is the output > > configure: error: QtCore is not found; consider using CPPFLAGS/LDFLAGS to > specify its location... When you get an error from a configure-based build system, the first place you should look is config.log. It can contain quite a bit of stuff, so it makes sense to use search to quickly get to what you are interested in. In this case, 'QtCore' would be a good search term. Also note that there could be multiple tests with some of them failing. So don't just stop at the first error and assume this is the cause. Check further down until you see where the test gives up (i.e., prints the above error, in your case). Having said all this, I am pretty sure the cause of this is the lack of the -fPIC option which Qt5, bizarrely, requires all client code to be built with. Boris From leo.leoxnidas.c.14 at gmail.com Wed Oct 14 20:36:33 2015 From: leo.leoxnidas.c.14 at gmail.com (Javier Estalis) Date: Thu Oct 15 05:48:03 2015 Subject: [odb-users] libodb-qt error... QtCore not found... In-Reply-To: References: Message-ID: well Boris Kolpackov, i found this... /home/leoxnidas/Qt/5.5/gcc/include/QtCore/qglobal.h:1067:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC (-fPIE is not enough)." # error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\ but i am not sure how to use -fPIC; this is my input ... ./configure --with-pic=PIC CPPFLAGS=-I/home/leoxnidas/Qt/5.5/gcc/include LDFLAGS=-L/home/leoxnidas/qt/5.5/gcc/lib --prefix=/home/leoxnidas/Qt/5.5/gcc 2015-10-14 8:59 GMT-04:30 Boris Kolpackov : > HI Javier, > > Javier Estalis writes: > > > when i use ./configure CPPFLAGS=-I/home/leoxnidas/Qt/5.5/gcc/include > > LDFLAGS=-L/home/leoxnidas/qt/5.5/gcc/lib --prefix > /home/leoxnidas/Qt/5.5/gcc > > > > this is the output > > > > configure: error: QtCore is not found; consider using CPPFLAGS/LDFLAGS to > > specify its location... > > When you get an error from a configure-based build system, the first > place you should look is config.log. It can contain quite a bit of > stuff, so it makes sense to use search to quickly get to what you are > interested in. In this case, 'QtCore' would be a good search term. Also > note that there could be multiple tests with some of them failing. So > don't just stop at the first error and assume this is the cause. Check > further down until you see where the test gives up (i.e., prints the > above error, in your case). > > Having said all this, I am pretty sure the cause of this is the lack > of the -fPIC option which Qt5, bizarrely, requires all client code > to be built with. > > Boris > From boris at codesynthesis.com Thu Oct 15 10:33:21 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 15 10:33:21 2015 Subject: [odb-users] libodb-qt error... QtCore not found... In-Reply-To: References: Message-ID: Hi Javier, Javier Estalis writes: > but i am not sure how to use -fPIC; this is my input ... ./configure CXXFLAGS=-fPIC ... Boris From christian at gsvitec.com Fri Oct 16 07:03:34 2015 From: christian at gsvitec.com (Christian Sell) Date: Fri Oct 16 07:03:38 2015 Subject: [odb-users] libodb-qt error... QtCore not found... In-Reply-To: References: Message-ID: <1776235002.3343724.1444993414392.JavaMail.open-xchange@patina.store> try CPPFLAGS=-I/home/leoxnidas/Qt/5.5/gcc/include -fPIC > Javier Estalis hat am 15. Oktober 2015 um 02:36 > geschrieben: > > > well Boris Kolpackov, i found this... > > /home/leoxnidas/Qt/5.5/gcc/include/QtCore/qglobal.h:1067:4: error: #error > "You must build your code with position independent code if Qt was built > with -reduce-relocations. " "Compile your code with -fPIC (-fPIE is not > enough)." > # error "You must build your code with position independent code if Qt > was built with -reduce-relocations. "\ > > but i am not sure how to use -fPIC; this is my input ... > > ./configure --with-pic=PIC CPPFLAGS=-I/home/leoxnidas/Qt/5.5/gcc/include > LDFLAGS=-L/home/leoxnidas/qt/5.5/gcc/lib --prefix=/home/leoxnidas/Qt/5.5/gcc > > 2015-10-14 8:59 GMT-04:30 Boris Kolpackov : > > > HI Javier, > > > > Javier Estalis writes: > > > > > when i use ./configure CPPFLAGS=-I/home/leoxnidas/Qt/5.5/gcc/include > > > LDFLAGS=-L/home/leoxnidas/qt/5.5/gcc/lib --prefix > > /home/leoxnidas/Qt/5.5/gcc > > > > > > this is the output > > > > > > configure: error: QtCore is not found; consider using CPPFLAGS/LDFLAGS to > > > specify its location... > > > > When you get an error from a configure-based build system, the first > > place you should look is config.log. It can contain quite a bit of > > stuff, so it makes sense to use search to quickly get to what you are > > interested in. In this case, 'QtCore' would be a good search term. Also > > note that there could be multiple tests with some of them failing. So > > don't just stop at the first error and assume this is the cause. Check > > further down until you see where the test gives up (i.e., prints the > > above error, in your case). > > > > Having said all this, I am pretty sure the cause of this is the lack > > of the -fPIC option which Qt5, bizarrely, requires all client code > > to be built with. > > > > Boris > > Christian From odb at a-cunningham.com Sat Oct 17 00:49:08 2015 From: odb at a-cunningham.com (Andrew Cunningham) Date: Sat Oct 17 00:49:16 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 Message-ID: I need to build the ODB compiler on CentOS 6.7 to get a patched 2.4.0 ( Thanks Boris!!) However, the GCC on CentOS 6.7 does not support plugins. So I downloaded and installed "Scientific Linux" developer package of GCC 4.8.2 and switched to that as the default compiler. gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/opt/rh/devtoolset-2/root/usr/bin/../libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl= http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) However, ./configure still fails.... ./configure checking whether the g++ linker (/home/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld -m elf_x86_64) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate configure: creating ./config.lt config.lt: creating libtool checking whether g++ supports plugins... no configure: error: g++ does not support plugins; reconfigure GCC with --enable-plugin Any ideas. From davejohansen at gmail.com Sat Oct 17 16:42:45 2015 From: davejohansen at gmail.com (Dave Johansen) Date: Sat Oct 17 16:42:52 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 In-Reply-To: References: Message-ID: On Fri, Oct 16, 2015 at 9:49 PM, Andrew Cunningham wrote: > I need to build the ODB compiler on CentOS 6.7 to get a patched 2.4.0 ( > Thanks Boris!!) > > However, the GCC on CentOS 6.7 does not support plugins. > So I downloaded and installed "Scientific Linux" developer package of GCC > 4.8.2 and switched to that as the default compiler. > > gcc -v > Using built-in specs. > COLLECT_GCC=gcc > > COLLECT_LTO_WRAPPER=/home/opt/rh/devtoolset-2/root/usr/bin/../libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper > Target: x86_64-redhat-linux > Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr > --mandir=/opt/rh/devtoolset-2/root/usr/share/man > --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl= > http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared > --enable-threads=posix --enable-checking=release --with-system-zlib > --enable-__cxa_atexit --disable-libunwind-exceptions > --enable-gnu-unique-object --enable-linker-build-id > --enable-languages=c,c++,fortran,lto --enable-plugin > --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj > > --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install > > --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install > > --with-mpc=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install > --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux > Thread model: posix > gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) > > > However, > ./configure still fails.... > ./configure > checking whether the g++ linker > > (/home/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld > -m elf_x86_64) supports shared libraries... yes > checking dynamic linker characteristics... (cached) GNU/Linux ld.so > checking how to hardcode library paths into programs... immediate > configure: creating ./config.lt > config.lt: creating libtool > checking whether g++ supports plugins... no > configure: error: g++ does not support plugins; reconfigure GCC with > --enable-plugin > > Any ideas. > http://dl.fedoraproject.org/pub/epel/7/SRPMS/o/odb-2.3.0-6.el7.src.rpm The .spec file I use for EPEL/Fedora supports building on RHEL 6 with devtoolset. I've meant to setup a COPR with it, but just haven't gotten around to it. I'll see if I can take care of that in the next few days. From davejohansen at gmail.com Sun Oct 18 01:05:27 2015 From: davejohansen at gmail.com (Dave Johansen) Date: Sun Oct 18 01:05:34 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 In-Reply-To: References: Message-ID: On Sat, Oct 17, 2015 at 1:42 PM, Dave Johansen wrote: > On Fri, Oct 16, 2015 at 9:49 PM, Andrew Cunningham > wrote: > >> I need to build the ODB compiler on CentOS 6.7 to get a patched 2.4.0 ( >> Thanks Boris!!) >> >> However, the GCC on CentOS 6.7 does not support plugins. >> So I downloaded and installed "Scientific Linux" developer package of GCC >> 4.8.2 and switched to that as the default compiler. >> >> gcc -v >> Using built-in specs. >> COLLECT_GCC=gcc >> >> COLLECT_LTO_WRAPPER=/home/opt/rh/devtoolset-2/root/usr/bin/../libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper >> Target: x86_64-redhat-linux >> Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr >> --mandir=/opt/rh/devtoolset-2/root/usr/share/man >> --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl= >> http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared >> --enable-threads=posix --enable-checking=release --with-system-zlib >> --enable-__cxa_atexit --disable-libunwind-exceptions >> --enable-gnu-unique-object --enable-linker-build-id >> --enable-languages=c,c++,fortran,lto --enable-plugin >> --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj >> >> --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install >> >> --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install >> >> --with-mpc=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install >> --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux >> Thread model: posix >> gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) >> >> >> However, >> ./configure still fails.... >> ./configure >> checking whether the g++ linker >> >> (/home/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld >> -m elf_x86_64) supports shared libraries... yes >> checking dynamic linker characteristics... (cached) GNU/Linux ld.so >> checking how to hardcode library paths into programs... immediate >> configure: creating ./config.lt >> config.lt: creating libtool >> checking whether g++ supports plugins... no >> configure: error: g++ does not support plugins; reconfigure GCC with >> --enable-plugin >> >> Any ideas. >> > > http://dl.fedoraproject.org/pub/epel/7/SRPMS/o/odb-2.3.0-6.el7.src.rpm > The .spec file I use for EPEL/Fedora supports building on RHEL 6 with > devtoolset. I've meant to setup a COPR with it, but just haven't gotten > around to it. I'll see if I can take care of that in the next few days. > Here's the COPR for 2.3 and 2.4: https://copr.fedoraproject.org/coprs/daveisfera/odb_2.3_cern/ https://copr.fedoraproject.org/coprs/daveisfera/odb_2.4_cern/ From odb at a-cunningham.com Sun Oct 18 01:30:14 2015 From: odb at a-cunningham.com (Andrew Cunningham) Date: Sun Oct 18 01:30:22 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 In-Reply-To: References: Message-ID: Hi Dave, Thanks for that. But i'm a bit lost. Does what you pointed me to allow me to build ODB 2.4.0-2 from source provided by Boris? I already have the pre-built 2.4.0. I need to build the patched version.... Andrew On Sat, Oct 17, 2015 at 10:05 PM, Dave Johansen wrote: > On Sat, Oct 17, 2015 at 1:42 PM, Dave Johansen > wrote: > >> On Fri, Oct 16, 2015 at 9:49 PM, Andrew Cunningham >> wrote: >> >>> I need to build the ODB compiler on CentOS 6.7 to get a patched 2.4.0 ( >>> Thanks Boris!!) >>> >>> However, the GCC on CentOS 6.7 does not support plugins. >>> So I downloaded and installed "Scientific Linux" developer package of GCC >>> 4.8.2 and switched to that as the default compiler. >>> >>> gcc -v >>> Using built-in specs. >>> COLLECT_GCC=gcc >>> >>> COLLECT_LTO_WRAPPER=/home/opt/rh/devtoolset-2/root/usr/bin/../libexec/gcc/x86_64-redhat-linux/4.8.2/lto-wrapper >>> Target: x86_64-redhat-linux >>> Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr >>> --mandir=/opt/rh/devtoolset-2/root/usr/share/man >>> --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl= >>> http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared >>> --enable-threads=posix --enable-checking=release --with-system-zlib >>> --enable-__cxa_atexit --disable-libunwind-exceptions >>> --enable-gnu-unique-object --enable-linker-build-id >>> --enable-languages=c,c++,fortran,lto --enable-plugin >>> --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj >>> >>> --with-isl=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/isl-install >>> >>> --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/cloog-install >>> >>> --with-mpc=/builddir/build/BUILD/gcc-4.8.2-20140120/obj-x86_64-redhat-linux/mpc-install >>> --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux >>> Thread model: posix >>> gcc version 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) >>> >>> >>> However, >>> ./configure still fails.... >>> ./configure >>> checking whether the g++ linker >>> >>> (/home/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.2/ld >>> -m elf_x86_64) supports shared libraries... yes >>> checking dynamic linker characteristics... (cached) GNU/Linux ld.so >>> checking how to hardcode library paths into programs... immediate >>> configure: creating ./config.lt >>> config.lt: creating libtool >>> checking whether g++ supports plugins... no >>> configure: error: g++ does not support plugins; reconfigure GCC with >>> --enable-plugin >>> >>> Any ideas. >>> >> >> http://dl.fedoraproject.org/pub/epel/7/SRPMS/o/odb-2.3.0-6.el7.src.rpm >> The .spec file I use for EPEL/Fedora supports building on RHEL 6 with >> devtoolset. I've meant to setup a COPR with it, but just haven't gotten >> around to it. I'll see if I can take care of that in the next few days. >> > > Here's the COPR for 2.3 and 2.4: > https://copr.fedoraproject.org/coprs/daveisfera/odb_2.3_cern/ > https://copr.fedoraproject.org/coprs/daveisfera/odb_2.4_cern/ > From shenshuqing at 126.com Sun Oct 18 10:07:48 2015 From: shenshuqing at 126.com (=?GBK?B?yfLTog==?=) Date: Mon Oct 19 11:01:18 2015 Subject: [odb-users] Garbled error when dealing with chinese character Message-ID: <3b4fac16.6bae.1507b471943.Coremail.shenshuqing@126.com> Hello, My question is : when the MySQL database table is acessed by ODB, if there are some chinese characters in the table object, garbled error will occurs, such as "???". thanks, Silvia From boris at codesynthesis.com Mon Oct 19 11:04:21 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 19 11:04:20 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 In-Reply-To: References: Message-ID: Hi Andrew, Andrew Cunningham writes: > Does what you pointed me to allow me to build ODB 2.4.0-2 from source > provided by Boris? I already have the Check how the .spec file configures the ODB compiler. Both you and .spec (presumably) are using the same GCC from devtools. Boris From odb at a-cunningham.com Mon Oct 19 11:26:54 2015 From: odb at a-cunningham.com (Andrew Cunningham) Date: Mon Oct 19 11:27:02 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 In-Reply-To: References: Message-ID: Actually the missing part is the "gcc-4.8-plugin-dev" package that is missing from "devtoolset-2" I was able build ODB on Ubuntu 14.0.4 by getting that package, but that does me no good as I need to run the ODB compiler running on CentOS 6.7 On Mon, Oct 19, 2015 at 8:04 AM, Boris Kolpackov wrote: > Hi Andrew, > > Andrew Cunningham writes: > > > Does what you pointed me to allow me to build ODB 2.4.0-2 from source > > provided by Boris? I already have the > > Check how the .spec file configures the ODB compiler. Both you and > .spec (presumably) are using the same GCC from devtools. > > Boris > From odb at a-cunningham.com Mon Oct 19 11:33:46 2015 From: odb at a-cunningham.com (Andrew Cunningham) Date: Mon Oct 19 11:33:54 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 In-Reply-To: References: Message-ID: Update: I found what I needed yum install devtoolset-2-gcc-plugin-devel Andrew On Mon, Oct 19, 2015 at 8:26 AM, Andrew Cunningham wrote: > Actually the missing part is the "gcc-4.8-plugin-dev" package that is > missing from "devtoolset-2" > > I was able build ODB on Ubuntu 14.0.4 by getting that package, but that > does me no good as I need to run the ODB compiler running on CentOS 6.7 > > > On Mon, Oct 19, 2015 at 8:04 AM, Boris Kolpackov > wrote: > >> Hi Andrew, >> >> Andrew Cunningham writes: >> >> > Does what you pointed me to allow me to build ODB 2.4.0-2 from source >> > provided by Boris? I already have the >> >> Check how the .spec file configures the ODB compiler. Both you and >> .spec (presumably) are using the same GCC from devtools. >> >> Boris >> > > From odb at a-cunningham.com Mon Oct 19 13:51:26 2015 From: odb at a-cunningham.com (Andrew Cunningham) Date: Mon Oct 19 13:51:35 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 In-Reply-To: References: Message-ID: Finally won the battle and built ODB on CentOS 6.7 On Mon, Oct 19, 2015 at 8:33 AM, Andrew Cunningham wrote: > Update: I found what I needed > > yum install devtoolset-2-gcc-plugin-devel > > Andrew > > > > On Mon, Oct 19, 2015 at 8:26 AM, Andrew Cunningham > wrote: > >> Actually the missing part is the "gcc-4.8-plugin-dev" package that is >> missing from "devtoolset-2" >> >> I was able build ODB on Ubuntu 14.0.4 by getting that package, but that >> does me no good as I need to run the ODB compiler running on CentOS 6.7 >> >> >> On Mon, Oct 19, 2015 at 8:04 AM, Boris Kolpackov > > wrote: >> >>> Hi Andrew, >>> >>> Andrew Cunningham writes: >>> >>> > Does what you pointed me to allow me to build ODB 2.4.0-2 from source >>> > provided by Boris? I already have the >>> >>> Check how the .spec file configures the ODB compiler. Both you and >>> .spec (presumably) are using the same GCC from devtools. >>> >>> Boris >>> >> >> > From Steve.Hales at garmin.com Tue Oct 20 12:46:10 2015 From: Steve.Hales at garmin.com (Hales, Steve) Date: Tue Oct 20 13:02:28 2015 Subject: [odb-users] How to create an object view that has a self join Message-ID: I have three tables: persons, families and family_members. The family_members table provides a many-to-many relationship between persons and families. (In my system, a person can be a member of many families.) I have successfully created ODB persistent objects for all three tables: #pragma db object class person { #pragma db id unsigned long id_; std::string name_; #pragma db value_not_null inverse(person_) std::vector> family_members_; }; #pragma db object class family { #pragma db id unsigned long id_; std::string name_; #pragma db value_not_null inverse(family_) std::vector> family_members_; }; #pragma db object class family_member { #pragma db id unsigned long id_; #pragma db not_null odb::lazy_shared_ptr person_; #pragma db not_null odb::lazy_shared_ptr family_; }; Now, I need to create an object view that has a self join on the family_members table so that, given a person ID, I can get all persons that are members of the families for that person. Here is my failed attempt: #pragma db view \ object(person) \ object(family_member) \ object(family_member = fm2 inner : family_member::family_) struct person_view { std::shared_ptr person_; }; Here is the working SQL query for this self join: SELECT 'persons'.* FROM 'persons' INNER JOIN 'family_members' ON 'family_members'.'person' = 'persons'.'id' INNER JOIN 'family_members' as fm2 ON 'family_members'.'family' = fm2.'family' WHERE fm2.'person_id? = ? Thanks in advance for your help. - Steve ________________________________ CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be confidential and/or legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you. From boris at codesynthesis.com Wed Oct 21 09:51:42 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 21 09:51:38 2015 Subject: [odb-users] How to create an object view that has a self join In-Reply-To: References: Message-ID: Hi Steve, Hales, Steve writes: > #pragma db object > class person > { > #pragma db id > unsigned long id_; > std::string name_; > #pragma db value_not_null inverse(person_) > std::vector> family_members_; > }; > > #pragma db object > class family > { > #pragma db id > unsigned long id_; > std::string name_; > #pragma db value_not_null inverse(family_) > std::vector> family_members_; > }; > > #pragma db object > class family_member > { > #pragma db id > unsigned long id_; > #pragma db not_null > odb::lazy_shared_ptr person_; > #pragma db not_null > odb::lazy_shared_ptr family_; > }; > > Now, I need to create an object view that has a self join on the > family_members table so that, given a person ID, I can get all persons > that are members of the families for that person. Here is my failed > attempt: > > #pragma db view \ > object(person) \ > object(family_member) \ > object(family_member = fm2 inner : family_member::family_) > struct person_view > { > std::shared_ptr person_; > }; How does it fail? Don't just say "it doesn't work", it is not helpful. Be specific (error messages, query you get, etc). > Here is the working SQL query for this self join: > SELECT > 'persons'.* > FROM > 'persons' > INNER JOIN > 'family_members' > ON 'family_members'.'person' = 'persons'.'id' > INNER JOIN > 'family_members' as fm2 > ON 'family_members'.'family' = fm2.'family' > WHERE > fm2.'person_id? = ? The last JOIN is not based on the object relationship, so you will need to spell the condition explicitly: object(family_member = fm2 inner: fm2::family_ == family_member::family_) Also you may want to add 'inner' to the first family_member object that you have in the view. Boris From boris at codesynthesis.com Wed Oct 21 10:01:20 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 21 10:01:16 2015 Subject: [odb-users] Garbled error when dealing with chinese character In-Reply-To: <3b4fac16.6bae.1507b471943.Coremail.shenshuqing@126.com> References: <3b4fac16.6bae.1507b471943.Coremail.shenshuqing@126.com> Message-ID: Hi Silvia, ?? writes: > when the MySQL database table is acessed by ODB, if there are some > chinese characters in the table object, garbled error will occurs, > such as "???". You would need to provide a lot more detailed information than "garbled error will occurs" to know for sure what's going on. Having said that, I am pretty sure it has to do with the character encoding that the MySQL client side is using. Take a look at the 'charset' argument in Section 17.2, "MySQL Database Class". Here is the relevant paragraph: "The charset argument allows us to specify the client character set, that is, the character set in which the application will encode its text data. Note that this can be different from the MySQL server character set. If this argument is not specified or is empty, then the default MySQL client character set is used, normally latin1. Commonly used values for this argument are latin1 (equivalent to Windows cp1252 and similar to ISO-8859-1) and utf8. For other possible values as well as more information on character set support in MySQL, refer to the MySQL documentation." Boris From a.pasternak at mt-robot.com Wed Oct 21 10:23:51 2015 From: a.pasternak at mt-robot.com (Andreas Pasternak MT-Robot AG) Date: Wed Oct 21 10:23:34 2015 Subject: [odb-users] Object and value at the same time. Message-ID: <20151021162351.EGroupware.43lmHelMF3mSrQpzEaFKPSx@10.0.0.38> Hello all, I have a C++ class which I want to use as a value and an object in different contexts: #pragma db value and object __________________________________________________ MT Robot AG Riedstrasse 16 CH-4222 Zwingen Tel. - +41 (0)61 775 20 20 Direkt - +41 (0)61 775 20 26 Mobile - +41 (0)76 489 21 16 Fax - +41 (0)61 775 20 21 Email - [ mailto:a.pasternak%40mt-robot.com -> a.pasternak@mt-robot.com ] Web - www.mt-robot.com Diese E-Mail k?nnte vertrauliche und/oder rechtlich gesch?tzte Informationen enthalten.Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrt?mlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail sind nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipien From a.pasternak at mt-robot.com Wed Oct 21 10:31:55 2015 From: a.pasternak at mt-robot.com (Andreas Pasternak) Date: Wed Oct 21 10:31:58 2015 Subject: [odb-users] Object and value at the same time. Message-ID: <5627A1DB.6040502@mt-robot.com> Hello all, I have a C++ class which I want to use as a value and an object in different contexts: #pragma db value and object // This command is missing for me class Foo { int id; } #pragma db object class Bar{ Foo m_member; } Bar bar; Foo foo; db.persist(bar) db.persit(foo) I can either use Foo in Bar OR I can persist foo. Not both at the same time. Of course I can always create object with the value as member but I'd like to avoid that. Best regards, Andreas From boris at codesynthesis.com Wed Oct 21 13:41:31 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Oct 21 13:41:26 2015 Subject: [odb-users] Object and value at the same time. In-Reply-To: <5627A1DB.6040502@mt-robot.com> References: <5627A1DB.6040502@mt-robot.com> Message-ID: Hi Andreas, Andreas Pasternak writes: > I have a C++ class which I want to use as a value and an object in > different contexts: > > #pragma db value and object // This command is missing for me > class Foo { > int id; > } > #pragma db object > class Bar{ > Foo m_member; > } No, this is not possible. In ODB each C++ type can either be a value (simple or composite), a persistent object, or a view. If you really, absolutely must make this work (for example, because Foo contains a large number of data member that you would like to avoid repeating), then you could make Foo a class template and instantiate two (distinct) C++ types out of it: template class Foo { ... }; struct ValueTag {}; struct ObjectTag {}; using FooValue = Foo; using FooObject = Foo; #pragma db value(FooValue) #pragma db object(FooObject) As you can see, this is quite hairy and I would strongly recommend avoiding this approach if at all possible. Boris From davejohansen at gmail.com Sun Oct 25 23:54:34 2015 From: davejohansen at gmail.com (Dave Johansen) Date: Sun Oct 25 23:54:41 2015 Subject: [odb-users] Building ODB compiler on Centos 6.7 In-Reply-To: References: Message-ID: It sounds like you got it working, but the hope of COPR repos is that they serve as a centralized location for things like this so that everyone can share the testing and development benefits in a "semi-official" sort of way. Basically, if you got a chance to try using the COPR repo, then it would potentially benefit the community as a whole and hopefully prevent other from having to jump through the hoops that you did. On Mon, Oct 19, 2015 at 10:51 AM, Andrew Cunningham wrote: > Finally won the battle and built ODB on CentOS 6.7 > > > On Mon, Oct 19, 2015 at 8:33 AM, Andrew Cunningham > wrote: > >> Update: I found what I needed >> >> yum install devtoolset-2-gcc-plugin-devel >> >> Andrew >> >> >> >> On Mon, Oct 19, 2015 at 8:26 AM, Andrew Cunningham >> wrote: >> >>> Actually the missing part is the "gcc-4.8-plugin-dev" package that is >>> missing from "devtoolset-2" >>> >>> I was able build ODB on Ubuntu 14.0.4 by getting that package, but that >>> does me no good as I need to run the ODB compiler running on CentOS 6.7 >>> >>> >>> On Mon, Oct 19, 2015 at 8:04 AM, Boris Kolpackov < >>> boris@codesynthesis.com> wrote: >>> >>>> Hi Andrew, >>>> >>>> Andrew Cunningham writes: >>>> >>>> > Does what you pointed me to allow me to build ODB 2.4.0-2 from source >>>> > provided by Boris? I already have the >>>> >>>> Check how the .spec file configures the ODB compiler. Both you and >>>> .spec (presumably) are using the same GCC from devtools. >>>> >>>> Boris >>>> >>> >>> >> > From msalihcaliskan at gmail.com Mon Oct 26 04:45:16 2015 From: msalihcaliskan at gmail.com (=?UTF-8?B?TWVobWV0IFNhbGloIMOHYWzEscWfa2Fu?=) Date: Mon Oct 26 06:54:48 2015 Subject: [odb-users] odb compiler error: The system cannot find the path specified Message-ID: <562DE81C.20801@gmail.com> Hello, I am using odb on my ubuntu system successfully however, when I want to port the code to windows system, I can't manage to run odb compiler. I follow the procedures below to build system: - I downloaded the "odb-2.4.0-i686-windows" package - I build "libodb-2.4.0" and "libodb-sqlite-2.4.0" by using mingw. I can run "odb --version" without an error however, when I run "odb -d sqlite --generate-query --generate-schema person.hxx" command in "hello" sample folder from mingw command prompt, I get an error as below: "odb.exe: error: The system cannot find the path specified." mingw local/lib folder content is below: - libodb.a - libodb.la - libodb.dll.a - libodb-sqlite.a - libodb-sqlite.la - libodb-sqlite.dll.a mingw local/bin folder content is below: - libodb-2-4.dll - libodb-sqlite-2-4.dll Thank you in advance for your kind concern. Salih. From boris at codesynthesis.com Mon Oct 26 12:00:47 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Oct 26 12:00:51 2015 Subject: [odb-users] odb compiler error: The system cannot find the path specified In-Reply-To: <562DE81C.20801@gmail.com> References: <562DE81C.20801@gmail.com> Message-ID: Hi, Mehmet Salih ?al??kan writes: > I can run "odb --version" without an error however, when I run "odb > -d sqlite --generate-query --generate-schema person.hxx" command in > "hello" sample folder from mingw command prompt, I get an error as > below: > > "odb.exe: error: The system cannot find the path specified." My guess is that you copied/moved odb.exe somewhere. If you have, shame on you; the README file explicitly tells you not to: "Note also that while you can move the ODB compiler directory around, you cannot move the individual sub-directories or files inside it. For example, copying the ODB compiler executable to C:\Windows will not work." If you haven't copied/moved odb.exe, then could you run this test for me: 1. Unpack ODB to c:/ 2. From your MinGW shell, run the command line that produces the error but using the absolute ODB compiler path, e.g., /c/odb-2.4.0-i686-linux-gnu/bin/odb -d sqlite ... 3. If that still doesn't work, start the MinGW shell that comes with the ODB compiler: /c/odb-2.4.0-i686-linux-gnu/mingw/msys.bat And try the same command line as in step #2 above. Boris From msalihcaliskan at gmail.com Mon Oct 26 16:46:50 2015 From: msalihcaliskan at gmail.com (msalihcaliskan) Date: Tue Oct 27 00:15:30 2015 Subject: [odb-users] odb compiler error: The system cannot find the path specified In-Reply-To: References: <562DE81C.20801@gmail.com> Message-ID: Hello Boris, Thank you for your prompt reply, Yes, shame on me. I totaly misunderstood the warning that mentioned in the README and merged the odb compiler folders with my mingw environment. When I reset the content and used full path for odb compiler, everything works. Thank you again. 2015-10-26 18:00 GMT+02:00 Boris Kolpackov : > Hi, > > Mehmet Salih ?al??kan writes: > > > I can run "odb --version" without an error however, when I run "odb > > -d sqlite --generate-query --generate-schema person.hxx" command in > > "hello" sample folder from mingw command prompt, I get an error as > > below: > > > > "odb.exe: error: The system cannot find the path specified." > > My guess is that you copied/moved odb.exe somewhere. If you have, > shame on you; the README file explicitly tells you not to: > > "Note also that while you can move the ODB compiler directory around, > you cannot move the individual sub-directories or files inside it. For > example, copying the ODB compiler executable to C:\Windows will not > work." > > If you haven't copied/moved odb.exe, then could you run this test for > me: > > 1. Unpack ODB to c:/ > > 2. From your MinGW shell, run the command line that produces the error > but using the absolute ODB compiler path, e.g., > > /c/odb-2.4.0-i686-linux-gnu/bin/odb -d sqlite ... > > 3. If that still doesn't work, start the MinGW shell that comes with > the ODB compiler: > > /c/odb-2.4.0-i686-linux-gnu/mingw/msys.bat > > And try the same command line as in step #2 above. > > Boris > From xiang.zhao at gamegou.com Mon Oct 26 23:30:46 2015 From: xiang.zhao at gamegou.com (=?utf-8?B?WmhhbyBYaWFuZw==?=) Date: Tue Oct 27 00:15:30 2015 Subject: [odb-users] std::transform changes the begin iterator Message-ID: Dear ODB support, I'm currently using odb 2.4.0, and I think I've found a bug with odb::result and std::transform. My code is like below: odb::result players = db.query(...); std::vector playerIds; playerIds.resize(players.size()); std::transform(players.begin(), players.end(), playerIds.begin(), [](const user_player& p) { return p.key.player_id; }); assert(players.size() > 0);//ok assert(players.begin() != players.end());//oops After some debug I noticed the value of players.begin() is changed after the std::transform call. So I think this is a bug in odb's iterator implementation. Regards Zhao Xiang From boris at codesynthesis.com Tue Oct 27 08:50:20 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 27 08:50:27 2015 Subject: [odb-users] std::transform changes the begin iterator In-Reply-To: References: Message-ID: Hi, Zhao Xiang writes: > odb::result players = db.query(...); > > std::vector playerIds; > playerIds.resize(players.size()); > std::transform(players.begin(), players.end(), playerIds.begin(), ...); > > assert(players.size() > 0);//ok > assert(players.begin() != players.end());//oops > > After some debug I noticed the value of players.begin() is changed > after the std::transform call. >From Section 4.4, "Query Result": "It is best to view an instance of odb::result as a handle to a stream, such as a socket stream. While we can make a copy of a result or assign one result to another, the two instances will refer to the same result stream. Advancing the current position in one instance will also advance it in another." And: "The result iterator is an input iterator which means that the only two position operations that it supports are to move to the next object and to determine whether the end of the result stream has been reached. In fact, the result iterator can only be in two states: the current position and the end position. If we have two iterators pointing to the current position and then we advance one of them, the other will advance as well." Which means that after you have iterated over the result, (in transform()), you cannot re-iterate over it without re-executing the query. Boris