From trynitron at gmail.com Wed Jun 1 10:41:10 2016 From: trynitron at gmail.com (Pierre-Olivier Rocher) Date: Wed Jun 1 14:13:31 2016 Subject: [odb-users] Compilation issue with gcc Message-ID: Hi, I'm currently not able to compile my project on Debian 8.4 using gcc. The first error is : error: no matching function for call to ?odb::database::erase(const int&)? m_database->erase(fm_id); This code source compile nicely on Windows (VS 2015 update 2), all the odb files are generated on Windows, with odb.exe. It seems to be a cast issue between "const int&" and "const typename odb::object_traits::id_type&" but i'm currently not able to fix the issue. Any idea ? Thanks in advance Tryniton From martin at mu-schneider.de Wed Jun 1 15:50:28 2016 From: martin at mu-schneider.de (Martin Schneider) Date: Wed Jun 1 15:50:37 2016 Subject: [odb-users] Linking problem at Ubuntu 16.04 In-Reply-To: References: <5749A9C9.2010602@mu-schneider.de> <574C7E97.1090803@mu-schneider.de> Message-ID: <574F3C84.1070700@mu-schneider.de> Hi Boris, you are right with your asumption about C++98. I now rerun: > make distclean > ./configure --with-database=mysql CXXFLAGS="-std=c++11 -Wno-deprecated" > make But original error comes up again: make[4]: Verzeichnis ?/home/martin/projects/odb/odb-tests-2.4.0/common/access? wird betreten depbase=`echo driver.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ g++ -DHAVE_CONFIG_H -I'../../libcommon' -I'../../libcommon' -I'.' -I'.' -std=c++11 -Wno-deprecated -D_REENTRANT -MT driver.o -MD -MP -MF $depbase.Tpo -c -o driver.o driver.cxx &&\ mv -f $depbase.Tpo $depbase.Po depbase=`echo test-odb.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ g++ -DHAVE_CONFIG_H -I'../../libcommon' -I'../../libcommon' -I'.' -I'.' -std=c++11 -Wno-deprecated -D_REENTRANT -MT test-odb.o -MD -MP -MF $depbase.Tpo -c -o test-odb.o test-odb.cxx &&\ mv -f $depbase.Tpo $depbase.Po /bin/bash ../../libtool --tag=CXX --mode=link g++ -std=c++11 -Wno-deprecated -D_REENTRANT -o driver driver.o test-odb.o ../../libcommon/common/libcommon.la -lodb-mysql -lodb-qt -lodb-boost -lboost_date_time -lboost_system -lodb -lpthread libtool: link: g++ -std=c++11 -Wno-deprecated -D_REENTRANT -o .libs/driver driver.o test-odb.o ../../libcommon/common/.libs/libcommon.so -lodb-mysql -lodb-qt -lodb-boost -lboost_date_time -lboost_system -lodb -lpthread /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libodb-mysql.so: undefined reference to `odb::statement::process_insert(char const*, void const* const*, unsigned long, unsigned long, char, std::__cxx11::basic_string, std::allocator >&)' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libodb-mysql.so: undefined reference to `odb::statement::process_update(char const*, void const* const*, unsigned long, unsigned long, char, std::__cxx11::basic_string, std::allocator >&)' /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libodb-mysql.so: undefined reference to `odb::statement::process_select(char const*, void const* const*, unsigned long, unsigned long, char, char, bool, std::__cxx11::basic_string, std::allocator >&, bool)' collect2: error: ld returned 1 exit status Makefile:343: die Regel f?r Ziel ?driver? scheiterte make[4]: *** [driver] Fehler 1 make[4]: Verzeichnis ?/home/martin/projects/odb/odb-tests-2.4.0/common/access? wird verlassen Thanks Martin Am 31.05.2016 um 00:57 schrieb Boris Kolpackov: > Hi Martin, > > Martin Schneider writes: > >> ./configure --with-database=mysql CXXFLAGS=-std=c++11 >> make >> >> but then a lot of deprecate warnings like: >> ../../libcommon/common/common.hxx:42:15: warning: 'template class std::auto_ptr' is deprecated [-Wdeprecated-declarations] > You can add -Wno-deprecated to suppress these (we will get rid of them > once we switch to C++11-only): > > ./configure --with-database=mysql CXXFLAGS="-std=c++11 -Wno-deprecated" > > >> test-odb.cxx:2367:14: error: use of deleted function ?std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = test3::object1; _Dp = std::default_delete]? >> o.p2 (v); > I am pretty sure you are trying to compile code generated in the C++98 mode. > Did you do: > > make distclean > > Before running configure? > > Boris From boris at codesynthesis.com Thu Jun 2 08:06:26 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 2 08:06:37 2016 Subject: [odb-users] Linking problem at Ubuntu 16.04 In-Reply-To: <574F3C84.1070700@mu-schneider.de> References: <5749A9C9.2010602@mu-schneider.de> <574C7E97.1090803@mu-schneider.de> <574F3C84.1070700@mu-schneider.de> Message-ID: Martin, Sean, Thanks for confirming this. I've filed a bug report with the Ubuntu package maintainer: https://bugs.launchpad.net/ubuntu/+source/libodb/+bug/1588330 Boris From boris at codesynthesis.com Thu Jun 2 08:10:06 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 2 08:10:16 2016 Subject: [odb-users] Compilation issue with gcc In-Reply-To: References: Message-ID: Hi, Pierre-Olivier Rocher writes: > error: no matching function for call to ?odb::database::erase(const int&)? > m_database->erase(fm_id); > > [...] > > It seems to be a cast issue between "const int&" and "const typename > odb::object_traits::id_type&" but i'm currently not able to fix the > issue. Show us the definition of your objects, particularly the object id data member as well as the code where you get the error. Without this info we can only guess and speculate. Boris From boris at codesynthesis.com Thu Jun 2 08:31:34 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 2 08:31:45 2016 Subject: [odb-users] Problem with session cache and weak_ptr In-Reply-To: References: <8449ca0fd5fc487b8a9440690d6bc3c6@QEX.qosmotec.com> <00c73cb1e87643e9961f94d45ea5ea1e@QEX.qosmotec.com> <1965057559504f13b51a9e35554385b3@QEX.qosmotec.com> <1ec711815e80442898bd66822896e2e8@QEX.qosmotec.com> Message-ID: Hi Marcel, Marcel Nehring writes: > sorry for so many questions about this topic but it is causing a lot > of trouble and confusion here. No problem, lazy weak pointers are tricky. > If the object a lazy_weak_ptr points to expires, is the state of the > pointer still loaded or will it change to unloaded? That depends on whether the pointer pointed to the transient or persistent objects. > I.e. if I have a valid pointer to a persistent object, and the pointer > expires, will loaded() return true (so that it become effectively a NULL > pointer to a transient object) or will it return false (so that it > effectively becomes an unloaded pointer to a persistent object)? It will return false. Here is the "truth table" from the lazy_weak_ptr header: // expired() loaded() // // true true expired pointer to transient object // false true valid pointer to persistent object // true false expired pointer to persistent object // false false valid pointer to transient object // Boris From sean.clarke at sec-consulting.co.uk Thu Jun 2 08:32:55 2016 From: sean.clarke at sec-consulting.co.uk (Sean Clarke) Date: Thu Jun 2 08:33:07 2016 Subject: [odb-users] Linking problem at Ubuntu 16.04 In-Reply-To: References: <5749A9C9.2010602@mu-schneider.de> <574C7E97.1090803@mu-schneider.de> <574F3C84.1070700@mu-schneider.de> Message-ID: Many thanks for that Boris, however I have previous tried contacting him and had no reply - it is a real PITA as I have to package everything when there are already binaries available... Regards Sean Clarke SEC Consulting Limited +44 (0)23 8040 5599 http://www.sec-consulting.co.uk sean.clarke@sec-consulting.co.uk SEC Consulting Ltd is registered in England & Wales No: 5033740. This email is from SEC Consulting Ltd and any information contained in it, including any attachment or enclosure, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any unauthorised use, review, dissemination, copying or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material immediately. On 2 June 2016 at 13:06, Boris Kolpackov wrote: > Martin, Sean, > > Thanks for confirming this. I've filed a bug report with the > Ubuntu package maintainer: > > https://bugs.launchpad.net/ubuntu/+source/libodb/+bug/1588330 > > Boris > > From andy.hoffmeyer at turnkeycorrections.com Thu Jun 2 08:46:38 2016 From: andy.hoffmeyer at turnkeycorrections.com (Andrew Hoffmeyer) Date: Thu Jun 2 08:46:52 2016 Subject: [odb-users] Linking problem at Ubuntu 16.04 In-Reply-To: References: <5749A9C9.2010602@mu-schneider.de> <574C7E97.1090803@mu-schneider.de> <574F3C84.1070700@mu-schneider.de> Message-ID: <7f6544e268cce7d9213db6074ff5b5ad@mail.gmail.com> Not sure if this is your exact scenario, but the problem seems to come from the fact that, with Ubuntu 15.10 and greater, the libraries from the Ubuntu repositories are built with GCC 5.1 or later. Starting with GCC 5.1, GCC started using an ABI tag on C++11 library features, and any library built with these newer versions of GCC will have this ABI tag embedded in them, for certain things. This becomes a problem, when you're building your own code with an older (<5.1) version of GCC or any (at the time of this writing) version of Clang. In case it's relevant to you, there is an open bug for clang/llvm about this issue: https://llvm.org/bugs/show_bug.cgi?id=23529 Best Regards, Andy Hoffmeyer Software Engineer TurnKey Corrections 715.386.5700 ext. 403 Click here to connect with us on social media! -----Original Message----- From: odb-users-bounces@codesynthesis.com [mailto:odb-users-bounces@codesynthesis.com] On Behalf Of Sean Clarke Sent: Thursday, June 2, 2016 07:33 To: odb-users@codesynthesis.com Subject: Re: [odb-users] Linking problem at Ubuntu 16.04 Many thanks for that Boris, however I have previous tried contacting him and had no reply - it is a real PITA as I have to package everything when there are already binaries available... Regards Sean Clarke SEC Consulting Limited +44 (0)23 8040 5599 http://www.sec-consulting.co.uk sean.clarke@sec-consulting.co.uk SEC Consulting Ltd is registered in England & Wales No: 5033740. This email is from SEC Consulting Ltd and any information contained in it, including any attachment or enclosure, is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any unauthorised use, review, dissemination, copying or other use of this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material immediately. On 2 June 2016 at 13:06, Boris Kolpackov wrote: > Martin, Sean, > > Thanks for confirming this. I've filed a bug report with the > Ubuntu package maintainer: > > https://bugs.launchpad.net/ubuntu/+source/libodb/+bug/1588330 > > Boris > > From sean.clarke at sec-consulting.co.uk Thu Jun 2 08:50:17 2016 From: sean.clarke at sec-consulting.co.uk (Sean Clarke) Date: Thu Jun 2 08:50:30 2016 Subject: [odb-users] Linking problem at Ubuntu 16.04 In-Reply-To: <7f6544e268cce7d9213db6074ff5b5ad@mail.gmail.com> References: <5749A9C9.2010602@mu-schneider.de> <574C7E97.1090803@mu-schneider.de> <574F3C84.1070700@mu-schneider.de> <7f6544e268cce7d9213db6074ff5b5ad@mail.gmail.com> Message-ID: Hi Andrew, I don't believe that to be the case as I am certainly using > gcc 5.1 with teh later ABI, incidentally if I tell gcc to use the old style ABI I get errors linking against boost, hence my "assumption" was perhaps the ODB libs had not been compiled with the latter ABI or gcc defaults. Happy to be proved wrong, but I am using: gcc (Ubuntu 5.3.1-14ubuntu2) 5.3.1 20160413 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . Regards Sean Clarke andy.hoffmeyer@turnkeycorrections.com> wrote: > Not sure if this is your exact scenario, but the problem seems to come from > the fact that, with Ubuntu 15.10 and greater, the libraries from the Ubuntu > repositories are built with GCC 5.1 or later. Starting with GCC 5.1, GCC > started using an ABI tag on C++11 library features, and any library built > with these newer versions of GCC will have this ABI tag embedded in them, > for certain things. This becomes a problem, when you're building your own > code with an older (<5.1) version of GCC or any (at the time of this > writing) version of Clang. > > In case it's relevant to you, there is an open bug for clang/llvm about > this > issue: https://llvm.org/bugs/show_bug.cgi?id=23529 > > > Best Regards, > > Andy Hoffmeyer > Software Engineer > TurnKey Corrections > > 715.386.5700 ext. 403 > > Click here to connect with us on social media! > > > -----Original Message----- > From: odb-users-bounces@codesynthesis.com > [mailto:odb-users-bounces@codesynthesis.com] On Behalf Of Sean Clarke > Sent: Thursday, June 2, 2016 07:33 > To: odb-users@codesynthesis.com > Subject: Re: [odb-users] Linking problem at Ubuntu 16.04 > > Many thanks for that Boris, however I have previous tried contacting him > and had no reply - it is a real PITA as I have to package everything when > there are already binaries available... > > Regards > Sean Clarke > > SEC Consulting Limited > > +44 (0)23 8040 5599 > > http://www.sec-consulting.co.uk > > sean.clarke@sec-consulting.co.uk > > SEC Consulting Ltd is registered in England & Wales No: 5033740. > This email is from SEC Consulting Ltd and any information contained in it, > including any attachment or enclosure, is intended only for the person or > entity to which it is addressed and may contain confidential and/or > privileged material. Any unauthorised use, review, dissemination, copying > or other use of this information by persons or entities other than the > intended recipient is prohibited. If you received this in error, please > contact the sender and delete the material immediately. > > On 2 June 2016 at 13:06, Boris Kolpackov wrote: > > > Martin, Sean, > > > > Thanks for confirming this. I've filed a bug report with the > > Ubuntu package maintainer: > > > > https://bugs.launchpad.net/ubuntu/+source/libodb/+bug/1588330 > > > > Boris > > > > > From boris at codesynthesis.com Thu Jun 2 08:56:15 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 2 08:56:25 2016 Subject: [odb-users] Linking problem at Ubuntu 16.04 In-Reply-To: <7f6544e268cce7d9213db6074ff5b5ad@mail.gmail.com> References: <5749A9C9.2010602@mu-schneider.de> <574C7E97.1090803@mu-schneider.de> <574F3C84.1070700@mu-schneider.de> <7f6544e268cce7d9213db6074ff5b5ad@mail.gmail.com> Message-ID: Hi Andrew, Andrew Hoffmeyer writes: > Not sure if this is your exact scenario, but the problem seems to come from > the fact that, with Ubuntu 15.10 and greater, the libraries from the Ubuntu > repositories are built with GCC 5.1 or later. Starting with GCC 5.1, GCC > started using an ABI tag on C++11 library features, and any library built > with these newer versions of GCC will have this ABI tag embedded in them, > for certain things. This becomes a problem, when you're building your own > code with an older (<5.1) version of GCC or any (at the time of this > writing) version of Clang. Thanks for the information. Now I have two theories: 1. libodb were built in the C++11 mode while libodb- -- in C++98. 2. libodb were (re-)built with GCC 5.1 while libodb- are still old packages built with GCC 4.X. Boris From trynitron at gmail.com Thu Jun 2 10:57:37 2016 From: trynitron at gmail.com (Pierre-Olivier Rocher) Date: Thu Jun 2 12:50:03 2016 Subject: [odb-users] Compilation issue with gcc In-Reply-To: References: Message-ID: The calling function templateinline bool data::erase(const int fm_id) { try { m_database->erase(fm_id); return true; } catch (const odb::exception& e) { std::cout<<"unable to erase " + std::string(typeid(T).name()) + " -> " + std::string(e.what())< T is a regular odb class, with #pragma db object pointer(std::shared_ptr) session and a #pragma db id autounsigned long m_id; I think all necessary code is present. Thanks again 2016-06-02 14:10 GMT+02:00 Boris Kolpackov : > Hi, > > Pierre-Olivier Rocher writes: > > > error: no matching function for call to ?odb::database::erase(const > int&)? > > m_database->erase(fm_id); > > > > [...] > > > > It seems to be a cast issue between "const int&" and "const typename > > odb::object_traits::id_type&" but i'm currently not able to fix the > > issue. > > Show us the definition of your objects, particularly the object id data > member as well as the code where you get the error. Without this info > we can only guess and speculate. > > Boris > From boris at codesynthesis.com Fri Jun 3 11:48:17 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 3 11:48:30 2016 Subject: [odb-users] Compilation issue with gcc In-Reply-To: References: Message-ID: Hi Pierre-Olivier, Pierre-Olivier Rocher writes: > template > inline bool data::erase(const int fm_id) > { > m_database->erase(fm_id); Try to add template after ->: m_database->template erase(fm_id); > [...] > > #pragma db id auto > unsigned long m_id; While this should work, note that long could be longer than int which means you may get incorrect result for sufficiently large ids. Boris From ellav at checkpoint.com Tue Jun 7 04:06:35 2016 From: ellav at checkpoint.com (Ella Vishnevsky) Date: Tue Jun 7 04:06:45 2016 Subject: [odb-users] How to add a table to existing schema without dropping data? Message-ID: <4E3D0839F36EF04D988AECF0CA558E15DAFF997E@DAG-EX10.ad.checkpoint.com> Hello, I'm using the 2.1.1 odb version . I have 2 Sqlite files, each containing 2 tables. I want to add a table to one of them without dropping the data(for example, person table). Is it possible? The compilation of new file: odbCompilePath -d sqlite --generate-query --generate-schema --schema-name schemaName1 person.h && cp person-odb.cxx person-odb.cpp compilation of existing files: odbCompilePath -d sqlite --generate-query --generate-schema --schema-name schemaName1 test1.h && cp test1-odb.cxx test1-odb.cpp odbCompilePath -d sqlite --generate-query --generate-schema --schema-name schemaName1 test2.h && cp test2-odb.cxx test2-odb.cpp odbCompilePath -d sqlite --generate-query --generate-schema --schema-name schemaName2 test3.h && cp test3-odb.cxx test3-odb.cpp odbCompilePath -d sqlite --generate-query --generate-schema --schema-name schemaName2 test4.h && cp test4-odb.cxx test4-odb.cpp // creating new db: odb::database *m_db_3 = new odb::sqlite::database("TEST1",SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); // creating schema ---> dropping data odb::schema_catalog::create_schema (*m_db_3," schemaName1 "); I'm looking for something like : "add table if does not exist" Is it possible? Thanks! From ellav at checkpoint.com Tue Jun 7 07:27:55 2016 From: ellav at checkpoint.com (Ella Vishnevsky) Date: Tue Jun 7 07:28:05 2016 Subject: [odb-users] Creating schema and adding tables without dropping data In-Reply-To: References: <4E3D0839F36EF04D988AECF0CA558E15DAFF67F6@DAG-EX10.ad.checkpoint.com> Message-ID: <4E3D0839F36EF04D988AECF0CA558E15DAFF9B3C@DAG-EX10.ad.checkpoint.com> Can you please explain again the second option? -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Thursday, April 21, 2016 6:54 PM To: Ella Vishnevsky Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Creating schema and adding tables without dropping data Hi Ella, Ella Vishnevsky writes: > I wanted to implement the following scenario: > > 1. Check if sqlite db file exists: > a. Does not exist : > i. Create new file with all tables that have the "db object" pragma. > b. Exists: > i. Add the new tables without erasing data from old tables The tricky part is to distinguish between "old" and "new" tables. There are two ways you can do this: 1. Use ODB schema evolution support (Chapter 13). This way ODB will keep track of what's new/old (and more; like making changes to old tables, etc). 2. Keep track of new tables manually by partitioning them into separate entries in the schema catalog (with the --schema-name option). You will then have to figure out "where" on the timeline your database is and apply the missing entries from the catalog (to achieve this in #1 ODB keeps track of the database schema version in a special table). Boris Email secured by Check Point. From zhangying at zdmedtech.com Tue Jun 7 23:07:02 2016 From: zhangying at zdmedtech.com (=?UTF-8?B?5byg6aKW?=) Date: Wed Jun 8 00:40:30 2016 Subject: [odb-users] odb-examples-2.4.0/qt/ compile problem Message-ID: <83c25828-a5a4-4a00-8b99-15efe8b30ba6.zhangying@zdmedtech.com> hi: when I try to compile the example in odb-examples-2.4.0/qt/ (follow readme guide), this error report always exist. zypc@zypc-MS-7851:~/org-file-package/odb/odb-examples-2.4.0/qt$ g++ -fPIC -o driver driver.o employee-odb.o -lodb-qt -lodb-mysql -lodb -lQt5Core -lQt5Widgets -lQtGui driver.o:(.qtversion[qt_version_tag]+0x0)???qt_version_tag??????? collect2: error: ld returned 1 exit status my build environment:Ubuntu 14.04 ? libodb-2.4.0? libodb-mysql-2.4.0? libodb-qt-2.4.0? Qt 5.6.0 zypc@zypc-MS-7851:~/catkin_ws$ qmake -v QMake version 3.0 Using Qt version 5.6.0 in /opt/Qt5.6.0/5.6/gcc_64/libdoes libodb-qt-2.4.0 support Qt5.6.0? does it matter to macro QT_NO_VERSION_TAGGING? waiting for your reply, thankyou very much! From boris at codesynthesis.com Wed Jun 8 01:25:06 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 8 01:25:21 2016 Subject: [odb-users] How to add a table to existing schema without dropping data? In-Reply-To: <4E3D0839F36EF04D988AECF0CA558E15DAFF997E@DAG-EX10.ad.checkpoint.com> References: <4E3D0839F36EF04D988AECF0CA558E15DAFF997E@DAG-EX10.ad.checkpoint.com> Message-ID: Hi Ella, Ella Vishnevsky writes: > I'm using the 2.1.1 odb version. You may want to consider upgrading to 2.4.0 which supports schema evolution. > odb::schema_catalog::create_schema (*m_db_3," schemaName1 "); Yes, this approach (i.e., packaging each new set of tables into a separate schema name) is probably your best option if you can't use schema evolution support. Note, however, that the string literal should be "schemaName1", and not " schemaName1 ". > I'm looking for something like : "add table if does not exist" > Is it possible? Only with schema evolution. Boris From trynitron at gmail.com Wed Jun 8 09:37:46 2016 From: trynitron at gmail.com (Pierre-Olivier Rocher) Date: Wed Jun 8 12:33:15 2016 Subject: [odb-users] Compilation issue with gcc In-Reply-To: References: Message-ID: Hi Boris, I tried your trick, without success... But I finally found my issue. It was a macro problem, in a header file. For some reason, the macro was already defined, the code source was ignored !!! A solution to avoid this kind of problem is to use #pragma once, and not #ifndef #def #endif Pierre-Olivier 2016-06-03 17:48 GMT+02:00 Boris Kolpackov : > Hi Pierre-Olivier, > > Pierre-Olivier Rocher writes: > > > template > > inline bool data::erase(const int fm_id) > > { > > m_database->erase(fm_id); > > Try to add template after ->: > > m_database->template erase(fm_id); > > > > [...] > > > > #pragma db id auto > > unsigned long m_id; > > While this should work, note that long could be longer than int > which means you may get incorrect result for sufficiently large > ids. > > Boris > From andrei.i.ivanov at commandus.com Thu Jun 9 02:40:27 2016 From: andrei.i.ivanov at commandus.com (Andrei Ivanov) Date: Thu Jun 9 12:33:47 2016 Subject: [odb-users] Native view paramter placeholder (?) Message-ID: Hi All, When aI put parameter placeholder for text '(?)' like this: #pragma db view query("SELECT \"object_id\" userid FROM \"User_phones\" WHERE value_number1 = '(?)'"); it produces SQL statements with parens like this ..."User_phones" WHERE value_number1 = '(79141040619)' If I use '?' without parens, it appends WHERE clause because ther is no pacleholder found. How must I use striing placeholder? -- Best regards, Andrei Ivanov tel:+7 (914) 104-0619 fax:+1 (801) 880-0903 http://commandus.com/ From boris at codesynthesis.com Thu Jun 9 13:17:54 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 9 13:18:07 2016 Subject: [odb-users] Native view paramter placeholder (?) In-Reply-To: References: Message-ID: Hi Andrei, Andrei Ivanov writes: > When aI put parameter placeholder for text '(?)' like this: > > #pragma db view query("SELECT \"object_id\" userid FROM \"User_phones\" > WHERE value_number1 = '(?)'"); > > it produces SQL statements with parens like this > > ..."User_phones" WHERE value_number1 = '(79141040619)' The manual, specifically, the section that talks about native views explicitly says that this won't work. > How must I use striing placeholder? There is no such thing as "string placeholder" in ODB. Your best option is probably this: #pragma db view query("SELECT \"object_id\" userid FROM \"User_phones\""); db->query<...> ("value_number1 = '79141040619'"); Boris From andrei.i.ivanov at commandus.com Thu Jun 9 20:39:52 2016 From: andrei.i.ivanov at commandus.com (Andrei Ivanov) Date: Fri Jun 10 13:30:35 2016 Subject: [odb-users] Native view paramter placeholder (?) In-Reply-To: References: Message-ID: Hi Boris, Ok, thank you, it works fine. 2016-06-10 2:17 GMT+09:00 Boris Kolpackov : > Hi Andrei, > > Andrei Ivanov writes: > > > When aI put parameter placeholder for text '(?)' like this: > > > > #pragma db view query("SELECT \"object_id\" userid FROM \"User_phones\" > > WHERE value_number1 = '(?)'"); > > > > it produces SQL statements with parens like this > > > > ..."User_phones" WHERE value_number1 = '(79141040619)' > > The manual, specifically, the section that talks about native views > explicitly says that this won't work. > > > > How must I use striing placeholder? > > There is no such thing as "string placeholder" in ODB. Your best option > is probably this: > > #pragma db view query("SELECT \"object_id\" userid FROM \"User_phones\""); > > db->query<...> ("value_number1 = '79141040619'"); > > Boris > -- Best regards, Andrei Ivanov tel:+7 (914) 104-0619 fax:+1 (801) 880-0903 http://commandus.com/ From nagzso14 at gmail.com Mon Jun 13 07:29:58 2016 From: nagzso14 at gmail.com (Zsolt Nagy) Date: Mon Jun 13 09:21:44 2016 Subject: [odb-users] Unable to convert MYSQL query into ODB query Message-ID: Hi! I should implement the following SQL query, but I am unable to do it and I would like to ask for your help: SELECT computer.id FROM computer, computer AS computer2 WHERE computer.id=%llu AND computer2.id=%llu AND computer.id_network = computer2.id_network; Is it possible to achieve this goal with odb? I really appreciate any help you can provide. Best regards, Zsolt From jonathanjones at sics.co.at Mon Jun 13 10:12:28 2016 From: jonathanjones at sics.co.at (JOnathanJOnes) Date: Mon Jun 13 11:03:26 2016 Subject: [odb-users] odb for arm procrssors Message-ID: <575EBF4C.3020008@sics.co.at> Hello! Is there a way to compile the library for arm processors? -- JOnathanJOnes From boris at codesynthesis.com Mon Jun 13 11:40:11 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 13 11:40:21 2016 Subject: [odb-users] Unable to convert MYSQL query into ODB query In-Reply-To: References: Message-ID: Hi Zsolt, Zsolt Nagy writes: > SELECT computer.id > FROM computer, computer AS computer2 > WHERE computer.id=%llu AND > computer2.id=%llu AND > computer.id_network = computer2.id_network; > > Is it possible to achieve this goal with odb? Yes, you can use an ODB view for that. See Chapter 10, "Views" in the ODB manual. Boris From boris at codesynthesis.com Mon Jun 13 11:41:44 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 13 11:41:54 2016 Subject: [odb-users] odb for arm procrssors In-Reply-To: <575EBF4C.3020008@sics.co.at> References: <575EBF4C.3020008@sics.co.at> Message-ID: Hi, JOnathanJOnes writes: > Is there a way to compile the library for arm processors? Yes, see, for example, this Wiki article: http://wiki.codesynthesis.com/Using_ODB_on_Mobile_and_Embedded_Systems Boris From davejohansen at gmail.com Sun Jun 19 20:15:02 2016 From: davejohansen at gmail.com (Dave Johansen) Date: Sun Jun 19 20:15:15 2016 Subject: [odb-users] odb for arm procrssors In-Reply-To: References: <575EBF4C.3020008@sics.co.at> Message-ID: On Mon, Jun 13, 2016 at 9:41 AM, Boris Kolpackov wrote: > Hi, > > JOnathanJOnes writes: > > > Is there a way to compile the library for arm processors? > > Yes, see, for example, this Wiki article: > > http://wiki.codesynthesis.com/Using_ODB_on_Mobile_and_Embedded_Systems If you happen to be using Fedora, it's already packaged and built for ARM: https://admin.fedoraproject.org/pkgdb/package/rpms/libodb/ From ludovic.lai at gmail.com Tue Jun 21 20:10:20 2016 From: ludovic.lai at gmail.com (Ludovic Lai) Date: Wed Jun 22 12:12:17 2016 Subject: [odb-users] try for the first time your odb Message-ID: <028f01d1cc1a$76dce8a0$6496b9e0$@gmail.com> Hi, I have just read the documentation and i think it s a very smart lib just a first return , all is very easy to install (on ubuntu ) but for the odb-tests-2.4.0 in the first time i have receive an error due to the LD_LIBRARY_PATH was not on /usr/local/lib /home/ludo/dev/testodb/odb-tests-2.4.0/common/access/.libs/lt-driver: error while loading shared libraries: libodb-sqlite-2.4.so: cannot open shared object file: No such file or diirectory FAIL: ../../tester May be you should add this control in your ./configure Kind regards (many thx for your beautiful code) Ludovic La? From anton.paymyshev at gmail.com Thu Jun 23 05:42:33 2016 From: anton.paymyshev at gmail.com (Anton Paymyshev) Date: Thu Jun 23 05:43:04 2016 Subject: [odb-users] odb crash when section is loaded Message-ID: Hello, I'm using odb2.3 + sqlite + vs2015 on windows. I have a persistent class A with a value struct V which is the only member of section S. V has a vector B field marked as BLOB. There are 3 consecutive transactions. 1) Load object A, load section S 2) Load object A, load section S, set A.V.B to a vector of 1000 bytes, update A. 3) Load object A, load section S -> crash. After some debugging it looks like S_section_traits::load gets select_statement::truncated error from fetch and tries to grow cached column sizes for section S. But S_section_traits::grow receives *array of bools for section S* but tries to grow *all fields from object A* causing memory corruption. Looks like a bug when section_traits::grow enumerates all fields from parent object instead of only fields related to corresponding section. So the questions are: 1) Is is a know problem? 2) Was something like that fixed in 2.4? If it is a new problem and my quick description is not enough I could provide a minimum example (if needed). Thanks. From odb at a-cunningham.com Thu Jun 23 09:59:38 2016 From: odb at a-cunningham.com (Andrew Cunningham) Date: Thu Jun 23 09:59:52 2016 Subject: [odb-users] odb crash when section is loaded In-Reply-To: References: Message-ID: This sounds like an issue I encountered and Boris quickly fixed in a patch of 2.4. I suggest you upgrade to 2.5.0a7+ as that fixes another section issue I found. 2.5.0a7 seems quite robust. On Thu, Jun 23, 2016 at 2:42 AM, Anton Paymyshev wrote: > Hello, > > I'm using odb2.3 + sqlite + vs2015 on windows. > > I have a persistent class A with a value struct V which is the only member > of section S. > V has a vector B field marked as BLOB. > > There are 3 consecutive transactions. > > 1) Load object A, load section S > 2) Load object A, load section S, set A.V.B to a vector of 1000 bytes, > update A. > 3) Load object A, load section S -> crash. > > After some debugging it looks like S_section_traits::load gets > select_statement::truncated error from fetch and tries to grow cached > column sizes for section S. But S_section_traits::grow receives *array of > bools for section S* but tries to grow *all fields from object A* causing > memory corruption. > > Looks like a bug when section_traits::grow enumerates all fields from > parent object instead of only fields related to corresponding section. > > So the questions are: > 1) Is is a know problem? > 2) Was something like that fixed in 2.4? > > If it is a new problem and my quick description is not enough I could > provide a minimum example (if needed). > > Thanks. > From boris at codesynthesis.com Thu Jun 23 12:38:01 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 23 12:37:58 2016 Subject: [odb-users] odb crash when section is loaded In-Reply-To: References: Message-ID: Hi Anton, Andrew Cunningham writes: > This sounds like an issue I encountered and Boris quickly fixed in a patch > of 2.4. Yes, this does sound like the same issue. > I suggest you upgrade to 2.5.0a7+ as that fixes another section issue I > found. 2.5.0a7 seems quite robust. And you can get it here: http://codesynthesis.com/~boris/tmp/odb/pre-release/a7/ Boris From boris at codesynthesis.com Thu Jun 23 12:41:51 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 23 12:41:48 2016 Subject: [odb-users] try for the first time your odb In-Reply-To: <028f01d1cc1a$76dce8a0$6496b9e0$@gmail.com> References: <028f01d1cc1a$76dce8a0$6496b9e0$@gmail.com> Message-ID: Hi Ludovic, Ludovic Lai writes: > I have just read the documentation and i think it s a very smart lib Thanks, I am glad you like it. > but for the odb-tests-2.4.0 in the first time i have receive an error > due to the LD_LIBRARY_PATH was not on /usr/local/lib I believe on Ubuntu /usr/local/lib is searched by default BUT you need to update the cache after installig any *.so in there by running: sudo ldconfig > May be you should add this control in your ./configure I don't think one can achieve anything from within configure. However, during the installation (of libodb*) the process prints are warning to this effect. Boris From garvit.juniwal at rubrik.com Mon Jun 27 18:34:09 2016 From: garvit.juniwal at rubrik.com (Garvit Juniwal) Date: Tue Jun 28 09:12:43 2016 Subject: [odb-users] How to get name of a table without reflection Message-ID: I have a persistent ODB object, say person. I want to be able to say something like person::table_name and that should return the string "person". I see a table_name static in the generated code, but is there a way to make that accessible? Or is there some other trick that can be used? Garvit From boris at codesynthesis.com Tue Jun 28 10:03:12 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 28 10:03:06 2016 Subject: [odb-users] How to get name of a table without reflection In-Reply-To: References: Message-ID: Hi Garvit, Garvit Juniwal writes: > I have a persistent ODB object, say person. I want to be able to say > something like person::table_name and that should return the string > "person". I see a table_name static in the generated code, but is there a > way to make that accessible? Yes, it is accessible, see this thread from a few weeks ago: http://www.codesynthesis.com/pipermail/odb-users/2016-April/003209.html Boris From Leo_Ashkinaziy at symantec.com Tue Jun 28 20:17:00 2016 From: Leo_Ashkinaziy at symantec.com (Leo Ashkinaziy) Date: Tue Jun 28 20:18:14 2016 Subject: [odb-users] Using ODB from DLL on Windows XP Message-ID: Hello, I'm running into an issue where I see a crash in my program when I use ODB from a DLL on Windows XP. The same program runs on other OS fine. I found this thread from few years ago with what seems to be the same problem. http://www.codesynthesis.com/pipermail/odb-users/2012-January/000415.html The solution in that thread seemed to comment out "#define ODB_THREADS_TLS_DECLSPEC" in odb\details\config-vc.h and rebuild ODB. It did not work for me when I tried it, and actually caused crashes on other OS as well. Is there anything else to be tried? I created a small program to show how it's used. I'm using SQLite. The solution zip is here: https://app.box.com/s/6d1m95txldv39mu49xt0u1f13ipoliys I did not include any ODB or Boost libraries or headers. I can add those if needed. The projects in the solution are: ConsoleApp - Creates the database and adds a table and a row. DBReader - Loads DynLib.dll to read the database. DyLib - DLL that reads the database and prints the value in the table. Please let me know if this can be addressed on Windows XP. Thank you. -- Leo From boris at codesynthesis.com Wed Jun 29 02:33:02 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 29 02:32:53 2016 Subject: [odb-users] Using ODB from DLL on Windows XP In-Reply-To: References: Message-ID: Hi Leo, Leo Ashkinaziy writes: > The solution in that thread seemed to comment out "#define > ODB_THREADS_TLS_DECLSPEC" in odb\details\config-vc.h and rebuild ODB. > It did not work for me when I tried it, and actually caused crashes > on other OS as well. Is there anything else to be tried? Did you rebuild everything ODB-related after making this change? In particular, you need to rebuild libodb-sqlite (and any other libodb* library you may be using) as well as every project that links to anything ODB-related. The only thing you don't need to rebuild is the ODB compiler. Boris From adanesh at noornet.net Wed Jun 29 08:50:56 2016 From: adanesh at noornet.net (=?utf-8?B?2LnZhNuMINiv2KfZhti0?=) Date: Wed Jun 29 08:51:08 2016 Subject: [odb-users] How to change the join type of relations in a view In-Reply-To: <201606281600.u5SG03ts011351@codesynthesis.com> References: <201606281600.u5SG03ts011351@codesynthesis.com> Message-ID: <1467204656624.64348@noornet.net> Hi Boris! How to change the join type of relations in a view. I want to use 'inner' instead of 'left'. e.g.: #pragma db object pointer(std::shared_ptr) session class SubjectIndex { public: #pragma db id auto int m_id; QString m_subject; #pragma db unordered QList> m_tags; }; #pragma db object pointer(std::shared_ptr) session class TagIndex { public: #pragma db id auto int m_id; QString m_tag; }; #pragma db view object(TagIndex) object(SubjectIndex inner) struct TagSubjectIndex { QString m_subject; }; The generated query in '*-odb.cxx' file is like this: query_base_type r ( "SELECT " "\"SubjectIndex\".\"subject\", " "\"SubjectIndex\".\"bookID\" "); r += "FROM \"TagIndex\""; r += " INNER JOIN \"SubjectIndex_tags\" ON"; r += "\"SubjectIndex_tags\".\"value\"=\"TagIndex\".\"id\""; r += " LEFT JOIN \"SubjectIndex\" ON"; r += "\"SubjectIndex_tags\".\"object_id\"=\"SubjectIndex\".\"id\""; As you see there is a 'LEFT JOIN' that I want to change it to "INNER JOIN". How can I do that? Thanks, Ali From adanesh at noornet.net Wed Jun 29 08:55:40 2016 From: adanesh at noornet.net (=?utf-8?B?2LnZhNuMINiv2KfZhti0?=) Date: Wed Jun 29 08:55:50 2016 Subject: [odb-users] How to create an index for 'value' field in the relation table In-Reply-To: <201606281600.u5SG03ts011351@codesynthesis.com> References: <201606281600.u5SG03ts011351@codesynthesis.com> Message-ID: <1467204940461.26741@noornet.net> Hi Boris! How to create an index for 'value' field in the relation table? e.g.: #pragma db object pointer(std::shared_ptr) session class SubjectIndex { public: #pragma db id auto int m_id; QString m_subject; #pragma db unordered QList> m_tags; }; #pragma db object pointer(std::shared_ptr) session class TagIndex { public: #pragma db id auto int m_id; QString m_tag; }; An index for 'object_id' is already created automatically. db.execute ("CREATE INDEX \"SubjectIndex_tags_object_id_i\"\n" " ON \"SubjectIndex_tags\" (\"object_id\")"); But I need an index for 'value' field. How can I create that? Thanks, Ali From Leo_Ashkinaziy at symantec.com Wed Jun 29 19:53:11 2016 From: Leo_Ashkinaziy at symantec.com (Leo Ashkinaziy) Date: Wed Jun 29 19:54:42 2016 Subject: [odb-users] Using ODB from DLL on Windows XP In-Reply-To: References: Message-ID: Hi Boris, Thank you for replying. Yes, I did rebuild everything. Just to be sure this morning I downloaded new libodb, libodb-sqlite, and libodb-boost and rebuilt from scratch. I had to make the following changes to the solutions in the zip: * Change platform toolset to Visual Studio 2013 - Windows XP (v120_xp) * Change configuration type to static library * Change preprocessor defines where appropriate to LIBODB_SQLITE_STATIC_LIB, LIBODB_BOOST_STATIC_LIB, and LIBODB_STATIC_LIB With the rebuilt ODB libraries and the change in config-vc.h I see the same crash on my Windows 7 machine. I have not tried on Windows XP. Since it was local I ran it from Visual Studio so I could get the call stack and the crash details: Unhandled exception at 0x7728E6DF (ntdll.dll) in ConsoleApp.exe: 0xC0000005: Access violation writing location 0x00000014. ConsoleApp.exe!odb::details::win32_lock::win32_lock(_RTL_CRITICAL_SECTION & cs) Line 23 C++ ConsoleApp.exe!odb::details::win32_once(unsigned int & o, void (void) * func) Line 14 C++ ConsoleApp.exe!odb::details::tls::get() Line 76 C++ ConsoleApp.exe!odb::details::tls_get(const odb::details::tls & t) Line 104 C++ ConsoleApp.exe!odb::transaction::reset(odb::transaction_impl * impl, bool make_current) Line 39 C++ ConsoleApp.exe!odb::transaction::transaction(odb::transaction_impl * impl, bool make_current) Line 26 C++ ConsoleApp.exe!CreateDatabase(std::shared_ptr spDb) Line 39 C++ ConsoleApp.exe!main(int argc, char * * argv) Line 18 C++ ConsoleApp.exe!__tmainCRTStartup() Line 255 C ConsoleApp.exe!mainCRTStartup() Line 165 C -- Leo -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Tuesday, June 28, 2016 11:33 PM To: Leo Ashkinaziy Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Using ODB from DLL on Windows XP Hi Leo, Leo Ashkinaziy writes: > The solution in that thread seemed to comment out "#define > ODB_THREADS_TLS_DECLSPEC" in odb\details\config-vc.h and rebuild ODB. > It did not work for me when I tried it, and actually caused crashes on > other OS as well. Is there anything else to be tried? Did you rebuild everything ODB-related after making this change? In particular, you need to rebuild libodb-sqlite (and any other libodb* library you may be using) as well as every project that links to anything ODB-related. The only thing you don't need to rebuild is the ODB compiler. Boris From boris at codesynthesis.com Thu Jun 30 02:48:49 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 30 02:48:39 2016 Subject: [odb-users] Using ODB from DLL on Windows XP In-Reply-To: References: Message-ID: Hi Leo, Leo Ashkinaziy writes: > * Change configuration type to static library > * Change preprocessor defines where appropriate to LIBODB_SQLITE_STATIC_LIB, > LIBODB_BOOST_STATIC_LIB, and LIBODB_STATIC_LIB Ok, now we get the missing piece of the puzzle: you not only disabled the use of the declspec(thread), but you also made all the ODB libraries static. This is the lethal combination ;-). When you disable declspec(thread), ODB has to emulate POSIX-like TLS support and for that it needs to allocate some data structures at process/thread startup. When libodb is built as a DLL, it does all this automatically from DllMain(). For a static library, however, you will need to do this manually (which is also the reason why we don't provide static build configurations). In your case, the easiest will probably be to replicate the calls found in libodb/odb/details/win32/dll.cxx in your DynLib.dll's DllMain(). Boris From Leo_Ashkinaziy at symantec.com Thu Jun 30 21:51:52 2016 From: Leo_Ashkinaziy at symantec.com (Leo Ashkinaziy) Date: Thu Jun 30 21:52:08 2016 Subject: [odb-users] Using ODB from DLL on Windows XP In-Reply-To: References: Message-ID: Hi Boris, Thank you. That worked. I pretty much pasted libodb/odb/details/win32/dll.cxx into our DllMain() and that worked for the DLL. For the ConsoleApp I call process_start() and thread_start() in the start of main() and thread_end() and process_end() at the end. I'm assuming that's the correct thing to do? -- Leo -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, June 29, 2016 11:49 PM To: Leo Ashkinaziy Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Using ODB from DLL on Windows XP Hi Leo, Leo Ashkinaziy writes: > * Change configuration type to static library > * Change preprocessor defines where appropriate to LIBODB_SQLITE_STATIC_LIB, > LIBODB_BOOST_STATIC_LIB, and LIBODB_STATIC_LIB Ok, now we get the missing piece of the puzzle: you not only disabled the use of the declspec(thread), but you also made all the ODB libraries static. This is the lethal combination ;-). When you disable declspec(thread), ODB has to emulate POSIX-like TLS support and for that it needs to allocate some data structures at process/thread startup. When libodb is built as a DLL, it does all this automatically from DllMain(). For a static library, however, you will need to do this manually (which is also the reason why we don't provide static build configurations). In your case, the easiest will probably be to replicate the calls found in libodb/odb/details/win32/dll.cxx in your DynLib.dll's DllMain(). Boris