From christian at gsvitec.com Thu Jan 1 08:07:50 2015 From: christian at gsvitec.com (Christian Sell) Date: Thu Jan 1 08:07:53 2015 Subject: [odb-users] let class members default to transient In-Reply-To: References: <123392944.425877.1419879294466.JavaMail.open-xchange@omgreatgod.store> Message-ID: <1605870321.607874.1420117670703.JavaMail.open-xchange@omgreatgod.store> ah, thanks. Since my objective was to simplify the whole process, I think I will stick with explicitly declaring all non-mapped members as transient. > Boris Kolpackov hat am 30. Dezember 2014 um 14:50 > geschrieben: > > > Hi Christian, > > Christian Sell writes: > > > I have several classes which contain only a few members that are > > mapped to the database, while most members are transient only. Now > > I am looking for a way to tell the compiler to only consider those > > members that are explcitly mapped through member pragmas, and leave > > the others alone. Currently, it seems like I have to put a "#pragma > > transient" alongside each of the non-mapped members. > > > > I tried "db object(myclass) transient", but that seems to cause the > > compiler to even ignore the explicitly mapped members.. > > Yes, you almost got to the solution. The last step in achieving what > you want is to define virtual data members for the ones that are > persistent: > > #pragma db object transient > struct my_object > { > ... // Lots more data members that we don't want in the database. > > unsigned int id_; > std::string str_; > }; > > #pragma db member(my_object::id) virtual(unsigned int) access(id_) id auto > #pragma db member(my_object::str) virtual(std::string) access(str_) > > This mechanism is described in more detail in Section 14.4.13, "virtual". > > Boris From picserez at gmail.com Thu Jan 1 03:57:37 2015 From: picserez at gmail.com (Erez Pics) Date: Sat Jan 3 10:33:12 2015 Subject: [odb-users] Persisting objects after ID change In-Reply-To: References: Message-ID: Hi Boris, Thanks, I will look into that :-) Assuming, I am planning to use a generic query executer to perform these updates, I will pass the ODB object and it's old and new IDs and it will execute a custom update query, Is there a way to get from any ODB object it's table name and it's id field ? Thank you very much for your help and support, Erez. On Wed, Dec 31, 2014 at 7:39 PM, Boris Kolpackov wrote: > Hi Erez, > > Erez Pics writes: > >> Do you think that there is a problem with my update query and ODB >> using the new object id after the change ? > > There is nothing wrong with executing a custom UPDATE statement. One > advantage of my method, however, is that it uses prepared statements > and therefore could be more efficient. Also, you will need to think > about other ODB facilities that may mis-function (or need adjustment) > after the id change. One that comes to mind off the top of my head > is the object cache, if you are using it. > > Boris > From boris at codesynthesis.com Mon Jan 5 05:41:27 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jan 5 05:50:25 2015 Subject: [odb-users] Persisting objects after ID change In-Reply-To: References: Message-ID: Hi Erez, Erez Pics writes: > Is there a way to get from any ODB object it's table name If you are generating query support (--generate-query/-q), then the table name (as const char* string) can be obtained like this: odb::object_traits_impl::table_name Where T is the object type. > and it's id field ? There is no way to get the name of the column corresponding to the object id. So I suggest that you either use the same data member name for all your object ids (e.g., id_) and then use the column name that ODB derives. Or you can assign the column name explicitly with the 'column' pragma. Boris From christian at gsvitec.com Tue Jan 6 14:05:23 2015 From: christian at gsvitec.com (Christian Sell) Date: Tue Jan 6 14:05:22 2015 Subject: [odb-users] "unable to extract profile path" Message-ID: <001d01d029e3$b93b7160$2bb25420$@gsvitec.com> Hello, unfortunately I am forced to build + deploy our app on OSX (Yosemite). Now, when running the odb command, I see an error "unable to extract profile path". Has anything been achieved in this regard that would provide an easy solution? Thanks Christian From newzai.chen at anchormobile.com Tue Jan 6 23:55:58 2015 From: newzai.chen at anchormobile.com (newzai.chen) Date: Wed Jan 7 04:32:55 2015 Subject: [odb-users] can I using one object class map to multi table? Message-ID: <201501071255578434277@anchormobile.com> 1. each table schema is the same. 2. each object when persist\update\erase\load pass table name to odb connection. newzai.chen From newzai.chen at anchormobile.com Tue Jan 6 23:58:15 2015 From: newzai.chen at anchormobile.com (newzai.chen) Date: Wed Jan 7 04:32:55 2015 Subject: [odb-users] a odb connection map to multi database instance Message-ID: <201501071258153905829@anchormobile.com> 1. on mysql ,has multi database 2. I want using one odb connection to operator multi database . newzai.chen From boris at codesynthesis.com Wed Jan 7 04:38:50 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jan 7 04:47:43 2015 Subject: [odb-users] can I using one object class map to multi table? In-Reply-To: <201501071255578434277@anchormobile.com> References: <201501071255578434277@anchormobile.com> Message-ID: Hi, newzai.chen writes: > 1. each table schema is the same. > 2. each object when persist\update\erase\load pass table name to > odb connection. No, each persistent object is mapped to a fixed (in the generated code) table. The only way to achieve kind of what you want is to switch default schema (aka namespace) on the connection (if your database supports schemas) or to use different databases. Boris From boris at codesynthesis.com Wed Jan 7 04:49:59 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jan 7 04:58:53 2015 Subject: [odb-users] a odb connection map to multi database instance In-Reply-To: <201501071258153905829@anchormobile.com> References: <201501071258153905829@anchormobile.com> Message-ID: Hi, newzai.chen writes: > 1. on mysql ,has multi database > 2. I want using one odb connection to operator multi database . I am not sure what you mean by "operator". If you want to map persistent classes to tables in different databases, then this is possible (statically) using the database schema support in ODB. See Section 14.1.8, "schema" in the ODB manual for details. Alternatively, you can use the mysql_select_db() MySQL C API function to change the default database on a connection. For example: namespace mysql = odb::mysql; mysql::database db (...); mysql::connection_ptr cp (db.connection ()); mysql_select_db (cp->handle (), "my_other_db"); Boris From christian at gsvitec.com Wed Jan 7 10:28:01 2015 From: christian at gsvitec.com (Christian Sell) Date: Wed Jan 7 10:27:59 2015 Subject: [odb-users] error "unable to extract profile path" under OS/X 10.10 Message-ID: <000a01d02a8e$85f8ebb0$91eac310$@gsvitec.com> Hello, I recently wrote a post regarding an issue running the prebuilt odb binary under OS/X Yosemite. I always see an error message "unable to extract profile path" which, according to another thread on this list, is caused by ODB's GCC backend crashing. That other thread leads to the recommendation to rebuild the complete suite including GCC and ODB, but it also includes Boris's statement that he would look into this. That was in September last year. My question: is there or will there be official OS X 10.10 (Yosemite) support anytime soon? Rebuilding ODB and GCC from source is a non-trivial task (especially given GCCs dependency trail), and it would be stupid if everyone had to go through that. I'd be willing to contribute, if that's the issue Thanks, Chris From newzai.chen at anchormobile.com Wed Jan 7 05:12:08 2015 From: newzai.chen at anchormobile.com (newzai.chen) Date: Thu Jan 8 04:29:30 2015 Subject: [odb-users] a odb connection map to multi database instance References: <201501071258153905829@anchormobile.com>, Message-ID: <2015010718120751509513@anchormobile.com> thanks you.. mysql_select_db (cp->handle (), "my_other_db"); is very important..thanks you!!!! newzai.chen From: Boris Kolpackov Date: 2015-01-07 17:49 To: newzai.chen CC: odb-users Subject: Re: [odb-users] a odb connection map to multi database instance Hi, newzai.chen writes: > 1. on mysql ,has multi database > 2. I want using one odb connection to operator multi database . I am not sure what you mean by "operator". If you want to map persistent classes to tables in different databases, then this is possible (statically) using the database schema support in ODB. See Section 14.1.8, "schema" in the ODB manual for details. Alternatively, you can use the mysql_select_db() MySQL C API function to change the default database on a connection. For example: namespace mysql = odb::mysql; mysql::database db (...); mysql::connection_ptr cp (db.connection ()); mysql_select_db (cp->handle (), "my_other_db"); Boris From boris at codesynthesis.com Thu Jan 8 04:28:00 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jan 8 04:36:53 2015 Subject: [odb-users] error "unable to extract profile path" under OS/X 10.10 In-Reply-To: <000a01d02a8e$85f8ebb0$91eac310$@gsvitec.com> References: <000a01d02a8e$85f8ebb0$91eac310$@gsvitec.com> Message-ID: Hi Christian, Christian Sell writes: > is there or will there be official OS X 10.10 (Yosemite) support > anytime soon? Yes, I will look into this for the next release which is planned for around end-Jan. > Rebuilding ODB and GCC from source is a non-trivial task [...] Adnan RIHAN has created a Homebrew package for the ODB compiler which makes building from source on Yosemite quite easy: http://codesynthesis.com/pipermail/odb-users/2014-November/002209.html Just make sure you don't build ODB runtimes (libodb, etc) via Brew since that will lead to all sorts of trouble. Boris From finjulhich at gmail.com Fri Jan 9 08:48:25 2015 From: finjulhich at gmail.com (MM) Date: Fri Jan 9 08:48:32 2015 Subject: [odb-users] sqlite column removal by copying table to new database Message-ID: I have had to remove columns and I have followed odb schema migration, and use the sql generated by odb to do it and it works, ie in sqlite, the columns are set to null The xml file is also in sync with that now. If I copy my entire sqlite database file to a new database just to actually remove those unwanted columns, would the C++ generated by odb still work on the new database ? rds, From boris at codesynthesis.com Mon Jan 12 06:37:27 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jan 12 06:46:18 2015 Subject: [odb-users] sqlite column removal by copying table to new database In-Reply-To: References: Message-ID: Hi, MM writes: > If I copy my entire sqlite database file to a new database just to actually > remove those unwanted columns, would the C++ generated by odb still work on > the new database? Yes, this will work. Once the column is "logically" removed, ODB will never refer to it. Boris From kcm7 at case.edu Sat Jan 17 10:54:18 2015 From: kcm7 at case.edu (Kenneth Moses) Date: Mon Jan 19 08:21:41 2015 Subject: [odb-users] 22021: ERROR: invalid byte sequence for encoding "UTF8": 0x93 Message-ID: Hello, I am running a PostgreSQL database and compiling ODB with gcc 4.9.2. The code compiles just fine. However, I receive the above error when attempting to persist an object. I have put a standard tracer within the transaction and the error occurs every time at the same line. The SQL line is an INSERT INTO command and does not appear to have any non-standard text in it. I have run the exact same code (it was pulled from a repository online) on several other machines and I do not receive the error. Any insight on the problem would be much appreciated. Please let me know if there is any other information that might be useful in troubleshooting the problem. Thank you for your time, Ken From boris at codesynthesis.com Mon Jan 19 08:26:34 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jan 19 08:35:23 2015 Subject: [odb-users] 22021: ERROR: invalid byte sequence for encoding "UTF8": 0x93 In-Reply-To: References: Message-ID: Hi Kenneth, Kenneth Moses writes: > I am running a PostgreSQL database and compiling ODB with gcc 4.9.2. The > code compiles just fine. However, I receive the above error when attempting > to persist an object. I have put a standard tracer within the transaction > and the error occurs every time at the same line. The SQL line is an INSERT > INTO command and does not appear to have any non-standard text in it. I > have run the exact same code (it was pulled from a repository online) on > several other machines and I do not receive the error. Since this works on other PostgreSQL setups, my guess would be that the default TEXT data type's character encoding is UTF-8 on the setup that gives you the error while on the other machines it is something else (e.g., ISO-8859-1). Boris From kenneth.moses at gmail.com Mon Jan 19 12:02:04 2015 From: kenneth.moses at gmail.com (Kenneth Moses) Date: Tue Jan 20 10:31:46 2015 Subject: [odb-users] 22021: ERROR: invalid byte sequence for encoding "UTF8": 0x93 In-Reply-To: References: Message-ID: Hello Boris, Thank you for the quick response. I double checked that all systems character encoding are set to UTF-8. Unfortunately, that does not seem to be the issue here. I have done some drastic measures thus far such as re-installing PostgreSQL to see if that would fix the problem but no luck. I will let you know if I come up with a solution. -Ken On Mon, Jan 19, 2015 at 8:26 AM, Boris Kolpackov wrote: > Hi Kenneth, > > Kenneth Moses writes: > > > I am running a PostgreSQL database and compiling ODB with gcc 4.9.2. The > > code compiles just fine. However, I receive the above error when > attempting > > to persist an object. I have put a standard tracer within the transaction > > and the error occurs every time at the same line. The SQL line is an > INSERT > > INTO command and does not appear to have any non-standard text in it. I > > have run the exact same code (it was pulled from a repository online) on > > several other machines and I do not receive the error. > > Since this works on other PostgreSQL setups, my guess would be that the > default TEXT data type's character encoding is UTF-8 on the setup that > gives you the error while on the other machines it is something else > (e.g., ISO-8859-1). > > Boris > -- *Kenneth C. Moses* *Ph.D. Candidate* *Case Western Reserve University* *(240)620-6307* From kenneth.moses at gmail.com Mon Jan 19 20:31:06 2015 From: kenneth.moses at gmail.com (Kenneth Moses) Date: Tue Jan 20 10:31:46 2015 Subject: [odb-users] 22021: ERROR: invalid byte sequence for encoding "UTF8": 0x93 In-Reply-To: References: Message-ID: Hello Boris, After many days of trying to track down the problem I finally discovered the issue. It came down to an uninitialized variable. Simple problem that caused a big headache! Cheers, Ken On Mon, Jan 19, 2015 at 12:02 PM, Kenneth Moses wrote: > Hello Boris, > > Thank you for the quick response. I double checked that all systems > character encoding are set to UTF-8. Unfortunately, that does not seem to > be the issue here. I have done some drastic measures thus far such as > re-installing PostgreSQL to see if that would fix the problem but no luck. > I will let you know if I come up with a solution. > > -Ken > > On Mon, Jan 19, 2015 at 8:26 AM, Boris Kolpackov > wrote: > >> Hi Kenneth, >> >> Kenneth Moses writes: >> >> > I am running a PostgreSQL database and compiling ODB with gcc 4.9.2. >> The >> > code compiles just fine. However, I receive the above error when >> attempting >> > to persist an object. I have put a standard tracer within the >> transaction >> > and the error occurs every time at the same line. The SQL line is an >> INSERT >> > INTO command and does not appear to have any non-standard text in it. I >> > have run the exact same code (it was pulled from a repository online) on >> > several other machines and I do not receive the error. >> >> Since this works on other PostgreSQL setups, my guess would be that the >> default TEXT data type's character encoding is UTF-8 on the setup that >> gives you the error while on the other machines it is something else >> (e.g., ISO-8859-1). >> >> Boris >> > > > > -- > *Kenneth C. Moses* > > *Ph.D. Candidate* > *Case Western Reserve University* > *(240)620-6307 <%28240%29620-6307>* > -- *Kenneth C. Moses* *Ph.D. Candidate* *Case Western Reserve University* *(240)620-6307* From boris at codesynthesis.com Tue Jan 20 10:33:14 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jan 20 10:42:04 2015 Subject: [odb-users] 22021: ERROR: invalid byte sequence for encoding "UTF8": 0x93 In-Reply-To: References: Message-ID: Hi Kenneth, Kenneth Moses writes: > After many days of trying to track down the problem I finally discovered > the issue. It came down to an uninitialized variable. Glad you found the issue and thanks for letting us know. I guess what happened is the variable contained garbage which in certain situations wasn't valid UTF-8. PG detected this when you tried to persist this garbage in the database. Boris From paul.harrison at manchester.ac.uk Tue Jan 20 11:20:15 2015 From: paul.harrison at manchester.ac.uk (Paul Harrison) Date: Tue Jan 20 11:20:21 2015 Subject: [odb-users] one-to-one relationship with shared primary keys Message-ID: <04D65FC1-3757-41D4-B692-DF576CC64472@manchester.ac.uk> Hi I have several tables with the same primary key, and a one-to-one relationship between instances in the tables. I have been trying to find a way to be able to have the object for one the tables include shared pointers to the corresponding objects in the other tables without any extra columns being used as foreign keys, but have not been able to find a method of doing this with ODB - is there a trick that I am missing? The functionality I am looking for is similar to JPA @PrimaryKeyJoinColumn applied to a @OneToOne member if that helps to make it clearer what I would like. Regards, Paul From boris at codesynthesis.com Wed Jan 21 04:44:16 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jan 21 04:53:06 2015 Subject: [odb-users] one-to-one relationship with shared primary keys In-Reply-To: <04D65FC1-3757-41D4-B692-DF576CC64472@manchester.ac.uk> References: <04D65FC1-3757-41D4-B692-DF576CC64472@manchester.ac.uk> Message-ID: Hi Paul, Paul Harrison writes: > I have several tables with the same primary key, and a one-to-one > relationship between instances in the tables. I have been trying > to find a way to be able to have the object for one the tables > include shared pointers to the corresponding objects in the other > tables without any extra columns being used as foreign keys, but > have not been able to find a method of doing this with ODB - is > there a trick that I am missing? You can use a database operation callback to implement this quite easily. Here the outline: #pragma db object struct object1 { #pragma db id int id; ... }; #include #pragma db object callback(init) struct object2 { #pragma db id int id; // Also, implicitly, a foreign key to object1. ... #pragma db transient std::shared_ptr obj1; void init (odb::callback_event e, odb::database& db) { if (e == odb::callback_event::post_load) obj1 = db.load (id); } }; See Section 14.1.7, "callback" for more details on database operation callbacks. Boris From paul.harrison at manchester.ac.uk Wed Jan 21 09:53:17 2015 From: paul.harrison at manchester.ac.uk (Paul Harrison) Date: Wed Jan 21 09:53:22 2015 Subject: [odb-users] one-to-one relationship with shared primary keys In-Reply-To: References: <04D65FC1-3757-41D4-B692-DF576CC64472@manchester.ac.uk> Message-ID: On 2015-01 -21, at 09:44, Boris Kolpackov wrote: > Hi Paul, > > Paul Harrison writes: > >> I have several tables with the same primary key, and a one-to-one >> relationship between instances in the tables. I have been trying >> to find a way to be able to have the object for one the tables >> include shared pointers to the corresponding objects in the other >> tables without any extra columns being used as foreign keys, but >> have not been able to find a method of doing this with ODB - is >> there a trick that I am missing? > > You can use a database operation callback to implement this quite > easily. Here the outline: > > #pragma db object > struct object1 > { > #pragma db id > int id; > > ... > }; > > #include > > #pragma db object callback(init) > struct object2 > { > #pragma db id > int id; // Also, implicitly, a foreign key to object1. > > ... > > #pragma db transient > std::shared_ptr obj1; > > void init (odb::callback_event e, odb::database& db) > { > if (e == odb::callback_event::post_load) > obj1 = db.load (id); > } > }; > > See Section 14.1.7, "callback" for more details on database operation > callbacks. Great - this does exactly what I want and prevents the need for db access code having to leak into parts of my code that should not have to know about the database. thanks, Paul. From saimen54 at hotmail.com Thu Jan 22 05:19:51 2015 From: saimen54 at hotmail.com (Simon Martin) Date: Thu Jan 22 05:20:04 2015 Subject: [odb-users] No rule to make target 'tr1/pointer-traits.hxx' with Cygwin Message-ID: Hi, I tried to build libodb with Cygwin 1.7.33-2(0.280/5/3) and gcc 4.9.2 on Windows Configure works, but when I try to run make I get the error make[2]: *** No rule to make target 'tr1/pointer-traits.hxx', needed by 'all-am'. (see below) Any help is appreciated, thanks! Simon $ ./configure checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking how to create a ustar tar archive... gnutar checking for style of include used by make... GNU checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking dependency style of gcc... gcc3 checking for ar... ar checking the archiver (ar) interface... ar checking build system type... i686-pc-cygwin checking host system type... i686-pc-cygwin checking how to print strings... printf checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by gcc... /usr/i686-pc-cygwin/bin/ld.exe checking if the linker (/usr/i686-pc-cygwin/bin/ld.exe) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B checking the name lister (/usr/bin/nm -B) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 8192 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking how to convert i686-pc-cygwin file names to i686-pc-cygwin format... func_convert_file_noop checking how to convert i686-pc-cygwin file names to toolchain format... func_convert_file_noop checking for /usr/i686-pc-cygwin/bin/ld.exe option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL checking for dlltool... dlltool checking how to associate runtime and link libraries... func_cygming_dll_for_implib checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... ranlib checking command to parse /usr/bin/nm -B output from gcc object... ok checking for sysroot... no checking for mt... no checking if : is a manifest tool... no checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for as... as checking for dlltool... (cached) dlltool checking for objdump... (cached) objdump checking for objdir... .libs checking if gcc supports -fno-rtti -fno-exceptions... no checking for gcc option to produce PIC... -DDLL_EXPORT -DPIC checking if gcc PIC flag -DDLL_EXPORT -DPIC works... yes checking if gcc static flag -static works... yes checking if gcc supports -c -o file.o... yes checking if gcc supports -c -o file.o... (cached) yes checking whether the gcc linker (/usr/i686-pc-cygwin/bin/ld.exe) supports shared libraries... yes checking whether -lc should be explicitly linked in... yes checking dynamic linker characteristics... Win32 ld.exe checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking dependency style of g++... gcc3 checking how to run the C++ preprocessor... g++ -E checking for ld used by g++... /usr/i686-pc-cygwin/bin/ld.exe checking if the linker (/usr/i686-pc-cygwin/bin/ld.exe) is GNU ld... yes checking whether the g++ linker (/usr/i686-pc-cygwin/bin/ld.exe) supports shared libraries... yes checking for g++ option to produce PIC... -DDLL_EXPORT -DPIC checking if g++ PIC flag -DDLL_EXPORT -DPIC works... yes checking if g++ static flag -static works... yes checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/i686-pc-cygwin/bin/ld.exe) supports shared libraries... yes checking dynamic linker characteristics... Win32 ld.exe checking how to hardcode library paths into programs... immediate configure: creating ./config.lt config.lt: creating libtool checking for the pthreads library -lpthreads... no checking for the pthreads library -lpthread... yes checking if more special flags are required for pthreads... no checking for __thread keyword... yes checking whether to use rpath... yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating libodb.pc config.status: creating Makefile config.status: creating odb/Makefile config.status: creating odb/config.h config.status: creating odb/details/config.h config.status: executing depfiles commands config.status: executing libtool commands config.status: executing libtool-rpath-patch commands End of make output: details/shared-ptr/base.o .libs/libodb.lax/lt1-exceptions.o details/posix/thread.o libtool: link: ranlib .libs/libodb.a libtool: link: rm -fr .libs/libodb.lax libtool: link: ( cd ".libs" && rm -f "libodb.la" && ln -s "../libodb.la" "libodb.la" ) make[2]: *** No rule to make target 'tr1/pointer-traits.hxx', needed by 'all-am'. Schluss. make[2]: Leaving directory '/cygdrive/c/projects/odb/libodb-2.3.0/odb' Makefile:406: recipe for target 'all' failed make[1]: *** [all] Error 2 make[1]: Leaving directory '/cygdrive/c/projects/Dev/odb/libodb-2.3.0/odb' Makefile:417: recipe for target 'all-recursive' failed make: *** [all-recursive] Error 1 From boris at codesynthesis.com Thu Jan 22 08:21:19 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jan 22 08:30:08 2015 Subject: [odb-users] No rule to make target 'tr1/pointer-traits.hxx' with Cygwin In-Reply-To: References: Message-ID: Hi Simon, Simon Martin writes: > make[2]: *** No rule to make target 'tr1/pointer-traits.hxx', needed by 'all-am'. Schluss. > make[2]: Leaving directory '/cygdrive/c/projects/odb/libodb-2.3.0/odb' This is strange. I haven't tried ODB under Cygwin but it does work for me under MinGW. Can you check that tr1/pointer-traits.hxx actually exists under /cygdrive/c/projects/odb/libodb-2.3.0/odb? If it doesn't, then you may want to try to unpack the archive again. I just checked libodb-2.3.0.zip and odb/tr1/pointer-traits.hxx is there. Boris From saimen54 at hotmail.com Thu Jan 22 08:48:44 2015 From: saimen54 at hotmail.com (Simon Martin) Date: Thu Jan 22 08:48:57 2015 Subject: [odb-users] No rule to make target 'tr1/pointer-traits.hxx' with Cygwin In-Reply-To: References: , Message-ID: > From: boris@codesynthesis.com > > make[2]: *** No rule to make target 'tr1/pointer-traits.hxx', needed by 'all-am'. Schluss. > > make[2]: Leaving directory '/cygdrive/c/projects/odb/libodb-2.3.0/odb' > > This is strange. I haven't tried ODB under Cygwin but it does work > for me under MinGW. Can you check that tr1/pointer-traits.hxx actually > exists under /cygdrive/c/projects/odb/libodb-2.3.0/odb? If it doesn't, > then you may want to try to unpack the archive again. I just checked > libodb-2.3.0.zip and odb/tr1/pointer-traits.hxx is there. Hi Boris, okay, somehow the complete odb/tr1 directory was moved to the odb/compiler directory. I unzipped and rebuild and now it works. Thanks for your quick response, Simon From zhuof at avonaco.com Fri Jan 23 03:13:04 2015 From: zhuof at avonaco.com (zhuof@avonaco.com) Date: Wed Jan 28 09:58:36 2015 Subject: [odb-users] odb-2.3.0 and mysql 2036 error Message-ID: <2015012316130443526818@avonaco.com> I run driver in odb-example-2.3.0/hello. The result is "2036 (HY000): Using unsupported buffer type: 156663056 (parameter: 3) " I have used odb-2.3.0 rpm install on CenOS 6.3. libodb-2.3.0 use ./configure, make and make install libodb-mysql-2.3.0 use ./configure, make and make install odb-example-2.3.0 use ./configure --with-database=mysql, make The g++ version is 4.9.1 libmysqlclient_r is 5.3.67 ./driver --database XXXX --host xxx.xxx.xxx.xxx --port=xxxx --user xxxx --password xxxx 2036 (HY000): Using unsupported buffer type: 156663056 (parameter: 3) So what problem means the error? zhuof@avonaco.com From boris at codesynthesis.com Wed Jan 28 09:58:56 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jan 28 10:08:39 2015 Subject: [odb-users] odb-2.3.0 and mysql 2036 error In-Reply-To: <2015012316130443526818@avonaco.com> References: <2015012316130443526818@avonaco.com> Message-ID: Hi, zhuof@avonaco.com writes: > I run driver in odb-example-2.3.0/hello. The result is "2036 (HY000): > Using unsupported buffer type: 156663056 (parameter: 3) " Hm, never seen anything like this before. > libmysqlclient_r is 5.3.67 What is the version of the MySQL server that you are connecting to? > ./driver --database XXXX --host xxx.xxx.xxx.xxx --port=xxxx --user > xxxx --password xxxx Have you created the database schema with the generated hello.sql before running the driver? Boris From sebastian at minifarm.ro Thu Jan 29 11:29:05 2015 From: sebastian at minifarm.ro (Paul-Sebastian Manole) Date: Thu Jan 29 12:26:25 2015 Subject: [odb-users] odb 2.3.0 runtime error symbol not found on Mac OS X Yosemite Message-ID: Hello, I?ve written several HomeBrew formulas for ODB available at https://github.com/brokenthorn/homebrew-default. Everything compiles perfectly. The problem is that ODB can?t load odb.so because libgmp is compiled with stdlib libc++ but odb being compiled with GCC 4.9 expects libstdc++. Is it possible to compile/link ODB with GCC and libc++? I?m using OS X Yosemite which might be the cause of this problem since Apple switched to libc++. Here is the runtime error: /usr/local/bin/odb --database pgsql --generate-schema --generate-query --generate-session cererearticol.h cc1plus: error: cannot load plugin /usr/local/bin/../lib/odb/odb.so dlopen(/usr/local/bin/../lib/odb/odb.so, 10): Symbol not found: __ZN4cutl2re11basic_regexIcE4initEPKSsb Referenced from: /usr/local/bin/../lib/odb/odb.so Expected in: flat namespace in /usr/local/bin/../lib/odb/odb.so make: *** [cererearticol-odb.cpp] Error 1 -- Paul-Sebastian Manole Administrator baze de date S.C. Mini-Farm S.R.L. (0720) 231.791 From lordvampyre at gmail.com Thu Jan 29 13:56:24 2015 From: lordvampyre at gmail.com (Diego Fernando) Date: Thu Jan 29 13:56:32 2015 Subject: [odb-users] unknown database schema '' Message-ID: I follow the tutorial to compile libodb-qt to use in Qt Creator. Always return unknown database schema ''. employee.hxx #ifndef EMPLOYEE #define EMPLOYEE #include #include #include using namespace std; using namespace odb::core; #pragma db object table("employee") class Employee { public: Employee(const QString &name) : name_(name) {} ~Employee(); void set_name(const QString &value); QString name() const; private: friend class odb::access; Employee() {} #pragma db id auto int id_; #pragma db column("name_employee") type("varchar(60)") QString name_; }; main.cpp #include #include #include // std::auto_ptr #include #include #include #include #include # include //#include "database.h" // create_database #include "employee.hxx" #include "employee-odb.hxx" using namespace std; using namespace odb::core; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); try { auto_ptr db (new odb::pgsql::database( "postgres" , "1234" , "odb_test" , "localhost" , 5432)); { transaction t (db->begin ()); schema_catalog::create_schema(*db); t.commit (); } } catch (const odb::exception& e) { std::cout << "ERROR: " << e.what() << std::endl; } return a.exec(); } .pro #------------------------------------------------- # # Project created by QtCreator 2015-01-24T13:44:23 # #------------------------------------------------- QT += core QT -= gui TARGET = testodb CONFIG += console CONFIG -= app_bundle TEMPLATE = app DESTDIR += "_bin" #LIBS += -L"_bin" LIBS += -L"/usr/local/lib" SOURCES += main.cpp \ employee.cpp # List of header files that should be compiled with the ODB compiler. # ODB_FILES += employee.hxx # ODB compiler flags. # ODB_FLAGS = --database pgsql --profile qt --generate-schema --generate-query --generate-session --std c++11 # Select the database we are going to use. # DEFINES += DATABASE_PGSQL # Suppress unknown pragmas GCC warnings. # QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CXXFLAGS_WARN_ON -Wno-unknown-pragmas # Link to the ODB runtime libraries. # LIBS += -lodb-pgsql LIBS += -lodb-qt LIBS += -lodb # ODB compilation rules. Normally you don't need to change anything here. # # Add the Qt headers directory to the ODB include directory list. # ODB_FLAGS += -I$$[QT_INSTALL_HEADERS] # Newer versions of QtCreator do builds in a separate directory. As a # result, we need to append the source directory to ODB files. # for(dir, ODB_FILES) { ODB_PWD_FILES += $$PWD/$${dir} } odb.name = odb ${QMAKE_FILE_IN} odb.input = ODB_PWD_FILES odb.output = ${QMAKE_FILE_BASE}-odb.cxx odb.commands = odb $$ODB_FLAGS ${QMAKE_FILE_IN} odb.depends = $$ODB_PWD_FILES odb.variable_out = SOURCES odb.clean = ${QMAKE_FILE_BASE}-odb.cxx ${QMAKE_FILE_BASE}-odb.hxx ${QMAKE_FILE_BASE}-odb.ixx ${QMAKE_FILE_BASE}.sql QMAKE_EXTRA_COMPILERS += odb odbh.name = odb ${QMAKE_FILE_IN} odbh.input = ODB_PWD_FILES odbh.output = ${QMAKE_FILE_BASE}-odb.hxx odbh.commands = @true odbh.CONFIG = no_link odbh.depends = ${QMAKE_FILE_BASE}-odb.cxx QMAKE_EXTRA_COMPILERS += odbh HEADERS += \ database.h \ employee.hxx From boris at codesynthesis.com Fri Jan 30 05:08:54 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jan 30 05:18:36 2015 Subject: [odb-users] odb 2.3.0 runtime error symbol not found on Mac OS X Yosemite In-Reply-To: References: Message-ID: Hi Paul-Sebastian, Paul-Sebastian Manole writes: > I?m using OS X Yosemite which might be the cause of this problem You would be surprised how many emails I've got in the past couple months that start with a sentence like that... > cc1plus: error: cannot load plugin /usr/local/bin/../lib/odb/odb.so > dlopen(/usr/local/bin/../lib/odb/odb.so, 10): Symbol not found: > __ZN4cutl2re11basic_regexIcE4initEPKSsb This symbol is from the libcutl library on which the ODB compiler depends. My guess would be that this library is built with a different C++ runtime library (you can verify this with otool -L). Also, Adnan Rihan has also created a Homebrew package for the ODB compiler. His seems to work: http://codesynthesis.com/pipermail/odb-users/2014-November/002209.html Boris From boris at codesynthesis.com Fri Jan 30 05:12:16 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jan 30 05:21:58 2015 Subject: [odb-users] unknown database schema '' In-Reply-To: References: Message-ID: Hi Diego, Diego Fernando writes: > schema_catalog::create_schema(*db); > > [...] > > ODB_FLAGS = --database pgsql --profile qt --generate-schema > --generate-query --generate-session --std c++11 For the Postgres database (and all others except SQLite), the schema by default is generated in a standalone .sql file. If you want it embedded into the generated C++ code (so that you can use the create_schema() call above), you need to add '--schema-format embedded'. See the ODB compiler command line manual (man page) for details. Boris From sebastian at minifarm.ro Fri Jan 30 06:35:19 2015 From: sebastian at minifarm.ro (Paul-Sebastian Manole) Date: Fri Jan 30 07:47:04 2015 Subject: [odb-users] odb 2.3.0 runtime error symbol not found on Mac OS X Yosemite In-Reply-To: References: Message-ID: <2897412C-1FFE-4B1B-B89D-2421D6665D4F@minifarm.ro> Thank you very much! It seems you were right. Libcutl was being built using clang/libc++ and odb using gcc/libstdc++. My brew formulas were actually based on Adnan Rihan?s formulas for libcult and odb but I wanted to write formulas for all the available odb packages. It seems I missed the point where libcutl should have been built using the same standard library as odb since odb links against it. Thanks to Adnan as well! -- Paul-Sebastian Manole Administrator baze de date S.C. Mini-Farm S.R.L. (0720) 231.791 On 30 Jan 2015, at 12:08, Boris Kolpackov > wrote: Hi Paul-Sebastian, Paul-Sebastian Manole > writes: I?m using OS X Yosemite which might be the cause of this problem You would be surprised how many emails I've got in the past couple months that start with a sentence like that... cc1plus: error: cannot load plugin /usr/local/bin/../lib/odb/odb.so dlopen(/usr/local/bin/../lib/odb/odb.so, 10): Symbol not found: __ZN4cutl2re11basic_regexIcE4initEPKSsb This symbol is from the libcutl library on which the ODB compiler depends. My guess would be that this library is built with a different C++ runtime library (you can verify this with otool -L). Also, Adnan Rihan has also created a Homebrew package for the ODB compiler. His seems to work: http://codesynthesis.com/pipermail/odb-users/2014-November/002209.html Boris From sebastian at minifarm.ro Fri Jan 30 06:41:47 2015 From: sebastian at minifarm.ro (Paul-Sebastian Manole) Date: Fri Jan 30 07:47:04 2015 Subject: [odb-users] odb 2.3.0 runtime error symbol not found on Mac OS X Yosemite In-Reply-To: <2897412C-1FFE-4B1B-B89D-2421D6665D4F@minifarm.ro> References: <2897412C-1FFE-4B1B-B89D-2421D6665D4F@minifarm.ro> Message-ID: Hello again! I have to say, I never thought I?d ever get odb 2.3.0 to work on Yosemite. Thanks again for your help! After recompiling libcult and odb, everything seems to work perfectly! While it might not be serious, I do get a warning from homebrew after recompiling odb, saying "odb dependency gmp was built with a different C++ standard library (libc++ from clang). This may cause problems at runtime.?. I hope you guys might clear this up for me as well. Here?s my brew log for odb installation: nova:~ sebastian$ brew reinstall odb ==> Reinstalling odb ==> Downloading http://www.codesynthesis.com/download/odb/2.3/odb-2.3.0.tar.gz Already downloaded: /Library/Caches/Homebrew/odb-2.3.0.tar.gz ==> Downloading http://scm.codesynthesis.com/?p=odb/odb.git;a=patch;h=97281fd4454596834142fa43f83af38695b38e5b Already downloaded: /Library/Caches/Homebrew/odb--patch-3542604d943aeea80cd4a26b366297eab9116c0e.git;a=patch;h=97281fd4454596834142fa43f83af38695b38e5b ==> Downloading http://scm.codesynthesis.com/?p=odb/odb.git;a=patch;h=4617f8f3b0c07a40d46bb04ab4b66e8446a8250b Already downloaded: /Library/Caches/Homebrew/odb--patch-d47e879f8c52ebc985d1cff54a89ca2da5aee3ea.git;a=patch;h=4617f8f3b0c07a40d46bb04ab4b66e8446a8250b ==> Downloading http://scm.codesynthesis.com/?p=odb/odb.git;a=patch;h=4f54aea0a7a1735502c845524ae5d650eb630181 Already downloaded: /Library/Caches/Homebrew/odb--patch-8f957dc997cf5249cf102382bc02e02715c8daaa.git;a=patch;h=4f54aea0a7a1735502c845524ae5d650eb630181 ==> Patching patching file odb/gcc-fwd.hxx patching file odb/gcc.hxx patching file odb/parser.cxx patching file odb/pragma.cxx Hunk #2 succeeded at 2475 (offset -34 lines). patching file odb/pragma.hxx patching file odb/processor.cxx Hunk #4 succeeded at 2581 (offset -40 lines). Hunk #5 succeeded at 2671 (offset -40 lines). patching file odb/pragma.hxx patching file odb/processor.cxx Warning: GCC short version 4.9 Warning: GCC plugin dir /usr/local/Cellar/gcc/4.9.2_1/lib/gcc/4.9/gcc/x86_64-apple-darwin14.0.0/4.9.2/plugin/include Warning: Using gcc-4.9 compiler. ==> ./configure --prefix=/usr/local/Cellar/odb/2.3.0 --libexecdir=/usr/local/Cellar/odb/2.3.0/lib --with-options-file=/u ==> make install Warning: odb dependency gmp was built with a different C++ standard library (libc++ from clang). This may cause problems at runtime. /usr/local/Cellar/odb/2.3.0: 20 files, 13M, built in 2.3 minutes END LOG. -- Paul-Sebastian Manole Administrator baze de date S.C. Mini-Farm S.R.L. (0720) 231.791 On 30 Jan 2015, at 13:35, Paul-Sebastian Manole > wrote: Thank you very much! It seems you were right. Libcutl was being built using clang/libc++ and odb using gcc/libstdc++. My brew formulas were actually based on Adnan Rihan?s formulas for libcult and odb but I wanted to write formulas for all the available odb packages. It seems I missed the point where libcutl should have been built using the same standard library as odb since odb links against it. Thanks to Adnan as well! -- Paul-Sebastian Manole Administrator baze de date S.C. Mini-Farm S.R.L. (0720) 231.791 On 30 Jan 2015, at 12:08, Boris Kolpackov > wrote: Hi Paul-Sebastian, Paul-Sebastian Manole > writes: I?m using OS X Yosemite which might be the cause of this problem You would be surprised how many emails I've got in the past couple months that start with a sentence like that... cc1plus: error: cannot load plugin /usr/local/bin/../lib/odb/odb.so dlopen(/usr/local/bin/../lib/odb/odb.so, 10): Symbol not found: __ZN4cutl2re11basic_regexIcE4initEPKSsb This symbol is from the libcutl library on which the ODB compiler depends. My guess would be that this library is built with a different C++ runtime library (you can verify this with otool -L). Also, Adnan Rihan has also created a Homebrew package for the ODB compiler. His seems to work: http://codesynthesis.com/pipermail/odb-users/2014-November/002209.html Boris From lordvampyre at gmail.com Fri Jan 30 08:30:06 2015 From: lordvampyre at gmail.com (Diego Fernando) Date: Fri Jan 30 08:30:15 2015 Subject: [odb-users] unknown database schema '' In-Reply-To: References: Message-ID: Thanks. If I understand embedded resources just work with SQLite. I'll try import standalone .sql in the postgresql 2015-01-30 8:12 GMT-02:00 Boris Kolpackov : > Hi Diego, > > Diego Fernando writes: > > > schema_catalog::create_schema(*db); > > > > [...] > > > > ODB_FLAGS = --database pgsql --profile qt --generate-schema > > --generate-query --generate-session --std c++11 > > For the Postgres database (and all others except SQLite), the schema > by default is generated in a standalone .sql file. If you want it > embedded into the generated C++ code (so that you can use the > create_schema() call above), you need to add '--schema-format embedded'. > See the ODB compiler command line manual (man page) for details. > > Boris > From dieter.govaerts at bricsys.com Fri Jan 30 08:53:07 2015 From: dieter.govaerts at bricsys.com (dieter.govaerts@bricsys.com) Date: Fri Jan 30 08:53:09 2015 Subject: [odb-users] std::wstring support for sqlite on Linux Message-ID: <1422625987.814119399@apps.rackspace.com> Hello, In the release notes for ODB 2.1.0 I see that std::wstring support has been added for SQLite databases but only on Windows. When will this become available for Linux (and Mac)? We are developing a cross-platform, unicode enabled application. Without this feature on Linux I will have to convert all unicode strings to UTF8 and back somewhere along the way which would complicate the now easy getters & setters. Thanks, Dieter Govaerts Bricsys From boris at codesynthesis.com Fri Jan 30 08:50:14 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jan 30 08:59:54 2015 Subject: [odb-users] unknown database schema '' In-Reply-To: References: Message-ID: Hi Diego, Diego Fernando writes: > If I understand embedded resources just work with SQLite. No, you misunderstand. If you specify just --generate-schema, then the database schema will be generated embedded for SQLite and as a .sql file for PG. If, however, you add '--schema-format embedded', then the schema will be generated embedded even for PG. Boris From boris at codesynthesis.com Fri Jan 30 09:10:42 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jan 30 09:20:23 2015 Subject: [odb-users] std::wstring support for sqlite on Linux In-Reply-To: <1422625987.814119399@apps.rackspace.com> References: <1422625987.814119399@apps.rackspace.com> Message-ID: Hi Dieter, dieter.govaerts@bricsys.com writes: > In the release notes for ODB 2.1.0 I see that std::wstring support > has been added for SQLite databases but only on Windows. When will > this become available for Linux (and Mac)? On Windows, wchar_t (the character type for wstring) is 2 bytes and is assumed to store UTF-16 code points. SQLite API also accepts UTF-16 text. On UNIX (Linux, Mac OS, etc), however, the size of wchar_t varies and there is no common convention for what it actually stores. On both Linux and Mac OS, wchar_t is 4 bytes and the most natural thing to assume is that it stores UTF-32. SQLite API does not work with UTF-32 text directly so that means (provided we make this assumption), ODB will have to convert things back and forth. For these two reasons there are no plans to support wstring in ODB for UNIX platforms. > We are developing a cross-platform, unicode enabled application. > Without this feature on Linux I will have to convert all unicode > strings to UTF8 and back somewhere along the way which would > complicate the now easy getters & setters. Hm, for a cross-platform application, UTF-8 would actually be the more natural choice. If you want to use UTF-16 everywhere, then the better approach would be to use std::u16string from C++11 which is specified to store UTF-16 strings. We can add support for this mapping to ODB. Boris From lordvampyre at gmail.com Sat Jan 31 08:53:07 2015 From: lordvampyre at gmail.com (Diego Fernando) Date: Sat Jan 31 08:53:15 2015 Subject: [odb-users] unknown database schema '' In-Reply-To: References: Message-ID: > > No, you misunderstand. If you specify just --generate-schema, then > the database schema will be generated embedded for SQLite and as > a .sql file for PG. If, however, you add '--schema-format embedded', > then the schema will be generated embedded even for PG. > > Boris > Hi Boris, Thank you again. Sorry for the misunderstood. I followed your instructions, rebuild the project and now it's working. Thank you. Diego Fernando From lordvampyre at gmail.com Sat Jan 31 14:55:13 2015 From: lordvampyre at gmail.com (Diego Fernando) Date: Sat Jan 31 14:55:20 2015 Subject: [odb-users] unknown database schema '' In-Reply-To: References: Message-ID: Hi Boris, I started to compile my real project. My build folder is look like this management/ include/ include/entity ... src/ src/entity/ ... And my includes are like this #include "./include/entity/branch.h" To compile the project I have to change the include to #include "../entity/branch.h" And I have to change branch-odb.h to include the path to branch in the project #include "./include/entity/branch.h" The problem is every time I compile the project I have to changed the include in -odb.h P.S: I am using Qt Creator and QMAKE Thank you 2015-01-31 11:53 GMT-02:00 Diego Fernando : > No, you misunderstand. If you specify just --generate-schema, then >> the database schema will be generated embedded for SQLite and as >> a .sql file for PG. If, however, you add '--schema-format embedded', >> then the schema will be generated embedded even for PG. >> >> Boris >> > > Hi Boris, > > Thank you again. > Sorry for the misunderstood. I followed your instructions, rebuild the > project and now it's working. > > Thank you. > > Diego Fernando >