From boris at codesynthesis.com Fri Jun 1 11:30:32 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 1 11:32:04 2018 Subject: [odb-users] Re: libodb-mysql: no rule to update odb\mysql\details\(c|i|h)xx{options} In-Reply-To: <1719168489.679757.1527779061526@mail.yahoo.com> References: <1719168489.679757.1527779061526.ref@mail.yahoo.com> <1719168489.679757.1527779061526@mail.yahoo.com> Message-ID: Feiyun Wang writes: > d:\prj\odb>b config.cxx=cl config.cc.coptions=/O2 "configure(libodb/@libodb-vs2017-release/)" > > [...] > > - libodb-mysql > Revision: dcd4b078c8da2ab68cb8fdadac52cae4499dd502 If you are building form git, then you need to make sure you have all the source code generators installed since the generated code is not (normally) checked in into the repository. In this case you need CLI (you can get the packaged version from cppget.org). Once you have it, either add it to your PATH or specify its location during configuration: b config.cli=C:\path\to\cli.exe ... configure ... Boris From feiyunw at yahoo.com Sat Jun 2 00:08:37 2018 From: feiyunw at yahoo.com (Feiyun Wang) Date: Sun Jun 3 05:51:42 2018 Subject: [odb-users] Re: libodb-mysql: no rule to update odb\mysql\details\(c|i|h)xx{options} In-Reply-To: References: <1719168489.679757.1527779061526.ref@mail.yahoo.com> <1719168489.679757.1527779061526@mail.yahoo.com> Message-ID: <1984225807.1307474.1527912517362@mail.yahoo.com> Hi Boris, Thanks for your advice and it works! Here is my build procedure: ```` set PATH=C:\build2\bin;%PATH% mkdir libcutl-vs2017 b config.cxx=cl config.install.root=C:\build2 config.cc.coptions=/O2 "configure(libcutl/@libcutl-vs2017/)" cd libcutl-vs2017/ b install cd .. mkdir cli-vs2017 b config.cxx=cl config.install.root=C:\build2 config.cc.coptions=/O2 config.import.libcutl=libcutl-vs2017/ "configure(cli/@cli-vs2017/)" cd cli-vs2017 b install cd .. mkdir libodb-mysql-vs2017 cd libodb-mysql git checkout -f master -- cd .. b config.cxx=cl config.cli=C:\build2\bin\cli.exe config.cc.coptions=/O2 config.import.libmysqlclient=libmysqlclient-vs2017/ config.import.libodb=libodb-vs2017/ "configure(libodb-mysql/@libodb-mysql-vs2017/)" b libodb-mysql-vs2017/ ```` BTW, after changing libodb-mysql manifest and odb\mysql\buildfile like: ```` -depends: libmysqlclient ^5.0.3 +depends: libmariadb ^10.2.2 ```` and ```` -client_lib = 'mysql' -#client_lib = 'mariadb' +#client_lib = 'mysql' +client_lib = 'mariadb' ```` I managed to build libodb-mysql with libmariadb instead of libmysqlclient: ```` mkdir libmariadb-vs2017 b config.cxx=cl config.cc.coptions="/O2 /wd4819" "configure(libmariadb/@libmariadb-vs2017/)" b libmariadb-vs2017/ mkdir libodb-mariadb-vs2017 b config.cxx=cl config.cli=C:\build2\bin\cli.exe config.cc.coptions=/O2 config.import.libmariadb=libmariadb-vs2017/ config.import.libodb=libodb-vs2017/ "configure(libodb-mysql/@libodb-mariadb-vs2017/)" b libodb-mariadb-vs2017/ ```` Thanks again! Sincerely, Feiyun Wang On ?Friday?, ?June? ?01?, ?2018? ?11?:?30?:?42? ?PM, Boris Kolpackov wrote: Feiyun Wang writes: > d:\prj\odb>b config.cxx=cl config.cc.coptions=/O2 "configure(libodb/@libodb-vs2017-release/)" > > [...] > > - libodb-mysql > Revision: dcd4b078c8da2ab68cb8fdadac52cae4499dd502 If you are building form git, then you need to make sure you have all the source code generators installed since the generated code is not (normally) checked in into the repository. In this case you need CLI (you can get the packaged version from cppget.org). Once you have it, either add it to your PATH or specify its location during configuration: b config.cli=C:\path\to\cli.exe ... configure ... Boris From feiyunw at yahoo.com Mon Jun 4 00:30:21 2018 From: feiyunw at yahoo.com (Feiyun Wang) Date: Mon Jun 4 04:43:29 2018 Subject: [odb-users] How to build odb.exe References: <751470788.1762601.1528086621631.ref@mail.yahoo.com> Message-ID: <751470788.1762601.1528086621631@mail.yahoo.com> Hi, When i mixed odb-2.4.0-i686-windows\bin\odb.exe with other ODB components built from the git source, I got a compiler error in file person-odb.hxx when building the odb-examples\hello: ```` #if (ODB_VERSION != 20400UL) #error ODB runtime version mismatch #endif ```` After commenting out the #error statement, I got a linking error finally: ```` 1>------ Build started: Project: hello, Configuration: Debug x64 ------ 1>driver.obj : error LNK2001: unresolved external symbol "struct odb::details::share odb::details::shared" (?shared@details@odb@@3Ushare@12@A) 1>person-odb.obj : error LNK2001: unresolved external symbol "struct odb::details::share odb::details::shared" (?shared@details@odb@@3Ushare@12@A) 1>G:\prj\odb\odb-examples\hello\x64\Debug\hello.exe : fatal error LNK1120: 1 unresolved externals 1>Done building project "hello.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ```` I guess that odb.exe version 2.4.0 may not work well with the latest ODB git source? But when I tried to build odb.exe from the git repo: ```` G:\prj\odb>mkdir odb-vs2017G:\prj\odb>b config.cxx=cl config.cli=C:\build2\bin\cli.exe config.cc.coptions=" /O2" config.import.libstudxml=libstudxml-vs2017/ config.import.libcutl=libcutl-v s2017/ "configure(odb/@odb-vs2017/)" save odb-vs2017\build\config.buildG:\prj\odb>cd odb-vs2017G:\prj\odb\odb-vs2017>b install mkdir fsdir{odb\} mkdir odb\fsdir{relational\} mkdir odb\relational\fsdir{mssql\} ?33 targets to update (for install) G:\prj\odb\odb-vs2017> ```` It turns out that odb.exe is not properly configured, and cannot be compiled and installed. Any hints? Sincerely, Feiyun Wang From feiyunw at yahoo.com Mon Jun 4 03:15:56 2018 From: feiyunw at yahoo.com (Feiyun Wang) Date: Mon Jun 4 04:43:29 2018 Subject: [odb-users] Re: How to build odb.exe In-Reply-To: <751470788.1762601.1528086621631@mail.yahoo.com> References: <751470788.1762601.1528086621631.ref@mail.yahoo.com> <751470788.1762601.1528086621631@mail.yahoo.com> Message-ID: <1568175677.1808921.1528096556582@mail.yahoo.com> Hi, I found that some preprocessor definitions are required when compiling and linking the example source with the ODB dynamic libraries: ```` DATABASE_MYSQL LIBODB_BUILD2 LIBODB_MYSQL_MARIADB LIBODB_SHARED ```` So odb.exe version 2.4.0 is compatible with the latest ODB git source. Sincerely, Feiyun Wang On ?Monday?, ?June? ?04?, ?2018? ?12?:?30?:?21? ?PM, Feiyun Wang wrote: Hi, When i mixed odb-2.4.0-i686-windows\bin\odb.exe with other ODB components built from the git source, I got a compiler error in file person-odb.hxx when building the odb-examples\hello: ```` #if (ODB_VERSION != 20400UL) #error ODB runtime version mismatch #endif ```` After commenting out the #error statement, I got a linking error finally: ```` 1>------ Build started: Project: hello, Configuration: Debug x64 ------ 1>driver.obj : error LNK2001: unresolved external symbol "struct odb::details::share odb::details::shared" (?shared@details@odb@@3Ushare@12@A) 1>person-odb.obj : error LNK2001: unresolved external symbol "struct odb::details::share odb::details::shared" (?shared@details@odb@@3Ushare@12@A) 1>G:\prj\odb\odb-examples\hello\x64\Debug\hello.exe : fatal error LNK1120: 1 unresolved externals 1>Done building project "hello.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ```` I guess that odb.exe version 2.4.0 may not work well with the latest ODB git source? But when I tried to build odb.exe from the git repo: ```` G:\prj\odb>mkdir odb-vs2017G:\prj\odb>b config.cxx=cl config.cli=C:\build2\bin\cli.exe config.cc.coptions=" /O2" config.import.libstudxml=libstudxml-vs2017/ config.import.libcutl=libcutl-v s2017/ "configure(odb/@odb-vs2017/)" save odb-vs2017\build\config.buildG:\prj\odb>cd odb-vs2017G:\prj\odb\odb-vs2017>b install mkdir fsdir{odb\} mkdir odb\fsdir{relational\} mkdir odb\relational\fsdir{mssql\} ?33 targets to update (for install) G:\prj\odb\odb-vs2017> ```` It turns out that odb.exe is not properly configured, and cannot be compiled and installed. Any hints? Sincerely, Feiyun Wang From boris at codesynthesis.com Tue Jun 5 07:37:42 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 5 07:39:21 2018 Subject: [odb-users] indirect relatioship between objects with std::vector> In-Reply-To: References: Message-ID: MM writes: > Is it possible to have the called-back function not be a member function? No, not at the moment. From boris at codesynthesis.com Tue Jun 5 07:45:50 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 5 07:47:28 2018 Subject: [odb-users] indirect relatioship between objects with std::vector> In-Reply-To: References: Message-ID: MM writes: > Can this pragma apply to value types too? No, as the manual clearly shows, the callback pragma is only available to objects. Supporting it also for value types would involve quite a bit of additional complexity (think persistent a vector of value types with a callback). Boris From matthew.buonomano at familylawsoftware.com Tue Jun 5 13:16:23 2018 From: matthew.buonomano at familylawsoftware.com (Matthew Buonomano) Date: Wed Jun 6 03:47:18 2018 Subject: [odb-users] visual studio static library Message-ID: I would like to be able to use the odb code as entirely statically compiled libraries. I am not able to get the Visual Studio 2013 project to compile using LIBODB_STATIC_LIB. If I define this preprocessor directive and remove the LIBODB_DYNAMIC_LIB, #defines in the header files revert to dynamic. All of the intermediate .obj files for the .cxx files in the project get compiled with __declspec(dllexport) on their methods so that I am later not able to link. Do you have a VS 2013 project that accomplishes creating just .lib output, no .dlls? I am looking at purchasing a license for your tool. It works great when building dlls, but I need to statically link into an .exe that I sell. Thanks Matt Buonomano Family Law Software www.familylawsoftware.com From boris at codesynthesis.com Wed Jun 6 07:18:20 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 6 07:20:03 2018 Subject: [odb-users] Suggestion: replace map with unordered_map in session In-Reply-To: References: Message-ID: Andrew Cunningham writes: > I am using a custom "session" object which is essentially a copy of the > default ODB session. I saw significant performance improvements replacing > std::map with std::unordered_map - I have millions of objects in the > session cache. > > My suggestion would be to replace map with unordered_map in the default > odb::session as well. I did some tests and can't find a scenario in which > std::unordered_map is slower as it automatically rehashes to avoid > excessive hash collisions. Yes, I think this is a good idea but we should probably wait until we drop support for C++98. I've added an item to the TODO list. Thanks for the suggestion and sorry for the delay in replying. From boris at codesynthesis.com Wed Jun 6 11:08:35 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 6 11:10:17 2018 Subject: [odb-users] visual studio static library In-Reply-To: References: Message-ID: Matthew Buonomano writes: > I would like to be able to use the odb code as entirely statically compiled > libraries. It is not recommended to link ODB libraries statically on Windows because they rely on DllMain() to perform some low-level initializations. While it is possible with some extra effort (i.e., you will have to call those initialization functions yourself), in most cases it is easier to just ship the .dll files next to your executable. If you still want to do this, see this earlier thread for some tips: https://www.codesynthesis.com/pipermail/odb-users/2016-June/003321.html From matthew.buonomano at familylawsoftware.com Wed Jun 6 13:04:11 2018 From: matthew.buonomano at familylawsoftware.com (Matthew Buonomano) Date: Thu Jun 7 04:42:58 2018 Subject: [odb-users] visual studio static library In-Reply-To: References: Message-ID: OK. Thank-you. On Wed, Jun 6, 2018 at 11:08 AM, Boris Kolpackov wrote: > Matthew Buonomano writes: > > > I would like to be able to use the odb code as entirely statically > compiled > > libraries. > > It is not recommended to link ODB libraries statically on Windows because > they rely on DllMain() to perform some low-level initializations. While it > is possible with some extra effort (i.e., you will have to call those > initialization functions yourself), in most cases it is easier to just > ship the .dll files next to your executable. > > If you still want to do this, see this earlier thread for some tips: > > https://www.codesynthesis.com/pipermail/odb-users/2016-June/003321.html > From tiagomacarios at gmail.com Mon Jun 11 03:02:51 2018 From: tiagomacarios at gmail.com (Tiago Macarios) Date: Mon Jun 11 03:05:08 2018 Subject: [odb-users] Suggestion: replace map with unordered_map in session In-Reply-To: References: Message-ID: Since most people seem not happy with the unordered_map performance there seems to be a lot of research going to that area. Here is a nice talk about it: https://www.youtube.com/watch?v=M2fKMP47slQ If performance matters to your use case, it might be interesting to use another (no-std) container. On Wed, Jun 6, 2018 at 4:18 AM Boris Kolpackov wrote: > Andrew Cunningham writes: > > > I am using a custom "session" object which is essentially a copy of the > > default ODB session. I saw significant performance improvements replacing > > std::map with std::unordered_map - I have millions of objects in the > > session cache. > > > > My suggestion would be to replace map with unordered_map in the default > > odb::session as well. I did some tests and can't find a scenario in which > > std::unordered_map is slower as it automatically rehashes to avoid > > excessive hash collisions. > > Yes, I think this is a good idea but we should probably wait until we > drop support for C++98. I've added an item to the TODO list. Thanks > for the suggestion and sorry for the delay in replying. > > From shprotello at mail.ru Wed Jun 13 11:49:50 2018 From: shprotello at mail.ru (=?UTF-8?B?0KHQtdGA0LPQtdC5INCd0LjQutC+0L3QvtCy?=) Date: Wed Jun 13 11:52:08 2018 Subject: [odb-users] PostgreSQL 42P01 error Message-ID: <1528904990.106975658@f308.i.mail.ru> Hello everybody, I encountered a curious problem with PostgreSQL error 42P01. My database schema is completely generated by ODB C++ schema code. When I try to execute a view query generated by ODB I get the following error: ""errorMessage": "42P01: ERROR:? relation \"config_item_attribute_shape\" does not exist\nLINE 1: ...on\", \"s_config_item_attribute\".\"description\" FROM \"config_it...\n". At the same time the query works in PostgreSQL Admin panel 4. This issue is actually a "show stopper" in my project. PREPARE SELECT DISTINCT "i"."id_code", "i"."id_customization", "i"."type", "i"."description", "s_config_item_attribute_shape"."kind", "s_config_item_attribute"."id", "s_config_item_attribute"."typeid", "s_config_item_attribute"."owner_code", "s_config_item_attribute"."owner_customization", "s_config_item_attribute"."description" FROM "config_item_attribute_shape" AS "s_config_item_attribute_shape" LEFT JOIN "config_item_attribute" AS "s_config_item_attribute" ON "s_config_item_attribute"."id"="s_config_item_attribute_shape"."id" LEFT JOIN "config_item" AS "i" ON "s_config_item_attribute"."owner_code"="i"."id_code" AND "s_config_item_attribute"."owner_customization"="i"."id_customization" WHERE ("s_config_item_attribute_shape"."id" IS NOT NULL) AND ("i"."id_code" LIKE $1) { ??? "errorCode": "ODB", ??? "errorMessage": "42P01: ERROR:? relation \"config_item_attribute_shape\" does not exist\nLINE 1: ...on\", \"s_config_item_attribute\".\"description\" FROM \"config_it...\n???????????????????????????????????????????????????????????? ^", } This is the definition of the view: #pragma db view object(item_attribute_shape = s) \ ??????????????? object(item = i : s::m_owner) \ ??????????????? query(s::m_id.is_not_null() && (?), distinct) ??? struct shaped_items ??? { ????? std::shared_ptr i; ????? std::shared_ptr s; ??? }; item_attribute_shape class is derived from abstract polymorhic item_attribute one. Environment: MSVS 2013, ODB 2.5.0-b.3. From p.staszewski90 at gmail.com Thu Jun 14 07:55:56 2018 From: p.staszewski90 at gmail.com (=?UTF-8?Q?Pawe=C5=82_Staszewski?=) Date: Thu Jun 14 08:00:46 2018 Subject: [odb-users] odb-2.5.0 compiler for windows Message-ID: Hi, How can I get for windows? Pawel From boris at codesynthesis.com Thu Jun 14 08:57:35 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 14 08:59:44 2018 Subject: [odb-users] odb-2.5.0 compiler for windows In-Reply-To: References: Message-ID: Pawe? Staszewski writes: > How can I get for windows? There are two options: You can get the latest pre-release (which includes a binary for Windows) here: https://codesynthesis.com/~boris/tmp/odb/pre-release/b.3/ Alternatively, I can provide you with instructions for building the ODB compiler on Windows yourself. However, at the moment, this process still has a few rough edges. Boris From boris at codesynthesis.com Thu Jun 14 09:09:21 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 14 09:11:30 2018 Subject: [odb-users] PostgreSQL 42P01 error In-Reply-To: <1528904990.106975658@f308.i.mail.ru> References: <1528904990.106975658@f308.i.mail.ru> Message-ID: ?????? ??????? writes: > When I try to execute a view query generated by ODB I get the following > error: ""errorMessage": "42P01: ERROR: relation \"config_item_attribute_shape\" > does not exist. At the same time the query works in PostgreSQL Admin panel 4. > > PREPARE SELECT DISTINCT "i"."id_code", "i"."id_customization", "i"."type", > "i"."description", "s_config_item_attribute_shape"."kind", > "s_config_item_attribute"."id", "s_config_item_attribute"."typeid", > "s_config_item_attribute"."owner_code", > "s_config_item_attribute"."owner_customization", > "s_config_item_attribute"."description" FROM "config_item_attribute_shape" > AS "s_config_item_attribute_shape" LEFT JOIN "config_item_attribute" AS > "s_config_item_attribute" ON > "s_config_item_attribute"."id"="s_config_item_attribute_shape"."id" LEFT > JOIN "config_item" AS "i" ON > "s_config_item_attribute"."owner_code"="i"."id_code" AND > "s_config_item_attribute"."owner_customization"="i"."id_customization" WHERE > ("s_config_item_attribute_shape"."id" IS NOT NULL) AND ("i"."id_code" LIKE > $1) > > This is the definition of the view: > #pragma db view object(item_attribute_shape = s) \ > object(item = i : s::m_owner) \ > query(s::m_id.is_not_null() && (?), distinct) > struct shaped_items > { > std::shared_ptr i; > std::shared_ptr s; > }; I don't see anything clearly wrong with this. What is 'config_item_attribute'? In fact, if you could come up with a small test that reproduces the problem, that would probably be the best way forward. From whisperity at gmail.com Thu Jun 14 14:16:27 2018 From: whisperity at gmail.com (Whisperity) Date: Fri Jun 15 07:13:16 2018 Subject: [odb-users] Self-compiling ODB on Ubuntu 18.04 (GCC/G++ version 7) Message-ID: Dear List, Dear Boris, I am trying to upgrade our tool, the open-source code comprehension framework, CodeCompass (https://github.com/Ericsson/CodeCompass) to work with the latest Ubuntu 18.04 release. However, there are many issues with this. Due to some errors with the package ABI, self-compilation must be done for ODB. This works nice on Ubuntu 16.04 LTS (GNU/G++ version 5), but with G++ 7, it fails. This only affects the ODB compiler (odb-2.4.0). The database connector libraries for PostgreSQL and SQLite can properly be compiled with G++ 7. I am working on a cleanly installed system. The error list is long, but in general, it is a massive chain of "template with C linkage" errors in the "plugin headers" (e.g. /usr/lib/gcc/x86_64-linux-gnu/7/plugin/include/wide-int.h:742:1), e.g. In file included from /usr/lib/gcc/x86_64-linux-gnu/7/plugin/include/coretypes.h:365:0, from ../odb/gcc-fwd.hxx:32, from ../odb/context.hxx:8, from ../odb/common.hxx:13, from common.cxx:5: /usr/lib/gcc/x86_64-linux-gnu/7/plugin/include/wide-int.h:573:3: error: template with C linkage template ^~~~~~~~ Could it be that somewhere in the code a #include is placed in an extern "C" {} block... or should this issue be reported to the GNU developers? So far, manually falling back and installing "g++-5 gcc-5-plugin-dev" from the package manager and telling configure to use GCC-5 makes this error go away. -- Regards, Whisperity. -------------- next part -------------- A non-text attachment was scrubbed... Name: odb-gxx7.log Type: text/x-log Size: 843929 bytes Desc: not available Url : https://codesynthesis.com/pipermail/odb-users/attachments/20180614/37759717/odb-gxx7-0001.bin From feiyunw at yahoo.com Thu Jun 14 23:36:22 2018 From: feiyunw at yahoo.com (Feiyun Wang) Date: Fri Jun 15 07:13:16 2018 Subject: [odb-users] mariadb hello example assertion failure with VS2017 References: <1595480334.670394.1529033782960.ref@mail.yahoo.com> Message-ID: <1595480334.670394.1529033782960@mail.yahoo.com> Hi, It caused an assertion failure when using mariadb for the hello example with VS2017:````Assertion failed: opt_mode != ::odb::mysql::details::cli::unknown_mode::skip, file G:\prj\odb\libodb-mariadb-vs2017dbg\odb\mysql\details\options.cxx, line 841```` This assertion came from file libodb-mariadb-vs2017dbg\odb\mysql\details\options.cxx:````? ? ? bool options::? ? ? _parse (::odb::mysql::details::cli::scanner& s,? ? ? ? ? ? ? ::odb::mysql::details::cli::unknown_mode opt_mode,? ? ? ? ? ? ? ::odb::mysql::details::cli::unknown_mode arg_mode)? ? ? {? ? ? ? // Can't skip combined flags (--no-combined-flags).? ? ? ? //? ? ? ? assert (opt_mode != ::odb::mysql::details::cli::unknown_mode::skip); // --> this line```` called by the options constructor in the same file:````? ? ? options::? ? ? options (::odb::mysql::details::cli::scanner& s,? ? ? ? ? ? ? ?::odb::mysql::details::cli::unknown_mode opt,? ? ? ? ? ? ? ?::odb::mysql::details::cli::unknown_mode arg)? ? ? : user_ (),? ? ? ? user_specified_ (false),? ? ? ? password_ (),? ? ? ? password_specified_ (false),? ? ? ? database_ (),? ? ? ? database_specified_ (false),? ? ? ? host_ (),? ? ? ? host_specified_ (false),? ? ? ? port_ (0),? ? ? ? port_specified_ (false),? ? ? ? socket_ (),? ? ? ? socket_specified_ (false),? ? ? ? options_file_ (),? ? ? ? options_file_specified_ (false)? ? ? {? ? ? ? _parse (s, opt, arg); // --> this line? ? ? }```` called by libodb-mysql\odb\mysql\database.cxx:````? ? database::? ? database (int& argc,? ? ? ? ? ? ? char* argv[],? ? ? ? ? ? ? bool erase,? ? ? ? ? ? ? const string& charset,? ? ? ? ? ? ? unsigned long client_flags,? ? ? ? ? ? ? transfer_ptr factory)? ? ? ? : odb::database (id_mysql),? ? ? ? ? passwd_ (0),? ? ? ? ? socket_ (0),? ? ? ? ? charset_ (charset),? ? ? ? ? client_flags_ (client_flags),? ? ? ? ? factory_ (factory.transfer ())? ? {? ? ? using namespace details; ? ? ? try? ? ? {? ? ? ? cli::argv_file_scanner scan (argc, argv, "--options-file", erase);? ? ? ? options ops (scan, cli::unknown_mode::skip, cli::unknown_mode::skip); // --> this line```` called by odb-examples\hello\database.hxx:````inline std::auto_ptrcreate_database (int& argc, char* argv[])....#if defined(DATABASE_MYSQL)? auto_ptr db (new odb::mysql::database (argc, argv)); // --> this line```` called by odb-examples\hello\driver.cxx:````intmain (int argc, char* argv[]){? try? {? ? auto_ptr db (create_database (argc, argv)); // --> this line```` The Call stack:````odb-mysql-2.5.0-b.8.6e5a6b4e4e38.dll!odb::mysql::details::options::_parse(odb::mysql::details::cli::scanner & s, odb::mysql::details::cli::unknown_mode opt_mode, odb::mysql::details::cli::unknown_mode arg_mode) Line 841 at g:\prj\odb\libodb-mariadb-vs2017dbg\odb\mysql\details\options.cxx(841)odb-mysql-2.5.0-b.8.6e5a6b4e4e38.dll!odb::mysql::details::options::options(odb::mysql::details::cli::scanner & s, odb::mysql::details::cli::unknown_mode opt, odb::mysql::details::cli::unknown_mode arg) Line 744 at g:\prj\odb\libodb-mariadb-vs2017dbg\odb\mysql\details\options.cxx(744)odb-mysql-2.5.0-b.8.6e5a6b4e4e38.dll!odb::mysql::database::database(int & argc, char * * argv, bool erase, const std::basic_string,std::allocator > & charset, unsigned long client_flags, odb::details::transfer_ptr factory) Line 195 at g:\prj\odb\libodb-mysql\odb\mysql\database.cxx(195)hello.exe!create_database(int & argc, char * * argv) Line 62 at g:\prj\odb\odb-examples\hello\database.hxx(62)hello.exe!main(int argc, char * * argv) Line 23 at g:\prj\odb\odb-examples\hello\driver.cxx(23)```` The script that I used to build the supporting tools and libraries:````set PATH=C:\build2\bin;%PATH%ECHO ===== Installing libcutl-vs2017mkdir libcutl-vs2017b config.cxx=cl config.cc.coptions="/O2" config.install.root=C:\build2 "configure(libcutl/@libcutl-vs2017/)"cd libcutl-vs2017/b installcd ..ECHO ===== Installing cli-vs2017mkdir cli-vs2017b config.cxx=cl config.cc.coptions="/O2" config.import.libcutl=libcutl-vs2017/ config.install.root=C:\build2 "configure(cli/@cli-vs2017/)"cd cli-vs2017b installcd ..ECHO ===== Installing libodb-vs2017dbgmkdir libodb-vs2017dbgb config.cxx=cl config.cc.coptions="/Od /MDd /Zi" config.cc.loptions=/DEBUG config.install.root="install/libodb-vs2017dbg/" "configure(libodb/@libodb-vs2017dbg/)"cd libodb-vs2017dbgb installcd ..ECHO ===== Installing libmariadb-vs2017dbgmkdir libmariadb-vs2017dbgb config.cxx=cl config.cc.coptions="/Od /MDd /Zi /wd4819" config.cc.loptions=/DEBUG config.install.root="install/libmariadb-vs2017dbg/" "configure(libmariadb/@libmariadb-vs2017dbg/)"cd libmariadb-vs2017dbgb installcd ..ECHO ===== Installing libodb-mariadb-vs2017dbgmkdir libodb-mariadb-vs2017dbgcd libodb-mysqlgit checkout -f mariadb --cd ..b config.cxx=cl config.cc.coptions="/Od /MDd /Zi" config.cc.loptions=/DEBUG config.cli=C:\build2\bin\cli.exe config.import.libmariadb=libmariadb-vs2017dbg/ config.import.libodb=libodb-vs2017dbg/ config.install.root="install/libodb-mariadb-vs2017dbg/" "configure(libodb-mysql/@libodb-mariadb-vs2017dbg/)"cd libodb-mariadb-vs2017dbgb installcd ..```` The mariadb branch I created in the local libodb-mysql git repo has only one patch:````From 6e5a6b4e4e38ccf0ffab35b82d5def5ab6c4f08a Mon Sep 17 00:00:00 2001From: Feiyun Wang Date: Mon, 21 May 2018 22:50:52 +0800Subject: [PATCH] Change manifest and odb/mysql/buildfile to use mariadb?instead of mysql. ---?manifest? ? ? ? ? ? | 2 +-?odb/mysql/buildfile | 4 ++--?2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest b/manifestindex 2ac85c9..f205882 100644--- a/manifest+++ b/manifest@@ -17,5 +17,5 @@ requires: c++11?depends: * build2 >= 0.7.0-?depends: * bpkg >= 0.7.0-?#depends: libmysqlclient ^5.0.3 | libmariadb ^10.2.2-depends: libmysqlclient ^5.0.3+depends: libmariadb ^10.2.2?depends: libodb [2.5.0-b.8.1 2.5.0-b.9)diff --git a/odb/mysql/buildfile b/odb/mysql/buildfileindex 8822fee..bf912e1 100644--- a/odb/mysql/buildfile+++ b/odb/mysql/buildfile@@ -2,8 +2,8 @@?# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC?# license? ?: GNU GPL v2; see accompanying LICENSE file?-client_lib = 'mysql'-#client_lib = 'mariadb'+#client_lib = 'mysql'+client_lib = 'mariadb'??import int_libs = libodb%lib{odb}?--?2.17.1.windows.2 ```` which is sitting on the revision:````Revision: 70840fd64af1777cf13457cc5167b93ab1b9dae6Author: Karen Arutyunov Date: 2018/6/2 1:41:53Message:Remove target/scope irregularity workarounds```` b.exe and cli.exe versions:````g:\prj\odb>c:\build2\bin\b.exe --versionbuild2 0.8.0-a.0.e4a3a97bc76elibbutl 0.8.0-a.0.22dcb13424c3host x86_64-microsoft-win32-msvc14.1Copyright (c) 2014-2018 Code Synthesis LtdThis is free software released under the MIT license. g:\prj\odb>c:\build2\bin\cli.exe --versionCLI (command line interface compiler) 1.2.0-b.1.2ac46907b487Copyright (c) 2009-2018 Code Synthesis Tools CCThis is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.```` And hello.vcxproj PreprocessorDefinitions:````? ...? ? ? _DEBUG;_CONSOLE;DATABASE_MYSQL;LIBODB_BUILD2;LIBODB_SHARED;LIBODB_MYSQL_BUILD2;LIBODB_MYSQL_MARIADB;LIBODB_MYSQL_SHARED;%(PreprocessorDefinitions)...? ...? ? ? NDEBUG;_CONSOLE;DATABASE_MYSQL;LIBODB_BUILD2;LIBODB_SHARED;LIBODB_MYSQL_BUILD2;LIBODB_MYSQL_MARIADB;LIBODB_MYSQL_SHARED;%(PreprocessorDefinitions)```` It looks like the assertion code is generated by cli\cli\source.cxx (line 949).I also built a release version, but with the same assertion failure finally. Sincerely,Feiyun Wang From feiyunw at yahoo.com Fri Jun 15 02:32:24 2018 From: feiyunw at yahoo.com (Feiyun Wang) Date: Fri Jun 15 07:13:17 2018 Subject: [odb-users] Re: mariadb hello example assertion failure with VS2017 In-Reply-To: <1595480334.670394.1529033782960@mail.yahoo.com> References: <1595480334.670394.1529033782960.ref@mail.yahoo.com> <1595480334.670394.1529033782960@mail.yahoo.com> Message-ID: <1704453777.710343.1529044344966@mail.yahoo.com> Hi Boris, MySQL has the same problem like MariaDB.I fixed it by temporarily reverting the cli commit:````Revision: bffe74e67f69fb4ad928230e86ca776bd39ae432Author: Boris Kolpackov Date: 2018/4/2 0:37:30Message:Implement combined flags (-xyz vs -x -y -z) and values (--foo=bar) support Both are enabled by default but can be disable with --no-combined-flagsand --no-combined-values options.```` You'd better take a look at it. Sincerely,Feiyun Wang On Friday, June 15, 2018, 11:36:22 AM GMT+8, Feiyun Wang wrote: Hi, It caused an assertion failure when using mariadb for the hello example with VS2017:````Assertion failed: opt_mode != ::odb::mysql::details::cli::unknown_mode::skip, file G:\prj\odb\libodb-mariadb-vs2017dbg\odb\mysql\details\options.cxx, line 841```` This assertion came from file libodb-mariadb-vs2017dbg\odb\mysql\details\options.cxx:````? ? ? bool options::? ? ? _parse (::odb::mysql::details::cli::scanner& s,? ? ? ? ? ? ? ::odb::mysql::details::cli::unknown_mode opt_mode,? ? ? ? ? ? ? ::odb::mysql::details::cli::unknown_mode arg_mode)? ? ? {? ? ? ? // Can't skip combined flags (--no-combined-flags).? ? ? ? //? ? ? ? assert (opt_mode != ::odb::mysql::details::cli::unknown_mode::skip); // --> this line```` called by the options constructor in the same file:````? ? ? options::? ? ? options (::odb::mysql::details::cli::scanner& s,? ? ? ? ? ? ? ?::odb::mysql::details::cli::unknown_mode opt,? ? ? ? ? ? ? ?::odb::mysql::details::cli::unknown_mode arg)? ? ? : user_ (),? ? ? ? user_specified_ (false),? ? ? ? password_ (),? ? ? ? password_specified_ (false),? ? ? ? database_ (),? ? ? ? database_specified_ (false),? ? ? ? host_ (),? ? ? ? host_specified_ (false),? ? ? ? port_ (0),? ? ? ? port_specified_ (false),? ? ? ? socket_ (),? ? ? ? socket_specified_ (false),? ? ? ? options_file_ (),? ? ? ? options_file_specified_ (false)? ? ? {? ? ? ? _parse (s, opt, arg); // --> this line? ? ? }```` called by libodb-mysql\odb\mysql\database.cxx:````? ? database::? ? database (int& argc,? ? ? ? ? ? ? char* argv[],? ? ? ? ? ? ? bool erase,? ? ? ? ? ? ? const string& charset,? ? ? ? ? ? ? unsigned long client_flags,? ? ? ? ? ? ? transfer_ptr factory)? ? ? ? : odb::database (id_mysql),? ? ? ? ? passwd_ (0),? ? ? ? ? socket_ (0),? ? ? ? ? charset_ (charset),? ? ? ? ? client_flags_ (client_flags),? ? ? ? ? factory_ (factory.transfer ())? ? {? ? ? using namespace details; ? ? ? try? ? ? {? ? ? ? cli::argv_file_scanner scan (argc, argv, "--options-file", erase);? ? ? ? options ops (scan, cli::unknown_mode::skip, cli::unknown_mode::skip); // --> this line```` called by odb-examples\hello\database.hxx:````inline std::auto_ptrcreate_database (int& argc, char* argv[])....#if defined(DATABASE_MYSQL)? auto_ptr db (new odb::mysql::database (argc, argv)); // --> this line```` called by odb-examples\hello\driver.cxx:````intmain (int argc, char* argv[]){? try? {? ? auto_ptr db (create_database (argc, argv)); // --> this line```` The Call stack:````odb-mysql-2.5.0-b.8.6e5a6b4e4e38.dll!odb::mysql::details::options::_parse(odb::mysql::details::cli::scanner & s, odb::mysql::details::cli::unknown_mode opt_mode, odb::mysql::details::cli::unknown_mode arg_mode) Line 841 at g:\prj\odb\libodb-mariadb-vs2017dbg\odb\mysql\details\options.cxx(841)odb-mysql-2.5.0-b.8.6e5a6b4e4e38.dll!odb::mysql::details::options::options(odb::mysql::details::cli::scanner & s, odb::mysql::details::cli::unknown_mode opt, odb::mysql::details::cli::unknown_mode arg) Line 744 at g:\prj\odb\libodb-mariadb-vs2017dbg\odb\mysql\details\options.cxx(744)odb-mysql-2.5.0-b.8.6e5a6b4e4e38.dll!odb::mysql::database::database(int & argc, char * * argv, bool erase, const std::basic_string,std::allocator > & charset, unsigned long client_flags, odb::details::transfer_ptr factory) Line 195 at g:\prj\odb\libodb-mysql\odb\mysql\database.cxx(195)hello.exe!create_database(int & argc, char * * argv) Line 62 at g:\prj\odb\odb-examples\hello\database.hxx(62)hello.exe!main(int argc, char * * argv) Line 23 at g:\prj\odb\odb-examples\hello\driver.cxx(23)```` The script that I used to build the supporting tools and libraries:````set PATH=C:\build2\bin;%PATH%ECHO ===== Installing libcutl-vs2017mkdir libcutl-vs2017b config.cxx=cl config.cc.coptions="/O2" config.install.root=C:\build2 "configure(libcutl/@libcutl-vs2017/)"cd libcutl-vs2017/b installcd ..ECHO ===== Installing cli-vs2017mkdir cli-vs2017b config.cxx=cl config.cc.coptions="/O2" config.import.libcutl=libcutl-vs2017/ config.install.root=C:\build2 "configure(cli/@cli-vs2017/)"cd cli-vs2017b installcd ..ECHO ===== Installing libodb-vs2017dbgmkdir libodb-vs2017dbgb config.cxx=cl config.cc.coptions="/Od /MDd /Zi" config.cc.loptions=/DEBUG config.install.root="install/libodb-vs2017dbg/" "configure(libodb/@libodb-vs2017dbg/)"cd libodb-vs2017dbgb installcd ..ECHO ===== Installing libmariadb-vs2017dbgmkdir libmariadb-vs2017dbgb config.cxx=cl config.cc.coptions="/Od /MDd /Zi /wd4819" config.cc.loptions=/DEBUG config.install.root="install/libmariadb-vs2017dbg/" "configure(libmariadb/@libmariadb-vs2017dbg/)"cd libmariadb-vs2017dbgb installcd ..ECHO ===== Installing libodb-mariadb-vs2017dbgmkdir libodb-mariadb-vs2017dbgcd libodb-mysqlgit checkout -f mariadb --cd ..b config.cxx=cl config.cc.coptions="/Od /MDd /Zi" config.cc.loptions=/DEBUG config.cli=C:\build2\bin\cli.exe config.import.libmariadb=libmariadb-vs2017dbg/ config.import.libodb=libodb-vs2017dbg/ config.install.root="install/libodb-mariadb-vs2017dbg/" "configure(libodb-mysql/@libodb-mariadb-vs2017dbg/)"cd libodb-mariadb-vs2017dbgb installcd ..```` The mariadb branch I created in the local libodb-mysql git repo has only one patch:````From 6e5a6b4e4e38ccf0ffab35b82d5def5ab6c4f08a Mon Sep 17 00:00:00 2001From: Feiyun Wang Date: Mon, 21 May 2018 22:50:52 +0800Subject: [PATCH] Change manifest and odb/mysql/buildfile to use mariadb?instead of mysql. ---?manifest? ? ? ? ? ? | 2 +-?odb/mysql/buildfile | 4 ++--?2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest b/manifestindex 2ac85c9..f205882 100644--- a/manifest+++ b/manifest@@ -17,5 +17,5 @@ requires: c++11?depends: * build2 >= 0.7.0-?depends: * bpkg >= 0.7.0-?#depends: libmysqlclient ^5.0.3 | libmariadb ^10.2.2-depends: libmysqlclient ^5.0.3+depends: libmariadb ^10.2.2?depends: libodb [2.5.0-b.8.1 2.5.0-b.9)diff --git a/odb/mysql/buildfile b/odb/mysql/buildfileindex 8822fee..bf912e1 100644--- a/odb/mysql/buildfile+++ b/odb/mysql/buildfile@@ -2,8 +2,8 @@?# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC?# license? ?: GNU GPL v2; see accompanying LICENSE file?-client_lib = 'mysql'-#client_lib = 'mariadb'+#client_lib = 'mysql'+client_lib = 'mariadb'??import int_libs = libodb%lib{odb}?--?2.17.1.windows.2 ```` which is sitting on the revision:````Revision: 70840fd64af1777cf13457cc5167b93ab1b9dae6Author: Karen Arutyunov Date: 2018/6/2 1:41:53Message:Remove target/scope irregularity workarounds```` b.exe and cli.exe versions:````g:\prj\odb>c:\build2\bin\b.exe --versionbuild2 0.8.0-a.0.e4a3a97bc76elibbutl 0.8.0-a.0.22dcb13424c3host x86_64-microsoft-win32-msvc14.1Copyright (c) 2014-2018 Code Synthesis LtdThis is free software released under the MIT license. g:\prj\odb>c:\build2\bin\cli.exe --versionCLI (command line interface compiler) 1.2.0-b.1.2ac46907b487Copyright (c) 2009-2018 Code Synthesis Tools CCThis is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.```` And hello.vcxproj PreprocessorDefinitions:````? ...? ? ? _DEBUG;_CONSOLE;DATABASE_MYSQL;LIBODB_BUILD2;LIBODB_SHARED;LIBODB_MYSQL_BUILD2;LIBODB_MYSQL_MARIADB;LIBODB_MYSQL_SHARED;%(PreprocessorDefinitions)...? ...? ? ? NDEBUG;_CONSOLE;DATABASE_MYSQL;LIBODB_BUILD2;LIBODB_SHARED;LIBODB_MYSQL_BUILD2;LIBODB_MYSQL_MARIADB;LIBODB_MYSQL_SHARED;%(PreprocessorDefinitions)```` It looks like the assertion code is generated by cli\cli\source.cxx (line 949).I also built a release version, but with the same assertion failure finally. Sincerely,Feiyun Wang From boris at codesynthesis.com Fri Jun 15 09:53:25 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 15 09:55:37 2018 Subject: [odb-users] Self-compiling ODB on Ubuntu 18.04 (GCC/G++ version 7) In-Reply-To: References: Message-ID: Whisperity writes: > However, there are many issues with this. Due to some errors with the > package ABI, self-compilation must be done for ODB. This works nice on > Ubuntu 16.04 LTS (GNU/G++ version 5), but with G++ 7, it fails. > > This only affects the ODB compiler (odb-2.4.0). ODB source code has to be adjusted for each major release of GCC (since they break the API). For GCC 7 you can use the latest pre-release (note that you also need the included libcutl): https://codesynthesis.com/~boris/tmp/odb/pre-release/b.3/ Boris From finjulhich at gmail.com Fri Jun 15 10:07:54 2018 From: finjulhich at gmail.com (MM) Date: Fri Jun 15 10:10:24 2018 Subject: [odb-users] recursive loading Message-ID: Hello, With a raw pointer, when issuing a auto* ptr = db.load(id); Is it possible to have the pre-load c++ callback of myclass issue another db.load( another_id ) I'm having a core dump in this situation. myclass member fields refer to other instances of the same type. Rds, MM From haupt.wolfgang at gmail.com Fri Jun 15 10:22:58 2018 From: haupt.wolfgang at gmail.com (Wolfgang Haupt) Date: Fri Jun 15 10:25:30 2018 Subject: [odb-users] Self-compiling ODB on Ubuntu 18.04 (GCC/G++ version 7) In-Reply-To: References: Message-ID: I have compiled odb on Ubuntu 18.04 a few days ago. The hardest part for me was to build cli as the master branch was moved to build2 but the INSTALL file still tells you to just "make" in the root dir. After a few hours of trying to build it with build2 I gave up and reverted back to the last commit before build2 was introduced. Boris, maybe you can update the INSTALL file with more recent instructions? Boris Kolpackov schrieb am Fr., 15. Juni 2018 um 15:53 Uhr: > Whisperity writes: > > > However, there are many issues with this. Due to some errors with the > > package ABI, self-compilation must be done for ODB. This works nice on > > Ubuntu 16.04 LTS (GNU/G++ version 5), but with G++ 7, it fails. > > > > This only affects the ODB compiler (odb-2.4.0). > > ODB source code has to be adjusted for each major release of GCC (since > they break the API). For GCC 7 you can use the latest pre-release (note > that you also need the included libcutl): > > https://codesynthesis.com/~boris/tmp/odb/pre-release/b.3/ > > Boris > > From finjulhich at gmail.com Fri Jun 15 15:34:19 2018 From: finjulhich at gmail.com (MM) Date: Fri Jun 15 15:36:49 2018 Subject: [odb-users] Native sqlite3 recursive SQL query Message-ID: Hello, I have a sqlite database, where odb generates the schema and code to access persistent objects. However, there are unrelated tables and I would like to access the result of a recursive single-column SELECT on those unrelated tables, the resulting column is TEXT std::ostringstream oss; oss << "SELECT mycolumn FROM sometable WHERE id IN (.." << myparameter << "...)"; auto nbr_rows = odb::database::execute( oss.str() ); surrounded by a transaction Is there a way to get the resulting mycolumn as a std::vector ? Thank you, From boris at codesynthesis.com Mon Jun 18 08:37:19 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 18 08:39:41 2018 Subject: [odb-users] recursive loading In-Reply-To: References: Message-ID: MM writes: > Is it possible to have the pre-load c++ callback of myclass issue > another db.load( another_id ) Yes. > I'm having a core dump in this situation. Must be a bug somewhere. From boris at codesynthesis.com Mon Jun 18 08:38:43 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 18 08:41:06 2018 Subject: [odb-users] Native sqlite3 recursive SQL query In-Reply-To: References: Message-ID: MM writes: > std::ostringstream oss; > oss << "SELECT mycolumn FROM sometable WHERE id IN (.." > << myparameter << "...)"; > auto nbr_rows = odb::database::execute( oss.str() ); > > Is there a way to get the resulting mycolumn as a std::vector ? See native views. From boris at codesynthesis.com Mon Jun 18 09:00:32 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 18 09:02:53 2018 Subject: [odb-users] mariadb hello example assertion failure with VS2017 In-Reply-To: <1595480334.670394.1529033782960@mail.yahoo.com> References: <1595480334.670394.1529033782960.ref@mail.yahoo.com> <1595480334.670394.1529033782960@mail.yahoo.com> Message-ID: Feiyun Wang writes: > It caused an assertion failure when using mariadb for the hello example with > VS2017: Assertion failed: opt_mode != ::odb::mysql::details::cli::unknown_mode::skip Thanks for the report. I've fixed this, can you try the latest HEAD? From feiyunw at yahoo.com Mon Jun 18 22:30:57 2018 From: feiyunw at yahoo.com (Feiyun Wang) Date: Tue Jun 19 07:49:42 2018 Subject: [odb-users] mariadb hello example assertion failure with VS2017 In-Reply-To: References: <1595480334.670394.1529033782960.ref@mail.yahoo.com> <1595480334.670394.1529033782960@mail.yahoo.com> Message-ID: <1056133268.2509644.1529375457699@mail.yahoo.com> Hi Boris, I confirm that this bug is fixed with the libodb-mysql latest patch:````Revision: 54bc7449d034b6df12e5a3416905d9d3b9daf697Author: Boris Kolpackov Date: 2018/6/18 20:53:22Message:Suppress support for combined CLI flags (--no-combined-flags) We don't have any short options and this is incompatible with the skip modewe are using.```` Sincerely,Feiyun Wang On Monday, June 18, 2018, 9:00:38 PM GMT+8, Boris Kolpackov wrote: Feiyun Wang writes: > It caused an assertion failure when using mariadb for the hello example with > VS2017: Assertion failed: opt_mode != ::odb::mysql::details::cli::unknown_mode::skip Thanks for the report. I've fixed this, can you try the latest HEAD? From finjulhich at gmail.com Wed Jun 20 06:57:58 2018 From: finjulhich at gmail.com (MM) Date: Wed Jun 20 07:00:43 2018 Subject: [odb-users] Native sqlite3 recursive SQL query Message-ID: On 18 June 2018 at 13:38, Boris Kolpackov wrote: > MM writes: > > > std::ostringstream oss; > > oss << "SELECT mycolumn FROM sometable WHERE id IN (.." > > << myparameter << "...)"; > > auto nbr_rows = odb::database::execute( oss.str() ); > > > > Is there a way to get the resulting mycolumn as a > std::vector ? > > See native views. > The manual says "To indicate that a native view has a runtime query, we can either specify the empty db query pragma or omit the pragma altogether." I have tried to omit the pragma altogether, however that failed to compile. (I've noticed the error says class_kind was neither object nor view but other). I've then added the pragma and that compiled fine and worked fine too. Thank you very much, MM From finjulhich at gmail.com Wed Jun 20 08:51:57 2018 From: finjulhich at gmail.com (MM) Date: Wed Jun 20 08:54:43 2018 Subject: [odb-users] recursive loading Message-ID: On 18 June 2018 at 13:37, Boris Kolpackov wrote: > MM writes: > > > Is it possible to have the pre-load c++ callback of myclass issue > > another db.load( another_id ) > > Yes. > > > > I'm having a core dump in this situation. > > Must be a bug somewhere. Sorry, it's not in the pre-load. I have it in the post-load callback. In fact, I see that in the post-load cb: db.load(another_id) instantiates a object, but it is empty. It appears it calls in the generated odb code: sts.delay_load (id, obj, ig.position ()); Apparently, the auto_lock is not locked. Does any of this make sense? From boris at codesynthesis.com Thu Jun 21 08:13:59 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 21 08:16:32 2018 Subject: [odb-users] Self-compiling ODB on Ubuntu 18.04 (GCC/G++ version 7) In-Reply-To: References: Message-ID: Wolfgang Haupt writes: > Boris, maybe you can update the INSTALL file with more recent instructions? Yes, we need to do this, it's just things are a bit in flux at the moment. But, you should now be able to build the latest ODB compiler (and libodb* libraries) pretty much automatically (and without CLI) from our staging repository: https://stage.build2.org/?q=odb Here are the steps: 1. Build the latest staged build2 toolchain by following the installation instructions found here: https://build2.org/install.xhtml BUT: using the install scripts from here: https://stage.build2.org/0/ 2. Once you have the build2 toolchain, to build the ODB compiler: $ bpkg create -d odb-build cc config.cxx=g++ $ cd odb-build $ bpkg build odb@https://stage.build2.org/1 To install: $ bpkg install \ config.install.root=/usr/local \ config.install.sudo=sudo \ odb See "Package Consumption" for more information: https://build2.org/build2-toolchain/doc/build2-toolchain-intro.xhtml#guide-consume-pkg Let me know if there are any issues. From finjulhich at gmail.com Fri Jun 22 09:38:52 2018 From: finjulhich at gmail.com (MM) Date: Fri Jun 22 09:41:47 2018 Subject: [odb-users] recursive loading Message-ID: On 20 June 2018 at 13:51, MM wrote: > On 18 June 2018 at 13:37, Boris Kolpackov wrote: > > > MM writes: > > > > > Is it possible to have the pre-load c++ callback of myclass issue > > > another db.load( another_id ) > > > > Yes. > > > > > > > I'm having a core dump in this situation. > > > > Must be a bug somewhere. > > > Sorry, it's not in the pre-load. I have it in the post-load callback. > In fact, I see that in the post-load cb: > db.load(another_id) > instantiates a object, but it is empty. It appears it calls in the > generated odb code: > > sts.delay_load (id, obj, ig.position ()); > > Apparently, the auto_lock is not locked. > > Does any of this make sense? > An update here. In the post-load callback, I've replaced the call to db.load(another_id) //// returns an object but it remains empty //// tracer shows that a SELECT query is issued indeed with auto res = db.query( query::id == another_id); for (auto& obj: res) //// obj is correctly populated here It seems db.load() inside of post-load callback of the 1st db.load() doesn't work. But db.query does. MM From finjulhich at gmail.com Fri Jun 22 15:29:30 2018 From: finjulhich at gmail.com (MM) Date: Fri Jun 22 15:32:23 2018 Subject: [odb-users] object view query Message-ID: Hello, I am struggling to express a query that will load my objects where the condition depends on non direct relationships on another specified object. struct MyGroup { std::vector periods; int id; }; #pragma db object(MyGroup) struct Period { MyObjectContainer* c; ... }; #pragma db value(Period) definition #pragma db member(Period::c) transient #pragma db member(Period::cid) virtual(int) ... struct MyObjectContainer { int id; ... }; #pragma db object(MyObjectContainer) definition struct MyObject { int id; MyObjectContainer* mycontainer; }; #pragma db object(MyObject) definition #pragma db member(MyObject::containerid) virtual(int) ... I am given a MyGroup id, and I need to load all the MyObjects such that their "mycontainer" is referred to by 1 of the Periods in the given MyGroup. I know how to write the direct SELECT query for that but I'd rather load MyGroup via a db.query call. Perhaps I don't even need a view and I can express this as a regular db.query( .... ) MM From boris at codesynthesis.com Sat Jun 23 12:00:26 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Jun 23 12:03:05 2018 Subject: [odb-users] recursive loading In-Reply-To: References: Message-ID: MM writes: > Does any of this make sense? Perhaps you are loading the same object recursively. Try to create a session before the transaction. From Manoj.Angadi at arris.com Mon Jun 25 19:38:35 2018 From: Manoj.Angadi at arris.com (Angadi, Manoj) Date: Tue Jun 26 07:58:34 2018 Subject: [odb-users] ODB: Updating journal_mode Message-ID: <975ECD951F9EB54C99F30D1E6614B694030B95A07F@SDCEXMBX1.ARRS.ARRISI.com> Hi, Can you please share an example explaining how to update the journal_mode say from the default value of DELETE to OFF. and query the value back. We have multiple linux processes accessing the same database file, should we be updating the journal_mode everytime we create a new odb::sqlite::database object within each of the processes? Thanks, Manoj Angadi ARRIS Group Inc From boris at codesynthesis.com Tue Jun 26 08:20:30 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 26 08:23:17 2018 Subject: [odb-users] ODB: Updating journal_mode In-Reply-To: <975ECD951F9EB54C99F30D1E6614B694030B95A07F@SDCEXMBX1.ARRS.ARRISI.com> References: <975ECD951F9EB54C99F30D1E6614B694030B95A07F@SDCEXMBX1.ARRS.ARRISI.com> Message-ID: Angadi, Manoj writes: > Can you please share an example explaining how to update the journal_mode > say from the default value of DELETE to OFF. You can use the database::execute() function for that, for example: db.execute ("PRAGMA schema.journal_mode = OFF"); > and query the value back. To query it, you can use a native view (Chapter 10 in the manual). > We have multiple linux processes accessing the same database file, > should we be updating the journal_mode everytime we create a new > odb::sqlite::database object within each of the processes? I am not sure exactly what you are trying to achieve here. SQlite generally does not allow concurrent access to the same database from multiple processes. So the answer to this question depends on how you manage this access. From finjulhich at gmail.com Tue Jun 26 13:45:13 2018 From: finjulhich at gmail.com (MM) Date: Tue Jun 26 13:48:21 2018 Subject: [odb-users] custom containers or not: boost::multi_array Message-ID: Hello class EL { std::uint32_t id_; std::vector dates_; boost::multi_array entries_; }; /// dates_.size() == number or rows of entries_ /// number of cols of entries_ = N /// entry is a struct that maps to a composite value type My object target tables look like: table "EL" id ------------- . . . table "EL_rows" ELid date entrycols -------------------------------------- 1 d1 entry11 1 d1 entry12 ... 1 d1 entry1N 1 d2 entry21 1 d2 entry22 ... 1 d2 entry2N ... 1 dM entryM1 1 dM entryM2 ... 1 dM entryMN ... and so on for ELid 2 .... If the class EL is constrainted in its definition, is the way to use a custom container as explained in chapter 5.5? The relationship that the row entries_[x] corresponds the date dates_[x] would have to be implemented somehow. I'm at a loss as how to implement this really? From feiyunw at yahoo.com Thu Jun 28 00:32:48 2018 From: feiyunw at yahoo.com (Feiyun Wang) Date: Thu Jun 28 05:15:03 2018 Subject: [odb-users] odb.exe: odb/tr1/wrapper-traits.hxx No such file References: <367355741.3023189.1530160368233.ref@mail.yahoo.com> Message-ID: <367355741.3023189.1530160368233@mail.yahoo.com> Hi, I got some error when running the latest odb.exe with the hello example:````G:\prj\odb\odb-examples\hello>c:\build2\bin\odb.exe -d mysql --mysql-engine MyISAM --generate-query --generate-schema person.hxx:6:10: fatal error: odb/tr1/wrapper-traits.hxx: No such file or directorycompilation terminated.```` The odb git reversion I compiled is:````Revision: a2f5f473a0b1eb4cb9959f0302a1163d15ed91c7Author: Karen Arutyunov Date: 2018/6/21 0:48:55Message:Regularize .gitignore files```` My odb.exe build script:````ECHO ===== Installing libcutl-gccmkdir libcutl-gccb config.cxx=g++ config.cc.coptions="-O2" config.install.root=C:\build2 "configure(libcutl/@libcutl-gcc/)"cd libcutl-gcc/b installcd .. ECHO ===== Installing cli-gccmkdir cli-gccb config.cxx=g++ config.cc.coptions="-O2" config.import.libcutl=libcutl-gcc/ config.install.root=C:\build2 "configure(cli/@cli-gcc/)"cd cli-gccb installcd .. ECHO ===== Installing libstudxml-gccmkdir libstudxml-gccb config.cxx=g++ config.cc.coptions="-O2" config.install.root=C:\build2 "configure(libstudxml/@libstudxml-gcc/)"cd libstudxml-gccb installcd .. ECHO ===== Installing odb-gccmkdir odb-gccb config.cxx=g++ config.cc.coptions="-O2" config.cli=C:\build2\bin\cli.exe config.import.libstudxml=libstudxml-gcc/ config.import.libcutl=libcutl-gcc/ config.install.root=C:\build2 "configure(odb/@odb-gcc/)"cd odb-gccb installcd ..```` Versions:````G:\prj\odb\odb-examples\hello>c:\build2\bin\odb.exe --versionODB object-relational mapping (ORM) compiler for C++ 2.5.0-b.8Copyright (c) 2009-2018 Code Synthesis Tools CCThis is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. G:\prj\odb\odb-examples\hello>g++ --versiong++ (Rev2, Built by MSYS2 project) 7.3.0Copyright (C) 2017 Free Software Foundation, Inc.This is free software; see the source for copying conditions.? There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. G:\prj\odb\odb-examples\hello>gcc --versiongcc (Rev2, Built by MSYS2 project) 7.3.0Copyright (C) 2017 Free Software Foundation, Inc.This is free software; see the source for copying conditions.? There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. G:\prj\odb\odb-examples\hello>where g++c:\build2\bin\g++.exeD:\Strawberry\c\bin\g++.exe G:\prj\odb\odb-examples\hello>where gccc:\build2\bin\gcc.exeD:\Strawberry\c\bin\gcc.exe```` Sincerely,Feiyun Wang From boris at codesynthesis.com Thu Jun 28 11:50:24 2018 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 28 11:53:19 2018 Subject: [odb-users] odb.exe: odb/tr1/wrapper-traits.hxx No such file In-Reply-To: <367355741.3023189.1530160368233@mail.yahoo.com> References: <367355741.3023189.1530160368233.ref@mail.yahoo.com> <367355741.3023189.1530160368233@mail.yahoo.com> Message-ID: Feiyun Wang writes: > I got some error when running the latest odb.exe with the hello example: > > G:\prj\odb\odb-examples\hello>c:\build2\bin\odb.exe -d mysql > --mysql-engine MyISAM --generate-query --generate-schema person.hxx > > :6:10: fatal error: odb/tr1/wrapper-traits.hxx: > No such file or directory. The build2 build of ODB "officially" only supports C++11 (i.e., with the --std c++11 ODB compiler option). I've pushed/staged a fix for this so that C++98 should also work, though note that we are not really testing the C++98 support. Boris From finjulhich at gmail.com Thu Jun 28 16:43:36 2018 From: finjulhich at gmail.com (MM) Date: Thu Jun 28 16:46:49 2018 Subject: [odb-users] custom containers or not: boost::multi_array Message-ID: On 26 June 2018 at 18:45, MM wrote: > Hello > > > class EL { > std::uint32_t id_; > std::vector dates_; > boost::multi_array entries_; > }; > /// dates_.size() == number or rows of entries_ > /// number of cols of entries_ = N > /// entry is a struct that maps to a composite value type > > My object target tables look like: > > table "EL" > id > ------------- > . > . > . > > > table "EL_rows" > ELid date entrycols > -------------------------------------- > 1 d1 entry11 > 1 d1 entry12 > ... > 1 d1 entry1N > > 1 d2 entry21 > 1 d2 entry22 > ... > 1 d2 entry2N > > ... > > 1 dM entryM1 > 1 dM entryM2 > ... > 1 dM entryMN > ... > and so on for ELid 2 .... > > If the class EL is constrainted in its definition, is the way to use a > custom container as explained in chapter 5.5? > > The relationship that the row entries_[x] corresponds the date dates_[x] > would have to be implemented somehow. > > I'm at a loss as how to implement this really? > This use case boils down to just 2 dimensions for multi_array. If the multi_array container has N rows and M columns, and all the cells are of the same simple value type, is it possible to store as M*N rows in a SQL table? Is it possible to load M*N rows back into it? To use the container_traits, I suppose this would be a ordered container. The Index type would be a pair of integers for both dimensions? The value_type would be "entry" rds, From feiyunw at yahoo.com Fri Jun 29 02:25:59 2018 From: feiyunw at yahoo.com (Feiyun Wang) Date: Fri Jun 29 04:44:53 2018 Subject: [odb-users] odb.exe: odb/tr1/wrapper-traits.hxx No such file In-Reply-To: References: <367355741.3023189.1530160368233.ref@mail.yahoo.com> <367355741.3023189.1530160368233@mail.yahoo.com> Message-ID: <265892848.178047.1530253559649@mail.yahoo.com> It's fixed.Thanks! Feiyun Wang On Thursday, June 28, 2018, 11:50:31 PM GMT+8, Boris Kolpackov wrote: Feiyun Wang writes: > I got some error when running the latest odb.exe with the hello example: > > G:\prj\odb\odb-examples\hello>c:\build2\bin\odb.exe -d mysql > --mysql-engine MyISAM --generate-query --generate-schema person.hxx > > :6:10: fatal error: odb/tr1/wrapper-traits.hxx: > No such file or directory. The build2 build of ODB "officially" only supports C++11 (i.e., with the --std c++11 ODB compiler option). I've pushed/staged a fix for this so that C++98 should also work, though note that we are not really testing the C++98 support. Boris