From i_man90 at mail.ru Tue Aug 4 05:57:54 2015 From: i_man90 at mail.ru (=?UTF-8?B?0JDQuSDQnNGN0L0=?=) Date: Tue Aug 4 05:58:04 2015 Subject: [odb-users] Corrupting unsigned char* when saving to database(pgsql) Message-ID: <1438682274.304943974@f432.i.mail.ru> ?I have a problem with saving SHA hash to database. When I save and load it back from db, it becomes corrupted(filled with one type symbol like a - 25cccccccccccccccccc). I'm mapping this array with: #pragma db type("BYTEA(20)") unsigned char hash_[20]; ?What's the problem? I've searched for solution through internet, but there's no any forums. cheers From i_man90 at mail.ru Tue Aug 4 11:45:54 2015 From: i_man90 at mail.ru (=?UTF-8?B?0JDQuSDQnNGN0L0=?=) Date: Tue Aug 4 11:46:03 2015 Subject: [odb-users] Bytea data corruption solved Message-ID: <1438703154.121587966@f331.i.mail.ru> Sorry for misleading, problem was on my side - I copied array incorrectly. cheers. From Versteden2 at upcmail.nl Fri Aug 7 06:24:05 2015 From: Versteden2 at upcmail.nl (Versteden2) Date: Fri Aug 7 07:09:57 2015 Subject: [odb-users] Error when adding --profile qt Message-ID: <1438943045.11636.7.camel@upcmail.nl> Hello, I have a working project. ow I want to make a change to use QString for strings instead of std::string. For this i added --profile qt to the odb compilation command. Now i get an error: taskmanager.cpp:60:36: error: no matching function for call to ?std::shared_ptr::shared_ptr(odb::object_traits::pointer_ty pe)? on the code: int TaskManager::LoadTasks() { typedef odb::query query; typedef odb::result result; odb::result< task > r; { int index; transaction t (db->begin ()); result r (db->query ()); qDebug() << "Number of rows fetched (1) " << r.size(); index = 0; for (result::iterator i (r.begin ()); i != r.end (); ++i, index++) { qDebug() << "Filling data, index = " << index; shared_ptr p (i.load ()); <<<< Got an error on this line.. _tasks[p->get_id()] = p; } t.commit (); qDebug() << "Number of rows fetched (2)" << _tasks.size(); return _tasks.size(); } } Can anyone tel me what i am doing wrong? From boris at codesynthesis.com Fri Aug 7 07:16:20 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 7 07:16:22 2015 Subject: [odb-users] Error when adding --profile qt In-Reply-To: <1438943045.11636.7.camel@upcmail.nl> References: <1438943045.11636.7.camel@upcmail.nl> Message-ID: Hi, Versteden2 writes: > For this i added --profile qt to the odb compilation command. Now i get > an error: > > taskmanager.cpp:60:36: error: no matching function for call to > ?std::shared_ptr::shared_ptr(odb::object_traits::pointer_ty > pe)? > > shared_ptr p (i.load ()); <<<< Got an error on this line.. As mentioned in the Qt profile's documentation, enabling it makes QSharedPointer the default object pointer. In other words, before adding this option, i.load() above returned task* while after adding it, it started returning QSharedPointer. If you want to continue using shared_ptr, add the following option after the '--profile qt': --default-pointer std::shared_ptr Boris From Versteden2 at upcmail.nl Sat Aug 8 08:22:53 2015 From: Versteden2 at upcmail.nl (Versteden2) Date: Mon Aug 10 06:49:18 2015 Subject: [odb-users] Error when adding --profile qt In-Reply-To: References: <1438943045.11636.7.camel@upcmail.nl> Message-ID: <1439036573.2161.1.camel@upcmail.nl> Boris, Thank you for the quick reply. I changed the code to use QSharedPointer now and it work. Harrie On Fri, 2015-08-07 at 13:16 +0200, Boris Kolpackov wrote: > Hi, > > Versteden2 writes: > > > For this i added --profile qt to the odb compilation command. Now i > > get > > an error: > > > > taskmanager.cpp:60:36: error: no matching function for call to > > ?std::shared_ptr::shared_ptr(odb::object_traits::pointe > > r_ty > > pe)? > > > > shared_ptr p (i.load ()); <<<< Got an error on this line.. > > As mentioned in the Qt profile's documentation, enabling it makes > QSharedPointer the default object pointer. In other words, before > adding this option, i.load() above returned task* while after > adding it, it started returning QSharedPointer. If you want > to continue using shared_ptr, add the following option after the > '--profile qt': > > --default-pointer std::shared_ptr > > Boris > From finjulhich at gmail.com Tue Aug 11 10:06:33 2015 From: finjulhich at gmail.com (MM) Date: Tue Aug 11 10:06:41 2015 Subject: [odb-users] boost::variant<...> or boost::any for sqlite Message-ID: I see this old thread: http://www.codesynthesis.com/pipermail/odb-users/2012-April/000494.html Are any of the types mappables now as of odb 2.4.0? MM From boris at codesynthesis.com Tue Aug 11 11:44:51 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Aug 11 11:44:53 2015 Subject: [odb-users] boost::variant<...> or boost::any for sqlite In-Reply-To: References: Message-ID: MM writes: > I see this old thread: > http://www.codesynthesis.com/pipermail/odb-users/2012-April/000494.html > > Are any of the types mappables now as of odb 2.4.0? Here is what's possible as of 2.4.0: 1. If you are mapping to a database that has a variant/any type, then you can use ODB support for extended database type mapping[1] to add such a mapping. The mssql/custom test in the odb-tests package shows how to do this for SQL Server. [1] http://www.codesynthesis.com/~boris/blog/2012/07/18/custom-database-to-cxx-type-mapping-in-odb/ 2. Alternatively, you can map a specific variant instance (i.e., with the specific set of possible types) using virtual data members (and a composite value to hold nullable alternatives) as outlined in the above post. Even better, for 2.5.0 you will be able to do this for the type and not data member(s), in case you have multiple data members that use the same type. Boris From benjamin.urech at bfh.ch Thu Aug 13 03:02:35 2015 From: benjamin.urech at bfh.ch (Beni Urech) Date: Thu Aug 13 03:02:45 2015 Subject: [odb-users] Compile error with static multi DB and lazy_weak_ptr Message-ID: <55CC410B.8090903@bfh.ch> Hi there We are currently moving a project from single DB to a static multi DB setup. When we now add the multi DB parameters to the ODB compiler, the resulting cxx files fail to compile in GCC. The problem seems to be the the relations with odb::lazy_weak_ptr we use. When we replace them with lazy_shared_ptr, the generated files compile. Is this a limitation of ODB or did I miss something? Compile error: In file included from /usr/local/include/odb/lazy-ptr.hxx:14:0, from example.h:16, from example-odb-sqlite.hxx:16: /usr/local/include/odb/traits.hxx: In instantiation of ?struct odb::object_traits_impl?: /usr/local/include/odb/database.ixx:753:54: required from ?typename odb::object_traits::pointer_type odb::database::find_(const typename odb::object_traits::id_type&) [with T = Process; odb::database_id DB = (odb::database_id)5u; typename odb::object_traits::pointer_type = std::shared_ptr; typename odb::object_traits::id_type = unsigned int]? /usr/local/include/odb/database.txx:239:37: required from ?typename odb::object_traits::pointer_type odb::database::load_(const typename odb::object_traits::id_type&) [with T = Process; odb::database_id DB = (odb::database_id)5u; typename odb::object_traits::pointer_type = std::shared_ptr; typename odb::object_traits::id_type = unsigned int]? /usr/local/include/odb/database.ixx:249:35: required from ?typename odb::object_traits::pointer_type odb::database::load(const typename odb::object_traits::id_type&) [with T = Process; typename odb::object_traits::pointer_type = std::shared_ptr; typename odb::object_traits::id_type = unsigned int]? /usr/local/include/odb/lazy-ptr-impl.txx:31:54: required from ?static typename odb::object_traits::pointer_type odb::lazy_ptr_base::loader(odb::lazy_ptr_base::database_type&, const typename odb::object_traits::id_type&) [with T = Process; DB = odb::database; typename odb::object_traits::pointer_type = std::shared_ptr; odb::lazy_ptr_base::database_type = odb::database; typename odb::object_traits::id_type = unsigned int]? /usr/local/include/odb/lazy-ptr-impl.ixx:361:36: required from ?void odb::lazy_ptr_impl::reset_db(DB&) [with DB = odb::database; T = Process]? /usr/local/include/odb/lazy-ptr.ixx:1232:7: required from ?odb::lazy_shared_ptr::lazy_shared_ptr(DB&, const std::shared_ptr&) [with DB = odb::database; Y = Process; T = Process]? /usr/local/include/odb/lazy-ptr.txx:127:43: required from ?odb::lazy_shared_ptr odb::lazy_weak_ptr::lock() const [with T = Process]? /usr/local/include/odb/lazy-pointer-traits.hxx:132:22: required from ?static odb::pointer_traits > ::strong_pointer_type odb::pointer_traits > ::lock(const pointer_type&) [with T = Process; odb::pointer_traits >::strong_pointer_type = odb::lazy_shared_ptr; odb::pointer_traits >::pointer_type = odb::lazy_weak_ptr]? example-odb-sqlite.cxx:1305:57: required from here /usr/local/include/odb/traits.hxx:177:10: error: invalid use of incomplete type ?class odb::access::object_traits_impl? struct object_traits_impl: ^ In file included from /usr/local/include/odb/core.hxx:17:0, from example.h:15, from example-odb-sqlite.hxx:16: /usr/local/include/odb/forward.hxx:99:11: error: declaration of ?class odb::access::object_traits_impl? class object_traits_impl; ^ In file included from /usr/local/include/odb/database.hxx:631:0, from /usr/local/include/odb/lazy-ptr-impl.txx:5, from /usr/local/include/odb/lazy-ptr-impl.hxx:186, from /usr/local/include/odb/lazy-ptr.hxx:15, from example.h:16, from example-odb-sqlite.hxx:16: /usr/local/include/odb/database.ixx: In instantiation of ?typename odb::object_traits::pointer_type odb::database::find_(const typename odb::object_traits::id_type&) [with T = Process; odb::database_id DB = (odb::database_id)5u; typename odb::object_traits::pointer_type = std::shared_ptr; typename odb::object_traits::id_type = unsigned int]?: /usr/local/include/odb/database.txx:239:37: required from ?typename odb::object_traits::pointer_type odb::database::load_(const typename odb::object_traits::id_type&) [with T = Process; odb::database_id DB = (odb::database_id)5u; typename odb::object_traits::pointer_type = std::shared_ptr; typename odb::object_traits::id_type = unsigned int]? /usr/local/include/odb/database.ixx:249:35: required from ?typename odb::object_traits::pointer_type odb::database::load(const typename odb::object_traits::id_type&) [with T = Process; typename odb::object_traits::pointer_type = std::shared_ptr; typename odb::object_traits::id_type = unsigned int]? /usr/local/include/odb/lazy-ptr-impl.txx:31:54: required from ?static typename odb::object_traits::pointer_type odb::lazy_ptr_base::loader(odb::lazy_ptr_base::database_type&, const typename odb::object_traits::id_type&) [with T = Process; DB = odb::database; typename odb::object_traits::pointer_type = std::shared_ptr; odb::lazy_ptr_base::database_type = odb::database; typename odb::object_traits::id_type = unsigned int]? /usr/local/include/odb/lazy-ptr-impl.ixx:361:36: required from ?void odb::lazy_ptr_impl::reset_db(DB&) [with DB = odb::database; T = Process]? /usr/local/include/odb/lazy-ptr.ixx:1232:7: required from ?odb::lazy_shared_ptr::lazy_shared_ptr(DB&, const std::shared_ptr&) [with DB = odb::database; Y = Process; T = Process]? /usr/local/include/odb/lazy-ptr.txx:127:43: required from ?odb::lazy_shared_ptr odb::lazy_weak_ptr::lock() const [with T = Process]? /usr/local/include/odb/lazy-pointer-traits.hxx:132:22: required from ?static odb::pointer_traits > ::strong_pointer_type odb::pointer_traits > ::lock(const pointer_type&) [with T = Process; odb::pointer_traits >::strong_pointer_type = odb::lazy_shared_ptr; odb::pointer_traits >::pointer_type = odb::lazy_weak_ptr]? example-odb-sqlite.cxx:1305:57: required from here /usr/local/include/odb/database.ixx:753:54: error: ?find? is not a member of ?odb::object_traits_impl? return object_traits_impl::find (*this, id); ^ DB model file (example which fails) #include #include using odb::lazy_shared_ptr; using odb::lazy_weak_ptr; using std::string; using std::vector; class Process; class Heap; #pragma db object class Process { public: Process() { } #pragma db id auto unsigned int id; #pragma db type("VARCHAR(255)") string name; }; #pragma db object class Heap { public: Heap() { } #pragma db id auto index unsigned int id; #pragma db null index odb::lazy_weak_ptr process; // <-- does result in compile error // odb::lazy_shared_ptr process; <-- this works }; Thanks for you help Beni From boris at codesynthesis.com Fri Aug 14 05:32:09 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 14 05:32:17 2015 Subject: [odb-users] Compile error with static multi DB and lazy_weak_ptr In-Reply-To: <55CC410B.8090903@bfh.ch> References: <55CC410B.8090903@bfh.ch> Message-ID: Hi Beni, Beni Urech writes: > The problem seems to be the the relations with odb::lazy_weak_ptr we > use. When we replace them with lazy_shared_ptr, the generated files > compile. Yes, this is a bug. The current implementation of lock() looses the actual database type. This is not a problem unless static multi- database support is used. I've fixed it and you should be able to apply the patch to libodb-2.4.0: http://scm.codesynthesis.com/?p=odb/libodb.git;a=commit;h=8ceee297981402eb5331f357b27ebfac11706ec4 Thanks for the report and the test case! Let me know if there are any other issues. Boris From alexandre.pretyman at gmail.com Fri Aug 14 08:14:20 2015 From: alexandre.pretyman at gmail.com (Alexandre Pretyman) Date: Fri Aug 14 08:14:57 2015 Subject: [odb-users] odb compiler crashes when using --options-file in Mac Os X 10.9.5 Message-ID: Hi Boris, I am using odb compiler with the --options-file flag to add additional flags to the compilation in MacOS 10.9.5, however it crashes with "Abort trap: 6". If I take these flags and put them in the command line itself, it works normally. Is there anything I can do to aid the investigation of this behavior? The options flag file is attached and the command line with the options file flag is: /Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/bin/odb -d sqlite --generate-query --generate-session --generate-schema --profile qt --hxx-suffix .hxx --ixx-suffix .ixx --cxx-suffix .cxx --odb-file-suffix -odb -I/Users/discipline/Documents/Projects/StudyBuddy -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include --options-file /Users/discipline/Documents/Projects/StudyBuddy-build/target-StudyBuddy-odb-compiler-options --output-dir /Users/discipline/Documents/Projects/StudyBuddy/generated-odb/cpp/model --include-prefix cpp/model cpp/model/recording.h Abort trap: 6 Taking the contents out of the options file and putting them as command line options, the odb compiler runs successfully: /Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/bin/odb -d sqlite --generate-query --generate-session --generate-schema --profile qt --hxx-suffix .hxx --ixx-suffix .ixx --cxx-suffix .cxx --odb-file-suffix -odb -I/Users/discipline/Documents/Projects/StudyBuddy -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include -I/Users/discipline/Documents/Projects/StudyBuddy/generated-odb -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtMultimediaWidgets -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtMultimedia -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtNetwork -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtCore -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install//mkspecs/macx-clang -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtGui -I/System/Library/Frameworks/OpenGL.framework/Headers -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtWidgets -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtPrintSupport -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtQml -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/ -I/Users/discipline/.hunter/_Base/xxxxxxx/73931d7/1cfaa79/Install/include/QtQuick -DSTATIC_BUILD -DQT_MULTIMEDIAWIDGETS_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_WIDGETS_LIB -DQT_PRINTSUPPORT_LIB -DQT_QML_LIB -DQT_QUICK_LIB --output-dir /Users/discipline/Documents/Projects/StudyBuddy/generated-odb/cpp/model --include-prefix cpp/model cpp/model/recording.h Thanks, -- Alexandre Pretyman -------------- next part -------------- A non-text attachment was scrubbed... Name: target-StudyBuddy-odb-compiler-options Type: application/octet-stream Size: 2122 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150814/4ad1b66e/target-StudyBuddy-odb-compiler-options.obj From boris at codesynthesis.com Fri Aug 14 11:45:20 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 14 11:45:27 2015 Subject: [odb-users] odb compiler crashes when using --options-file in Mac Os X 10.9.5 In-Reply-To: References: Message-ID: Hi Alexandre, Alexandre Pretyman writes: > I am using odb compiler with the --options-file flag to add additional > flags to the compilation in MacOS 10.9.5, however it crashes with "Abort > trap: 6". If I take these flags and put them in the command line itself, it > works normally. I tried your command line/options file and I get this error: unknown option '-I/Users/discipline/Documents/Projects/StudyBuddy/generated-odb' Looking inside your options file I see that you are using the -I/foo format rather than -I /foo. Currently, inside option files, ODB can only handle -I /foo (and -D foo). After changing this, I was able to run your command line on a test file without any errors. Of courser the question that goes unanswered is why you get SIGABRT instead of the error message like I do. My only idea is that the exception handling is not working in ODB on your Mac OS version for some reason (wouldn't be surprised at all; these days Mac OS is worse than Windows). Any chance you could run that command line under the debugger and get a stack trace? Boris From alexandre.pretyman at gmail.com Fri Aug 14 13:18:43 2015 From: alexandre.pretyman at gmail.com (Alexandre Pretyman) Date: Fri Aug 14 13:19:20 2015 Subject: [odb-users] odb compiler crashes when using --options-file in Mac Os X 10.9.5 In-Reply-To: References: Message-ID: Hi Boris, As suggested, I ran the compiler under lldb and printed the backtrace after the SIGABORT, and you seem to be right as to it is a problem in the exception handling: Process 794 stopped * thread #1: tid = 0x37ca, 0x00007fff8bb99866 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT frame #0: 0x00007fff8bb99866 libsystem_kernel.dylib`__pthread_kill + 10 libsystem_kernel.dylib`__pthread_kill + 10: -> 0x7fff8bb99866: jae 0x7fff8bb99870 ; __pthread_kill + 20 0x7fff8bb99868: movq %rax, %rdi 0x7fff8bb9986b: jmp 0x7fff8bb96175 ; cerror_nocancel 0x7fff8bb99870: retq (lldb) bt * thread #1: tid = 0x37ca, 0x00007fff8bb99866 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT * frame #0: 0x00007fff8bb99866 libsystem_kernel.dylib`__pthread_kill + 10 frame #1: 0x00007fff8f4cb35c libsystem_pthread.dylib`pthread_kill + 92 frame #2: 0x00007fff92e69b1a libsystem_c.dylib`abort + 125 frame #3: 0x00000001000178d6 odb`uw_init_context_1 + 134 frame #4: 0x0000000100017e0e odb`_Unwind_RaiseException + 62 frame #5: 0x0000000100010d2b odb`__cxa_throw + 91 frame #6: 0x00000001000261b1 odb`options::_parse(cli::scanner&, cli::unknown_mode, cli::unknown_mode) + 481 frame #7: 0x0000000100038a91 odb`options::options(cli::scanner&, cli::unknown_mode, cli::unknown_mode) + 4401 frame #8: 0x00000001000b16b0 odb`main + 7408 frame #9: 0x00000001000196e4 odb`start + 52 However I don't know how to interpret these messages, would you be kind enough to drop a few words on why this would happen? Putting the spaces in between the options and option value seemed to have solved the problem compiling odb, thanks for the tip. It was not clear from the odb manual that they had to be separated, or maybe I'm just stupid.... Thank you! On 14 August 2015 at 12:45, Boris Kolpackov wrote: > Hi Alexandre, > > Alexandre Pretyman writes: > > > I am using odb compiler with the --options-file flag to add additional > > flags to the compilation in MacOS 10.9.5, however it crashes with "Abort > > trap: 6". If I take these flags and put them in the command line itself, > it > > works normally. > > I tried your command line/options file and I get this error: > > unknown option > '-I/Users/discipline/Documents/Projects/StudyBuddy/generated-odb' > > Looking inside your options file I see that you are using the -I/foo > format rather than -I /foo. Currently, inside option files, ODB can > only handle -I /foo (and -D foo). After changing this, I was able > to run your command line on a test file without any errors. > > Of courser the question that goes unanswered is why you get SIGABRT > instead of the error message like I do. My only idea is that the > exception handling is not working in ODB on your Mac OS version for > some reason (wouldn't be surprised at all; these days Mac OS is worse > than Windows). Any chance you could run that command line under the > debugger and get a stack trace? > > Boris > -- Alexandre Pretyman From alexandre.pretyman at gmail.com Fri Aug 14 14:04:01 2015 From: alexandre.pretyman at gmail.com (Alexandre Pretyman) Date: Fri Aug 14 14:04:37 2015 Subject: [odb-users] odb compiler crashes when using --options-file in Mac Os X 10.9.5 In-Reply-To: References: Message-ID: Just a note: I put the spaces inside the options file, the odb compiler does not crash, however it doesn't pick up the include directories either. On 14 August 2015 at 14:18, Alexandre Pretyman wrote: > Hi Boris, > > As suggested, I ran the compiler under lldb and printed the backtrace > after the SIGABORT, and you seem to be right as to it is a problem in the > exception handling: > > Process 794 stopped > * thread #1: tid = 0x37ca, 0x00007fff8bb99866 > libsystem_kernel.dylib`__pthread_kill + 10, queue = > 'com.apple.main-thread', stop reason = signal SIGABRT > frame #0: 0x00007fff8bb99866 libsystem_kernel.dylib`__pthread_kill + 10 > libsystem_kernel.dylib`__pthread_kill + 10: > -> 0x7fff8bb99866: jae 0x7fff8bb99870 ; __pthread_kill + 20 > 0x7fff8bb99868: movq %rax, %rdi > 0x7fff8bb9986b: jmp 0x7fff8bb96175 ; cerror_nocancel > 0x7fff8bb99870: retq > (lldb) bt > * thread #1: tid = 0x37ca, 0x00007fff8bb99866 > libsystem_kernel.dylib`__pthread_kill + 10, queue = > 'com.apple.main-thread', stop reason = signal SIGABRT > * frame #0: 0x00007fff8bb99866 libsystem_kernel.dylib`__pthread_kill + 10 > frame #1: 0x00007fff8f4cb35c libsystem_pthread.dylib`pthread_kill + 92 > frame #2: 0x00007fff92e69b1a libsystem_c.dylib`abort + 125 > frame #3: 0x00000001000178d6 odb`uw_init_context_1 + 134 > frame #4: 0x0000000100017e0e odb`_Unwind_RaiseException + 62 > frame #5: 0x0000000100010d2b odb`__cxa_throw + 91 > frame #6: 0x00000001000261b1 odb`options::_parse(cli::scanner&, > cli::unknown_mode, cli::unknown_mode) + 481 > frame #7: 0x0000000100038a91 odb`options::options(cli::scanner&, > cli::unknown_mode, cli::unknown_mode) + 4401 > frame #8: 0x00000001000b16b0 odb`main + 7408 > frame #9: 0x00000001000196e4 odb`start + 52 > > > However I don't know how to interpret these messages, would you be kind > enough to drop a few words on why this would happen? > > Putting the spaces in between the options and option value seemed to have > solved the problem compiling odb, thanks for the tip. It was not clear from > the odb manual that they had to be separated, or maybe I'm just stupid.... > > Thank you! > > > > On 14 August 2015 at 12:45, Boris Kolpackov > wrote: > >> Hi Alexandre, >> >> Alexandre Pretyman writes: >> >> > I am using odb compiler with the --options-file flag to add additional >> > flags to the compilation in MacOS 10.9.5, however it crashes with "Abort >> > trap: 6". If I take these flags and put them in the command line >> itself, it >> > works normally. >> >> I tried your command line/options file and I get this error: >> >> unknown option >> '-I/Users/discipline/Documents/Projects/StudyBuddy/generated-odb' >> >> Looking inside your options file I see that you are using the -I/foo >> format rather than -I /foo. Currently, inside option files, ODB can >> only handle -I /foo (and -D foo). After changing this, I was able >> to run your command line on a test file without any errors. >> >> Of courser the question that goes unanswered is why you get SIGABRT >> instead of the error message like I do. My only idea is that the >> exception handling is not working in ODB on your Mac OS version for >> some reason (wouldn't be surprised at all; these days Mac OS is worse >> than Windows). Any chance you could run that command line under the >> debugger and get a stack trace? >> >> Boris >> > > > > -- > Alexandre Pretyman > -- Alexandre Pretyman From boris at codesynthesis.com Mon Aug 17 13:23:41 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 17 13:23:50 2015 Subject: [odb-users] odb compiler crashes when using --options-file in Mac Os X 10.9.5 In-Reply-To: References: Message-ID: Hi Alexandre, Alexandre Pretyman writes: > Just a note: I put the spaces inside the options file, the odb compiler > does not crash, however it doesn't pick up the include directories either. Yes, that's actually a known limitation. Currently the ODB compiler does not extract -I/-D options from the option files. The reason for this is a chicken and egg problem: ODB needs -I options in order to extract profile search paths (which are option files) before it can parse the command line. But in order to get the complete set of -I options, it first needs to parse the complete command line. There is one exception, however: the default.options file which is automatically loaded by the ODB compiler (located in etc/odb/ inside the ODB distribution for pre-built binaries). Perhaps that would be a better place to put all your -I/-D options? Boris From finjulhich at gmail.com Wed Aug 19 08:46:37 2015 From: finjulhich at gmail.com (MM) Date: Wed Aug 19 08:46:45 2015 Subject: [odb-users] sqlite string type std::array Message-ID: hi, typedef std::array month_year_str_t; struct month_and_year { ... operator month_year_str_t() const; void set(month_year_str_t); }; struct myobj { ... month_and_year my; }; I would like to map the month_and_year type to a TEXT column in sqlite, and use the provided conversion operator to do that. What's the simplest way? #pragma db value(month_year_str_t) type("TEXT") #pragma db object(myobj) definition #pragma db member(myobj::my) transient #pragma db member(myobj::monthyear) virtual(month_year_str_t) \ get( static_cast(this.my) ) \ set( set ((?))) Rds, MM From boris at codesynthesis.com Wed Aug 19 12:27:26 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Aug 19 12:27:34 2015 Subject: [odb-users] sqlite string type std::array In-Reply-To: References: Message-ID: Hi, MM writes: > typedef std::array month_year_str_t; > struct month_and_year > { ... > operator month_year_str_t() const; > void set(month_year_str_t); > }; > > struct myobj > { > ... > month_and_year my; > }; > > > I would like to map the month_and_year type to a TEXT column in sqlite, and > use the provided conversion operator to do that. > What's the simplest way? > > #pragma db value(month_year_str_t) type("TEXT") > > #pragma db object(myobj) definition > #pragma db member(myobj::my) transient > #pragma db member(myobj::monthyear) virtual(month_year_str_t) \ > get( static_cast(this.my) ) \ > set( set ((?))) This is the simplest. In 2.5.0 you will be able to do this mapping for the month_and_year type instead of having to do it for each data member. The other option would be to map month_and_year directly to TEXT by specializing odb::sqlite::value_traits. See "Custom C++ to Database Type Mapping" on how to do this: http://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/ Boris From finjulhich at gmail.com Wed Aug 19 15:26:31 2015 From: finjulhich at gmail.com (MM) Date: Wed Aug 19 15:26:38 2015 Subject: [odb-users] inheritance and derived class transient members Message-ID: Hi, let me put here the compilable code and ask the question below: template class cloneable : public base { protected: using base::base; virtual base* clone() const override { return new derived{static_cast(*this)}; } }; struct Base { std::string code; std::string desc; const std::string* F1_; const std::string* F2_; std::uint32_t id; virtual const std::string& type() const =0; virtual Base* clone() const =0; virtual ~Base() =0; }; void set_F1(Base&, const std::string&); void set_F2(Base&, const std::string&); struct Derived : public cloneable { std::string F3; static const std::string mtype; private: const std::string& type() const override; }; // 1 Base_odb.hpp : from which the odb compiler generates Base-odb.hxx, Base-odb.ixx, Base-odb.cxx #pragma db object(Base) abstract definition #pragma db member(Base::F1_) transient #pragma db member(Base::F1) virtual(std::string)\ get(this.set_F1? *this.set_F1_: "") set(set_F1 (this, (?))) #pragma db member(Base::F2_) transient #pragma db member(Base::F2) virtual(std::string)\ get(this.F2_? *this.F2_: "") set(set_F2 (this, (?))) //2 Derived_odb.hpp => odb: Derived-odb.hxx, Derived-odb.ixx, Derived-odb.cxx #include "Base_odb.hpp" #pragma db object(Derived) table("Tbld") definition #pragma db member(Derived::id_) virtual(std::uint32_t) access(Base::id) id auto Querying the db with db.query(); creates Derived objects where F3 is populated correctly, but the base struct members: code, desc, F1_, F2_ are not populated. But id is populated. I added: #pragma db member(Derived::code) access(Base::code) It compiled, but still failed to populate 'code' in the object. I would have thought the base class shoudl get populated too. I can see indeed the SQL query doesn't SELECT any of the base class columns in the Derived table. Thansk, MM From marcos.glez at gmail.com Wed Aug 19 18:35:07 2015 From: marcos.glez at gmail.com (Marcos Gonzalez Menendez) Date: Thu Aug 20 10:49:22 2015 Subject: [odb-users] Segmentation fault while executing odb compiler avoided adding a typedef sentence Message-ID: Hi, I was playing with an small example extracted from the odb user manual while I found that the odb compiler gives a segmentation fault error. I'm using odb compiler 2.4.0 for Windows (64 bits). My header file looks like this #include #include // Uncommenting the following line will make odb compiler work // typedef std::vector names; namespace odbtester { #pragma db object class person { public: person() { id_ = 0; } unsigned long id() const { return id_; } private: friend class odb::access; #pragma db id auto unsigned long id_; //#pragma db unordered std::vector nicknames_; }; } For invoking odb, I'm using this parameters: odb.exe ^ --std c++11 ^ --profile qt ^ --multi-database dynamic ^ -d common ^ -d sqlite ^ --generate-query ^ --generate-session ^ --generate-schema ^ --schema-format embedded ^ --sqlite-override-null The result that I get after execution: *** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_START_UNIT | odb PLUGIN_PRAGMAS | odb PLUGIN_OVERRIDE_GATE | odb In file included from :8:0: c:\tools\odb-2.4.0-i686-windows\mingw\include\odb\tr1\pointer-traits.hxx:116:1: internal compiler error: Segmentation fault } ^ libbacktrace could not find executable to open Please submit a full bug report, with preprocessed source if appropriate. See for instructions. However if we uncomment the typedef sentence above, everything works properly Best regards -- Marcos Gonz?lez Men?ndez From andrew at a-cunningham.com Thu Aug 20 00:02:15 2015 From: andrew at a-cunningham.com (Andrew Cunningham) Date: Thu Aug 20 10:49:22 2015 Subject: [odb-users] Debugging "FOREIGN KEY constraint failed" Message-ID: I am getting the "FOREIGN KEY constraint failed" exception on commit (SQLite). Clearly I have not 'persisted' a child object somewhere, but the exception gives no information. I have a large number of object types, so this is pretty tricky to find. What are the debugging tips for finding my error. From boris at codesynthesis.com Fri Aug 21 12:15:25 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 21 12:15:31 2015 Subject: [odb-users] Debugging "FOREIGN KEY constraint failed" In-Reply-To: References: Message-ID: Hi Andrew, Andrew Cunningham writes: > I am getting the "FOREIGN KEY constraint failed" exception on commit > (SQLite). Clearly I have not 'persisted' a child object somewhere, > but the exception gives no information. I have a large number of > object types, so this is pretty tricky to find. What are the > debugging tips for finding my error. Hm, this is what I would do, assuming that you are trying to persist all related object before the object itself. 1. Switch to the immediate foreign keys (--fkeys-deferrable-mode options). Now you will get an exception immediately after the persist() call that has violated relationships. 2. If #1 is not sufficient, then enable statement tracing. This will give you more precise view of what has been persisted so far. Boris From boris at codesynthesis.com Fri Aug 21 12:59:58 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Aug 21 13:00:04 2015 Subject: [odb-users] Segmentation fault while executing odb compiler avoided adding a typedef sentence In-Reply-To: References: Message-ID: Hi Marcos, Marcos Gonzalez Menendez writes: > I was playing with an small example extracted from the odb user manual > while I found that the odb compiler gives a segmentation fault error. Fixed for the next release: http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=15995637f9cab6a4d92a2383e2afdba2b48d5f7b Thanks for the report and the test case! Boris From markus at markusklemm.net Mon Aug 24 02:48:49 2015 From: markus at markusklemm.net (Markus Klemm) Date: Mon Aug 24 02:48:55 2015 Subject: [odb-users] Instantation of odb::result e.g. odb::query fails Message-ID: I'm writing my first odb code and can't get this basic working, although only the db connection code works: /*! @file overview_record.h */ #ifndef OVERVIEW_RECORD_H #define OVERVIEW_RECORD_H #include #include #include #pragma db object table("mddb_overview") no_id class overview_record { public: #pragma db column("product_name") type("nvarchar(64)") std::wstring product_name; #pragma db column("order_number") type("int") long order_number; }; #endif driver code: // odb_playground.cpp : Defines the entry point for the console application. // #include #include #include #include #include #include #include #include #include "overview_record-odb.hxx" int main(int argc, char* argv[]) { try{ std::auto_ptr connection_factory( new odb::mssql::connection_pool_factory(0, std::thread::hardware_concurrency())); std::unique_ptr db( new odb::mssql::database("dsn=mddb_local_32", odb::mssql::isolation_read_committed, static_cast(0), connection_factory) ); odb::transaction t(db->begin()); db->query(); //odb::result result(); //auto it = result.begin(); //while(true) //{ // static int i = 0; // if (i++ > 10) // break; // std::cout << "Order_number " << it->order_number << " product_name " << it->product_name << std::endl; // ++i; //} t.commit(); } catch (const odb::database_exception &e) { std::cout << "ODB database error: " << e.what() << std::endl; } return 0; } Of course I odb-compiled the overview_record.h with `odb.exe --database mssql overview_record.h` (otherwise there won't be an .hxx). But I get the following compiler errors by the line `db->query();`, although instantiating a default constructed result works: >Error 3 error C2504: 'odb::result_base' : base class undefined c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 76 1 odb_playground >Error 4 error C2027: use of undefined type 'odb::result_base' c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 82 1 odb_playground >Error 5 error C2146: syntax error : missing ';' before identifier 'value_type' c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 82 1 odb_playground >Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 82 1 odb_playground >Error 7 error C2602: 'odb::result::value_type' is not a member of a base class of 'odb::result' c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 82 1 odb_playground >Error 8 error C2868: 'odb::result::value_type' : illegal syntax for using-declaration; expected qualified-name c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 82 1 odb_playground >Error 9 error C2027: use of undefined type 'odb::result_base' c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 93 1 odb_playground >Error 10 error C2146: syntax error : missing ';' before identifier 'result_impl_type' c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 93 1 odb_playground >Error 11 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 93 1 odb_playground >Error 12 error C2602: 'odb::result::result_impl_type' is not a member of a base class of 'odb::result' c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 93 1 odb_playground >Error 13 error C2868: 'odb::result::result_impl_type' : illegal syntax for using-declaration; expected qualified-name c:\users\klm\downloads\libodb-2.4.0\odb\result.hxx 93 1 odb_playground Cheers, Markus Klemm From mne at qosmotec.com Mon Aug 24 08:32:37 2015 From: mne at qosmotec.com (Marcel Nehring) Date: Mon Aug 24 08:33:53 2015 Subject: [odb-users] Inconsistent column names? Message-ID: <979bbbbc9a964a7ea127da445fa7046d@QEX.qosmotec.com> Hi, as of the ODB manual I can specify custom column names for composite value types (see chapter 7.2.2). The examples provided in this chapter also show that if I provide a custom prefix and want it to be separated from the suffix I would have to provide the separator (e.g. if I want my column to be named "person_first_name" my prefix need to be "person_"). However, if the corresponding value type inherits members from a parent class ODB automatically appends an underscore to my prefix for that inherited member but not for the other members. Don't get me wrong, this does not cause any problems in the resulting code. Also I don't end up with a double underscore if I provide one in my custom prefix. However this behavior does look a bit odd so I thought I would report it in case it is not what ODB is supposed to do. As always example code is attached below. It will produce column names as "PREFIXINNER_VALUE" and "PREFIX_PARENT". Regards, Marcel #pragma db value class InnerValue { public: int m_value; }; #pragma db value class ParentOuter { public: int parent; }; #pragma db value class OuterValue : public ParentOuter { public: InnerValue m_inner; }; #pragma db object class Object { public: #pragma db id int m_id; #pragma db column("PREFIX") OuterValue m_outer; }; From boris at codesynthesis.com Mon Aug 24 09:45:27 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 24 09:45:29 2015 Subject: [odb-users] Instantation of odb::result e.g. odb::query fails In-Reply-To: References: Message-ID: Hi Markus, Markus Klemm writes: > Of course I odb-compiled the overview_record.h with `odb.exe --database > mssql overview_record.h` (otherwise there won't be an .hxx). But I get > the following compiler errors by the line `db->query();`, > although instantiating a default constructed result works: I am pretty sure you are getting this error because you haven't enabled query support when running the ODB compiler (-q option). Boris From markus at markusklemm.net Mon Aug 24 09:49:52 2015 From: markus at markusklemm.net (Markus Klemm) Date: Mon Aug 24 09:50:07 2015 Subject: [odb-users] Instantation of odb::result e.g. odb::query fails In-Reply-To: References: Message-ID: You're right, solved it afters day, minutes befors you replied. Is there a general rule, when to use the q and e flag? Mit freundlichen Gr??en Markus Klemm Gesendet via Mobiltelefon > Am 24.08.2015 um 15:45 schrieb Boris Kolpackov : > > Hi Markus, > > Markus Klemm writes: > >> Of course I odb-compiled the overview_record.h with `odb.exe --database >> mssql overview_record.h` (otherwise there won't be an .hxx). But I get >> the following compiler errors by the line `db->query();`, >> although instantiating a default constructed result works: > > I am pretty sure you are getting this error because you haven't > enabled query support when running the ODB compiler (-q option). > > Boris From boris at codesynthesis.com Mon Aug 24 09:54:22 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 24 09:54:24 2015 Subject: [odb-users] Instantation of odb::result e.g. odb::query fails In-Reply-To: References: Message-ID: Markus Klemm writes: > Is there a general rule, when to use the q and e flag? I think the man page is pretty clear: --generate-query|-q Generate query support code. Without this support you cannot use views and can only load objects via their ids. --generate-session|-e Generate session support code. With this option session support will be enabled by default for all the persistent classes except those for which it was explicitly disabled using the 'db session pragma'. In other words, you would need -q if you want to use ODB queries (Chapter 4) and -e if you want to use ODB session (Chapter 11). Boris From boris at codesynthesis.com Mon Aug 24 09:59:40 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 24 09:59:42 2015 Subject: [odb-users] inheritance and derived class transient members In-Reply-To: References: Message-ID: Hi, MM writes: > struct Derived : public cloneable { You derive via cloneable which is not a persistent class. As a result, all its bases (persistent or not) are also ignored. So you will need to add something like this to make your example work: using DerivedBase = cloneable; #pragma db object(DerivedBase) abstract definition Boris From markus at markusklemm.net Mon Aug 24 10:16:51 2015 From: markus at markusklemm.net (Markus Klemm) Date: Mon Aug 24 10:17:05 2015 Subject: [odb-users] Instantation of odb::result e.g. odb::query fails In-Reply-To: References: Message-ID: Thank you very much! Mit freundlichen Gr??en Markus Klemm Gesendet via Mobiltelefon > Am 24.08.2015 um 15:54 schrieb Boris Kolpackov : > > Markus Klemm writes: > >> Is there a general rule, when to use the q and e flag? > > I think the man page is pretty clear: > > --generate-query|-q > Generate query support code. Without this support you cannot use > views and can only load objects via their ids. > > --generate-session|-e > Generate session support code. With this option session support > will be enabled by default for all the persistent classes except > those for which it was explicitly disabled using the 'db session > pragma'. > > In other words, you would need -q if you want to use ODB queries > (Chapter 4) and -e if you want to use ODB session (Chapter 11). > > Boris From boris at codesynthesis.com Mon Aug 24 11:54:22 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 24 11:54:25 2015 Subject: [odb-users] Inconsistent column names? In-Reply-To: <979bbbbc9a964a7ea127da445fa7046d@QEX.qosmotec.com> References: <979bbbbc9a964a7ea127da445fa7046d@QEX.qosmotec.com> Message-ID: Hi Marcel, Marcel Nehring writes: > However this behavior does look a bit odd so I thought I would > report it in case it is not what ODB is supposed to do. Yes, this is definitely inconsistent. I've fixed it for the upcoming release. Thanks for the report and the test case! Boris From finjulhich at gmail.com Tue Aug 25 07:18:48 2015 From: finjulhich at gmail.com (MM) Date: Tue Aug 25 07:18:56 2015 Subject: [odb-users] inheritance and derived class transient members In-Reply-To: References: Message-ID: On 24 August 2015 at 14:59, Boris Kolpackov wrote: > Hi, > > MM writes: > > > struct Derived : public cloneable { > > You derive via cloneable which is not a persistent class. > As a result, all its bases (persistent or not) are also > ignored. So you will need to add something like this to > make your example work: > > using DerivedBase = cloneable; > #pragma db object(DerivedBase) abstract definition > > Boris > using or typedef both trigger the crash that you have fixed in this commit: http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=15995637f9cab6a4d92a2383e2afdba2b48d5f7b Can you think of a workaround to avoid the crash until I get the next release of odb? If not, I'll try to rebuild new packages for fedora Thanks Boris, From finjulhich at gmail.com Wed Aug 26 16:21:28 2015 From: finjulhich at gmail.com (MM) Date: Wed Aug 26 16:21:35 2015 Subject: [odb-users] inheritance and derived class transient members In-Reply-To: References: Message-ID: On 25 August 2015 at 12:18, MM wrote: > > > On 24 August 2015 at 14:59, Boris Kolpackov > wrote: > >> Hi, >> >> MM writes: >> >> > struct Derived : public cloneable { >> >> You derive via cloneable which is not a persistent class. >> As a result, all its bases (persistent or not) are also >> ignored. So you will need to add something like this to >> make your example work: >> >> using DerivedBase = cloneable; >> #pragma db object(DerivedBase) abstract definition >> >> Boris >> > > using or typedef both trigger the crash that you have fixed in this commit: > > > http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=15995637f9cab6a4d92a2383e2afdba2b48d5f7b > > Can you think of a workaround to avoid the crash until I get the next > release of odb? > If not, I'll try to rebuild new packages for fedora > > Thanks Boris, > Also, if the id member is defined in Base, and several Derived classes, each with a different table (repeating the columns from the base) that has a id column, would the different Deriveds have different id spaces, or the same one. ie, can Derived1 have id 5 for e.g., and Derived2 also have id 5, given that the id member is defined in the Base class? Thanks, From 2754830779 at qq.com Wed Aug 26 23:18:14 2015 From: 2754830779 at qq.com (=?gb18030?B?0dC3oi2zwr78?=) Date: Thu Aug 27 04:45:01 2015 Subject: [odb-users] =?gb18030?b?16q3oqO6Q2FuIG5vdCB1c2UgcHJlcGFyZSBTUUwg?= =?gb18030?q?statement_via_MySQL_Proxy_by_using_ODB_framework=A3=BF?= Message-ID: ------------------ ???? ------------------ ???: "2754830779";<2754830779@qq.com>; ????: 2015?8?25?(???) ??6:54 ???: "mailman"; ??: Can not use prepare SQL statement via MySQL Proxy by using ODB framework? Hi someone, Could someone help me out!!! I have some problems while using the ODB framework in our production environment. Bellowing is application's architecture. Bellowing were the errors when the application was running: 1?1243 (HY000): Unknown prepared statement handler (3) given to mysqld_stmt_reset. 2?1210 (HY000). We have tried doing some googling on this, then got the answers which means that "The MySQL Proxy does not support the prepare SQL statement". So do you guys have found this issue before, or there is an other way to use the SQL statement directly instead of using prepare SQL statement via ODB framework? Waiting for yours reply. Thanks & Regards. Ken Chen mail: 2754830779@qq.com -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/octet-stream Size: 28288 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150827/6e63db1a/attachment-0001.obj From markus at markusklemm.net Thu Aug 27 02:41:59 2015 From: markus at markusklemm.net (Markus Klemm) Date: Thu Aug 27 06:51:53 2015 Subject: [odb-users] ORDER BY clause in ODB query language Message-ID: Is there a way to get a query with an ORDER BY clause with the typed checked, static, non-native ODB query language? The examples in the manual is using the database system-native query language e.g. a concatenated string. That also makes it hard to use the ORDER BY clause because after the odb macro for the column, I need to concatenate the DESC/ASC clause but can?t due type mismatch. Regards/ Mit freundlichen Gr??en Markus Klemm From boris at codesynthesis.com Thu Aug 27 08:14:09 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Aug 27 08:14:16 2015 Subject: [odb-users] ORDER BY clause in ODB query language In-Reply-To: References: Message-ID: Hi Markus, Markus Klemm writes: > Is there a way to get a query with an ORDER BY clause with the typed > checked, static, non-native ODB query language? The examples in the > manual is using the database system-native query language e.g. a > concatenated string. Currently you have to spell "ORDER BY" as a string, though the column can be specified as a C++ name: db->query ((query::first == "John") + "ORDER BY" + query::age); We do plan to provide some syntactic sugar for this, though I am not sure how much static type checking we will be able to do. For example, should we assume if the C++ type provides operator<, then we can do ORDER BY? > That also makes it hard to use the ORDER BY clause because after > the odb macro for the column, I need to concatenate the DESC/ASC > clause but can?t due type mismatch. This should work: db->query ((...) + "ORDER BY" + query::age + "ASC"); BTW, "the odb macro for the column" is not a macro, it is a proper C++ variable name. Boris From boris at codesynthesis.com Thu Aug 27 08:19:04 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Aug 27 08:19:13 2015 Subject: [odb-users] =?utf-8?B?6L2s5Y+R77yaQ2Fu?= =?utf-8?Q?_not_use_prepare_SQL_statement_via_MySQL_Proxy_by_using_ODB_fr?= =?utf-8?Q?amework=EF=BC=9F?= In-Reply-To: References: Message-ID: Hi Ken, ??-?? <2754830779@qq.com> writes: > We have tried doing some googling on this, then got the answers which > means that "The MySQL Proxy does not support the prepare SQL statement". > So do you guys have found this issue before, or there is an other way > to use the SQL statement directly instead of using prepare SQL statement > via ODB framework? ODB relies heavily on prepared statements. There is no way to use it without this feature. So I am afraid you will either have to find a proxy that supports prepared statements (a pretty serious limitation, IMO), not use a proxy altogether, or use something other than ODB. Boris From boris at codesynthesis.com Thu Aug 27 08:21:19 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Aug 27 08:21:27 2015 Subject: [odb-users] inheritance and derived class transient members In-Reply-To: References: Message-ID: Hi, MM writes: > if the id member is defined in Base, and several Derived classes, each with > a different table (repeating the columns from the base) that has a id > column, would the different Deriveds have different id spaces, or the same > one. Well, if they have different tables, then of course they have different id (primary key) spaces. Time to re-read Chapter 8, "Inheritance"? Boris From 2754830779 at qq.com Fri Aug 28 03:20:06 2015 From: 2754830779 at qq.com (=?gb18030?B?0dC3oi2zwr78?=) Date: Fri Aug 28 10:44:50 2015 Subject: =?gb18030?B?u9i4tKO6IFtvZGItdXNlcnNdINeqt6KjukNhbiBu?= =?gb18030?B?b3QgdXNlIHByZXBhcmUgU1FMIHN0YXRlbWVudCB2?= =?gb18030?B?aWEgTXlTUUwgUHJveHkgYnkgdXNpbmcgT0RCIGZy?= =?gb18030?B?YW1ld29ya6O/?= Message-ID: Hi Boris, Thank you for your kindly reply. We have found another way to fix this issue temporary. We have moved the function of "mysql_stmt_prepare" from the function statement::init to statement::execute, then comment out "mysql_stmt_reset" in the execute() function. So we don't know, are there any potential issues of these changes? We have done some unit testings of this, and it works well. I have attached the file which modified by me. Please correct me, if possible. PS:we have added some log4cpp functions to trace the execute sql script, please ignore them. Thanks, Ken ------------------ ???? ------------------ ???: "Boris Kolpackov";; ????: 2015?8?27?(???) ??8:19 ???: "??-??"<2754830779@qq.com>; ??: "odb-users"; ??: Re: [odb-users] ???Can not use prepare SQL statement via MySQL Proxy by using ODB framework? Hi Ken, ??-?? <2754830779@qq.com> writes: > We have tried doing some googling on this, then got the answers which > means that "The MySQL Proxy does not support the prepare SQL statement". > So do you guys have found this issue before, or there is an other way > to use the SQL statement directly instead of using prepare SQL statement > via ODB framework? ODB relies heavily on prepared statements. There is no way to use it without this feature. So I am afraid you will either have to find a proxy that supports prepared statements (a pretty serious limitation, IMO), not use a proxy altogether, or use something other than ODB. Boris -------------- next part -------------- A non-text attachment was scrubbed... Name: statement.cxx Type: application/octet-stream Size: 23196 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20150828/75ac11b3/statement.obj From sean.clarke at sec-consulting.co.uk Fri Aug 28 18:29:14 2015 From: sean.clarke at sec-consulting.co.uk (Sean Clarke) Date: Fri Aug 28 18:29:21 2015 Subject: [odb-users] Ubuntu 15.10 beta1 - gcc/g++ 5 Message-ID: Hi, just looking at upgrading/developing with the latest Ubuntu and I seem to get errors relating to odb plugin not being available in the /usr/lib/gcc/x86_64-linux-gnu/5/plugin directory. The compiler versions (at the moment) are listed as: gcc-5/g++-5 5.2.1-15ubuntu Not major as we just wanted a quick "look=see" the latest version, but thought you might want to know - guessing it will be a Ubuntu packaging issue and not related to odb directly (I see you list as it being compatible with gcc 5 anyway). Just a heads up.... Regards Sean Clarke From mne at qosmotec.com Mon Aug 31 05:16:38 2015 From: mne at qosmotec.com (Marcel Nehring) Date: Mon Aug 31 05:17:19 2015 Subject: [odb-users] ODB crashes if callback function cannot be found Message-ID: <5a5f2feba9504d689ffe42f2aa979fec@QEX.qosmotec.com> Hello Boris, I discovered a crash in the ODB compiler. If one specifies a callback function for an ODB object but forgets to declare this callback ODB crashes. It issues an error message about the missing callback, though. Example code and the corresponding output is attached below. Regards, Marcel #include #pragma db object callback(foobar) class Object { public: #pragma db id int id_; }; error: unable to resolve member function 'foobar' specified with '#pragma db callback' for class 'Object' *** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_START_UNIT | odb PLUGIN_PRAGMAS | odb PLUGIN_OVERRIDE_GATE | odb In file included from c:\######\odb\mingw\include\odb\container-traits.hxx:217:0, from :9: c:\######\odb\mingw\include\odb\std-unordered-set-traits.hxx:122:1: internal compiler error: Segmentation fault } ^ libbacktrace could not find executable to open Please submit a full bug report, with preprocessed source if appropriate. See for instructions. From andrew at a-cunningham.com Sat Aug 29 17:37:22 2015 From: andrew at a-cunningham.com (Andrew Cunningham) Date: Mon Aug 31 08:17:23 2015 Subject: [odb-users] Debugging FOREIGN KEY Message-ID: Hi Boris, Hm, this is what I would do, assuming that you are trying to persist > all related object before the object itself. > 1. Switch to the immediate foreign keys (--fkeys-deferrable-mode options). > Now you will get an exception immediately after the persist() call that > has violated relationships. This works great except there is a an annoying little issue. If you try to persist an object, when a related object is not persistent you get a " object_already_persistent" exception. I think the exception should be a "object_not_persistent" exception if possible.... Andrew From boris at codesynthesis.com Mon Aug 31 08:19:52 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 31 08:19:58 2015 Subject: [odb-users] Debugging FOREIGN KEY In-Reply-To: References: Message-ID: Hi Andrew, Andrew Cunningham writes: > This works great except there is a an annoying little issue. If you try to > persist an object, when a related object is not persistent you get a > " object_already_persistent" exception. I think the exception should be a > "object_not_persistent" exception if possible.... This is an SQLite limitation. See Section, 18.5.4 "Constraint Violations" for details. Boris From boris at codesynthesis.com Mon Aug 31 08:27:55 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 31 08:27:59 2015 Subject: [odb-users] ODB crashes if callback function cannot be found In-Reply-To: <5a5f2feba9504d689ffe42f2aa979fec@QEX.qosmotec.com> References: <5a5f2feba9504d689ffe42f2aa979fec@QEX.qosmotec.com> Message-ID: Hi Marcel, Marcel Nehring writes: > I discovered a crash in the ODB compiler. If one specifies a callback > function for an ODB object but forgets to declare this callback ODB > crashes. Fixed. As always, thanks for the report and the test case, much appreciated! Boris From boris at codesynthesis.com Mon Aug 31 08:38:29 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 31 08:38:34 2015 Subject: [odb-users] Ubuntu 15.10 beta1 - gcc/g++ 5 In-Reply-To: References: Message-ID: Hi Sean, Sean Clarke writes: > just looking at upgrading/developing with the latest Ubuntu and I seem > to get errors relating to odb plugin not being available in > the /usr/lib/gcc/x86_64-linux-gnu/5/plugin directory. > > The compiler versions (at the moment) are listed as: > > gcc-5/g++-5 5.2.1-15ubuntu > > Not major as we just wanted a quick "look=see" the latest version, but > thought you might want to know - guessing it will be a Ubuntu packaging > issue and not related to odb directly (I see you list as it being > compatible with gcc 5 anyway). Here is the situation: currently, in Debian (and thus Ubuntu) the ODB compiler is built for the default GCC compiler (i.e., what get's run when you type 'g++'). So I guess there is a mismatch between the default GCC compiler and what ODB was built with (or you overrode the GCC binary that the ODB compiler should use with the -x option). Having said that, ODB has full support for being able to load the correct plugin for the version of GCC being used. All one has to do is build and package plugins for the available GCC variants. Once this is done, you should be able to do: odb -x g++-4.9 ... odb -x g++-5 ... Boris From markus at markusklemm.net Mon Aug 31 09:05:27 2015 From: markus at markusklemm.net (Markus Klemm) Date: Mon Aug 31 09:05:38 2015 Subject: [odb-users] bi-directional weak_ptr session destructor access violation Message-ID: <0100F9F1-0709-42C2-88E4-A091EA881CA5@markusklemm.net> Well thank you for the nice and competent support here. But I already have the next problem: Is it possible that ODB assumes that, in a bidirectional 1:n relationship, the weak_ptr is the datamember with the inverse pragma? Because when I don't do so, the destructor of odb::session throws an access violation error (actualy delete does). I guess double deletion. But when I declare the datamember with the weak_ptr with the inverse pragma like in the examples, everthing is ok. For the source code and debug information see https://gist.github.com/Superlokkus/58bd750e5bd9a9f63bfa Thank you for you in advance and best regards Markus Klemm Mit freundlichen Gr??en Markus Klemm Gesendet via Mobiltelefon From gcs at debian.org Mon Aug 31 09:06:57 2015 From: gcs at debian.org (=?UTF-8?B?TMOhc3psw7MgQsO2c3rDtnJtw6lueWkgKEdDUyk=?=) Date: Mon Aug 31 09:21:46 2015 Subject: [odb-users] Ubuntu 15.10 beta1 - gcc/g++ 5 In-Reply-To: References: Message-ID: Hi, On Mon, Aug 31, 2015 at 2:38 PM, Boris Kolpackov wrote: > Sean Clarke writes: >> just looking at upgrading/developing with the latest Ubuntu and I seem >> to get errors relating to odb plugin not being available in >> the /usr/lib/gcc/x86_64-linux-gnu/5/plugin directory. >> >> The compiler versions (at the moment) are listed as: >> >> gcc-5/g++-5 5.2.1-15ubuntu Yes, this is known. Previously Debian / Ubuntu used GCC 4.9 as default. Now there's a big transition (several major ones to be exact) while we transition to GCC 5 [1] as default. As ODB was built with GCC 4.9 , it's expected that GCC 5 and stuff will not find it. Needs a recompilation - I don't know if it needs to be a binNMU or we can expect a new upstream release soon. > Here is the situation: currently, in Debian (and thus Ubuntu) the ODB > compiler is built for the default GCC compiler (i.e., what get's run > when you type 'g++'). So I guess there is a mismatch between the > default GCC compiler and what ODB was built with (or you overrode > the GCC binary that the ODB compiler should use with the -x option). Yes, it's a version mismatch, see above. The other problem can be the std::system_error() incompatibility[2]. But I could not yet test it. :( Boris, are you aware of this? Cheers, Laszlo/GCS [1] https://wiki.debian.org/GCC5#Update_to_GCC_5 [2] https://wiki.debian.org/GCC5#libstdc.2B-.2B-_c.2B-.2B-11_incompatibilities_.284.9_and_5.29 From boris at codesynthesis.com Mon Aug 31 09:27:26 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 31 09:27:31 2015 Subject: [odb-users] Ubuntu 15.10 beta1 - gcc/g++ 5 In-Reply-To: References: Message-ID: Hi L?szl?, L?szl? B?sz?rm?nyi (GCS) writes: > Needs a recompilation - I don't know if it needs to be a binNMU or > we can expect a new upstream release soon. Not for another several months, at least. > Yes, it's a version mismatch, see above. The other problem can be the > std::system_error() incompatibility[2]. But I could not yet test it. > :( Boris, are you aware of this? Yes, I am aware of this mess. While my understanding of the problem is quite fuzzy, I don't think we can do anything about this. It needs to be fixed at the toolchain level. Boris From boris at codesynthesis.com Mon Aug 31 09:33:45 2015 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Aug 31 09:33:51 2015 Subject: [odb-users] bi-directional weak_ptr session destructor access violation In-Reply-To: <0100F9F1-0709-42C2-88E4-A091EA881CA5@markusklemm.net> References: <0100F9F1-0709-42C2-88E4-A091EA881CA5@markusklemm.net> Message-ID: Hi Markus, Markus Klemm writes: > Is it possible that ODB assumes that, in a bidirectional 1:n > relationship, the weak_ptr is the datamember with the inverse > pragma? No, ODB doesn't make any such assumptions. As a first step, make sure that all the objects that are involved in your relationship use shared_ptr as their object pointer. You class file doesn't appear to be. Boris From markus at markusklemm.net Mon Aug 31 09:42:57 2015 From: markus at markusklemm.net (Markus Klemm) Date: Mon Aug 31 09:43:08 2015 Subject: [odb-users] bi-directional weak_ptr session destructor access violation In-Reply-To: References: <0100F9F1-0709-42C2-88E4-A091EA881CA5@markusklemm.net> Message-ID: <6F1E52F4-4214-43F0-89F4-4126E055003B@markusklemm.net> Yes, after addig the pointer pragma to the file class it worked. Thank you very much again! Mit freundlichen Gr??en/ Best regards Markus Klemm > Am 31.08.2015 um 15:33 schrieb Boris Kolpackov : > > Hi Markus, > > Markus Klemm writes: > >> Is it possible that ODB assumes that, in a bidirectional 1:n >> relationship, the weak_ptr is the datamember with the inverse >> pragma? > > No, ODB doesn't make any such assumptions. > > As a first step, make sure that all the objects that are involved > in your relationship use shared_ptr as their object pointer. You > class file doesn't appear to be. > > Boris From finjulhich at gmail.com Mon Aug 31 11:05:10 2015 From: finjulhich at gmail.com (MM) Date: Mon Aug 31 11:05:17 2015 Subject: [odb-users] Segmentation fault while executing odb compiler avoided adding a typedef sentence Message-ID: On 21 August 2015 at 17:59, Boris Kolpackov wrote: > Hi Marcos, > > Marcos Gonzalez Menendez writes: > > > I was playing with an small example extracted from the odb user manual > > while I found that the odb compiler gives a segmentation fault error. > > Fixed for the next release: > > > http://scm.codesynthesis.com/?p=odb/odb.git;a=commit;h=15995637f9cab6a4d92a2383e2afdba2b48d5f7b > > Thanks for the report and the test case! > > Boris > > Hi Boris, I have downloaded 2.5.0.a1 from your tmp directory, applied the 2 commits " Export container and section traits" and "Make sure we don't match namespace ::foo as prefix" after that. I bootsraped, configured, make, make installed for all of libcutl, odb, libodb, -boost and -sqlite (in /usr/local/....) /usr/loca/bin/odb --version is indeed 2.5.0.a1 This statement in c++11: using derived_frombase = cloneable; // crashes #pragma db object(derived_frombase) abstract definition #pragma db object(derived) table("derivedobjects") definition // derived derives from base through cloneable crashes the compiler with the backtrace below. I made sure /usr/local/include is set as -I flag for the odb compiler. (Note I still have odb 2.4.0 from the rpm package installed, and i have 2.5 in /usr/local) As I have the odb sources now, i am able to quickly test out any fix you may think of. Thanks terminate called after throwing an instance of 'cutl::compiler::context::no_entry' what(): N4cutl8compiler7context8no_entryE *** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins. Event | Plugins PLUGIN_START_UNIT | odb PLUGIN_PRAGMAS | odb PLUGIN_OVERRIDE_GATE | odb /home/MM/stuff_odb/derived.hpp: In function ?void __static_initialization_and_destruction_0(int, int)?: /home/MM/stuff_odb/derived.hpp:18:48: internal compiler error: Aborted using derived_frombase = cloneable; ^ 0x7feda5268bc8 user_sections& cutl::compiler::context::get(std::basic_string, std::allocator > const&) /usr/include/cutl/compiler/context.txx:16 0x7feda52c69b5 user_sections& cutl::compiler::context::get(char const*) /usr/include/cutl/compiler/context.hxx:60 0x7feda52b9fd8 traverse_object_pre /home/MM/Downloads/odb-2.5.0.a1/odb/processor.cxx:2133 0x7feda52bf1eb traverse /home/MM/Downloads/odb-2.5.0.a1/odb/processor.cxx:2091 0x7feda526e3f5 cutl::compiler::dispatcher::dispatch(semantics::node&) /usr/include/cutl/compiler/traversal.txx:90 0x7feda526ee95 cutl::compiler::dispatcher::dispatch(semantics::edge&) /usr/include/cutl/compiler/traversal.txx:90 0x7feda52938dd void cutl::compiler::dispatcher::iterate_and_dispatch >, semantics::edge>(cutl::container::pointer_iterator >, cutl::container::pointer_iterator >, cutl::compiler::dispatcher&) /usr/include/cutl/compiler/traversal.hxx:125 0x7feda52938dd traversal::scope_template::names(semantics::namespace_&, cutl::compiler::dispatcher&) ../odb/traversal/elements.hxx:196 0x7feda52938dd traversal::scope_template::names(semantics::namespace_&) ../odb/traversal/elements.hxx:190 0x7feda52938dd traversal::scope_template::traverse(semantics::namespace_&) ../odb/traversal/elements.hxx:184 0x7feda52938dd cutl::compiler::traverser_impl::trampoline(semantics::node&) /usr/include/cutl/compiler/traversal.txx:24 0x7feda526e3f5 cutl::compiler::dispatcher::dispatch(semantics::node&) /usr/include/cutl/compiler/traversal.txx:90 0x7feda526ee95 cutl::compiler::dispatcher::dispatch(semantics::edge&) /usr/include/cutl/compiler/traversal.txx:90 0x7feda52938dd void cutl::compiler::dispatcher::iterate_and_dispatch >, semantics::edge>(cutl::container::pointer_iterator >, cutl::container::pointer_iterator >, cutl::compiler::dispatcher&) /usr/include/cutl/compiler/traversal.hxx:125 0x7feda52938dd traversal::scope_template::names(semantics::namespace_&, cutl::compiler::dispatcher&) ../odb/traversal/elements.hxx:196 0x7feda52938dd traversal::scope_template::names(semantics::namespace_&) ../odb/traversal/elements.hxx:190 0x7feda52938dd traversal::scope_template::traverse(semantics::namespace_&) ../odb/traversal/elements.hxx:184 0x7feda52938dd cutl::compiler::traverser_impl::trampoline(semantics::node&) /usr/include/cutl/compiler/traversal.txx:24 0x7feda526e3f5 cutl::compiler::dispatcher::dispatch(semantics::node&) /usr/include/cutl/compiler/traversal.txx:90 0x7feda526ee95 cutl::compiler::dispatcher::dispatch(semantics::edge&) /usr/include/cutl/compiler/traversal.txx:90