From a.pasternak at mt-robot.com Fri Apr 1 07:22:14 2016 From: a.pasternak at mt-robot.com (Andreas Pasternak) Date: Fri Apr 1 07:22:27 2016 Subject: [odb-users] Index of member of composite value In-Reply-To: <20160315004246.EGroupware.Sxk_eK-tek9JPKJUqms8lZK@mail.mt-robot.com> References: <20160315004246.EGroupware.Sxk_eK-tek9JPKJUqms8lZK@mail.mt-robot.com> Message-ID: <56FE59E6.6030007@mt-robot.com> Hello all, Is it possible to make a member of a composite value an index like that? #pragma db value class Foo { #pragma db index int x; } ODB complains that I am trying to create an index on a non-persistent class. Thank you! Andreas From mne at qosmotec.com Fri Apr 1 09:49:42 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Fri Apr 1 09:50:29 2016 Subject: AW: [odb-users] Index of member of composite value In-Reply-To: <56FE59E6.6030007@mt-robot.com> References: <20160315004246.EGroupware.Sxk_eK-tek9JPKJUqms8lZK@mail.mt-robot.com> <56FE59E6.6030007@mt-robot.com> Message-ID: <7a4ea9e3a26749e089fe54138d3c58d5@QEX.qosmotec.com> Hi Andreas, see the ODB manual, section 14.7 "Index Definition Pragmas" (at bottom of page 273): "It is possible to define an index on a member that is of a composite value type or on some of its nested members." #pragma db value struct point { int x; int y; int z; }; #pragma db object class object { // An index that includes all of the p1?s nested members. // #pragma db index point p1; point p2; // An index that includes only p2.x and p2.y. // #pragma db index("p2_xy_i") members(p2.x, p2.y) }; Regards, Marcel -----Urspr?ngliche Nachricht----- Von: odb-users-bounces@codesynthesis.com [mailto:odb-users-bounces@codesynthesis.com] Im Auftrag von Andreas Pasternak Gesendet: Freitag, 1. April 2016 13:22 An: odb-users@codesynthesis.com Betreff: [odb-users] Index of member of composite value Hello all, Is it possible to make a member of a composite value an index like that? #pragma db value class Foo { #pragma db index int x; } ODB complains that I am trying to create an index on a non-persistent class. Thank you! Andreas From mne at qosmotec.com Fri Apr 1 10:53:47 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Fri Apr 1 10:54:34 2016 Subject: [odb-users] session_required exception when using custom session Message-ID: Hi all, I am using a custom session implementation and in general it is working well. However, today I encountered a session_required exception when I tried to load an object loading view. In the generated code I see that in the init method of the corresponding view_traits_impl class there is a code block like this: if (!session::has_current ()) throw session_required (); So of course this will always throw since I do not use ODBs session implementation. I did, however, provide the --session-type command line option. I also see my custom implementation being used at other occasions. What made me think was that the ODB manual does not include a has_current method as a requirement for a custom session implementation. So even if the type was substituted with my own implementation it would not work. Am I missing something? Regards, Marcel From andrei.i.ivanov at commandus.com Fri Apr 1 08:56:21 2016 From: andrei.i.ivanov at commandus.com (Andrei Ivanov) Date: Fri Apr 1 13:11:47 2016 Subject: [odb-users] is_default_instance Message-ID: Hi All, What meaning of is_default_instance column is? Best regards, Andrei From a.pasternak at mt-robot.com Fri Apr 1 15:21:07 2016 From: a.pasternak at mt-robot.com (Andreas Pasternak MT-Robot AG) Date: Fri Apr 1 15:20:38 2016 Subject: AW: [odb-users] Index of member of composite value In-Reply-To: <56FE59E6.6030007@mt-robot.com> References: <20160315004246.EGroupware.Sxk_eK-tek9JPKJUqms8lZK@mail.mt-robot.com, 56FE59E6.6030007@mt-robot.com> Message-ID: <20160401212107.EGroupware.hSuoGodnqrAlajUznZa7JBP@mail.mt-robot.com> Thank you! I guess I missed this part. The problem is that I have autogenerated code. So it is going to be hard to implement this syntax. It would be great if I could specify the index pragma inside the composite value class, as I described below, because there I know which member should be indexed, while my code generator doesn't have this information at the object class level. Does someone know if this feature is implemented in the next upcoming release? Best regards, Andreas ----------------original message----------------- From: Marcel Nehring [mne@qosmotec.com ] To: odb-users@codesynthesis.com Date: Fri, 1 Apr 2016 13:49:42 +0000 ------------------------------------------------- > Hi Andreas, > > see the ODB manual, section 14.7 "Index Definition Pragmas" (at > bottom of page 273): > > "It is possible to define an index on a member that is of a > composite value type or on some of its nested members." > > #pragma db value > struct point > { > int x; > int y; > int z; > }; > > #pragma db object > class object > { > // An index that includes all of the p1?s nested members. > // > #pragma db index > point p1; > point p2; > // An index that includes only p2.x and p2.y. > // > #pragma db index("p2_xy_i") members(p2.x, p2.y) }; > > Regards, > Marcel > > -----Urspr?ngliche Nachricht----- > Von: odb-users-bounces@codesynthesis.com > [mailto:odb-users-bounces@codesynthesis.com ] Im Auftrag von > Andreas Pasternak > Gesendet: Freitag, 1. April 2016 13:22 > An: odb-users@codesynthesis.com Betreff: [odb-users] Index of > member of composite value > > Hello all, > > Is it possible to make a member of a composite value an index like that? > > #pragma db value > class Foo { > #pragma db index > int x; > } > ODB complains that I am trying to create an index on a non-persistent class. > > > Thank you! > > Andreas > > > -- MT Robot AG Riedstrasse 16 CH-4222 Zwingen Tel. - +41 (0)61 775 20 20 Direkt - +41 (0)61 775 20 26 Mobile - +41 (0)76 489 21 16 Fax - +41 (0)61 775 20 21 Email - [ mailto:a.pasternak@mt-robot.com %20%20 -> a.pasternak@mt-robot.com ] Web - www.mt-robot.com Diese E-Mail k?nnte vertrauliche und/oder rechtlich gesch?tzte Informationen enthalten.Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrt?mlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail sind nicht gestattet. This e-mail may contain confidential and/or privileged information. If you are not the intended recipien From mne at qosmotec.com Mon Apr 4 04:25:34 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Mon Apr 4 04:26:23 2016 Subject: AW: AW: [odb-users] Index of member of composite value In-Reply-To: <20160401212107.EGroupware.hSuoGodnqrAlajUznZa7JBP@mail.mt-robot.com> References: <20160315004246.EGroupware.Sxk_eK-tek9JPKJUqms8lZK@mail.mt-robot.com, 56FE59E6.6030007@mt-robot.com> <20160401212107.EGroupware.hSuoGodnqrAlajUznZa7JBP@mail.mt-robot.com> Message-ID: <33e68ff4866c47908b24a0929fe70d69@QEX.qosmotec.com> Hi Andreas, would specifying this in a separate file be an option? ODB pragmas can be in their own files if you specify to which object they belong (named pragmas). You could then put this in the same file as your composite value definition. "While keeping the C++ declarations and database declarations close together eases maintenance and increases readability, we can also place them in different parts of the same header file or even factor them to a separate file. To achieve this we use the so called named pragmas. Unlike positioned pragmas, named pragmas explicitly specify the C++ declaration to which they apply by adding the declaration name after the pragma qualifier." Following the example from my previous mail: #pragma db object(object) #pragma db member(object::p1) index #pragma db index(object::"p2_xy_i") members(p2.x, p2.y) Regards, Marcel From boris at codesynthesis.com Mon Apr 4 09:47:04 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 4 09:46:55 2016 Subject: [odb-users] Index of member of composite value In-Reply-To: <20160401212107.EGroupware.hSuoGodnqrAlajUznZa7JBP@mail.mt-robot.com> References: <20160315004246.EGroupware.Sxk_eK-tek9JPKJUqms8lZK@mail.mt-robot.com, 56FE59E6.6030007@mt-robot.com> <20160401212107.EGroupware.hSuoGodnqrAlajUznZa7JBP@mail.mt-robot.com> Message-ID: Hi Andreas, Andreas Pasternak MT-Robot AG writes: > I guess I missed this part. The problem is that I have autogenerated > code. So it is going to be hard to implement this syntax. It would > be great if I could specify the index pragma inside the composite > value class, as I described below, because there I know which member > should be indexed, while my code generator doesn't have this > information at the object class level. > > Does someone know if this feature is implemented in the next upcoming > release? No, there is no such feature. The problem is composite value types don't have associated tables. They are "instantiated" into the tables of the objects they are used in, with their column names often adjusted, etc. While database indexes are always defined on tables. So to implement something like this we would have to have something like an "index template" that also gets instantiated into the table. We will also have to have an "index name template" since nothing prevents you from using the same composite type twice in the same object. As you can see, this gets hairy very quickly. As Marcel suggested, the best way is to add the index pragmas out of generated classes. You must already be doing this to map objects. Boris From boris at codesynthesis.com Mon Apr 4 09:49:05 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 4 09:48:56 2016 Subject: [odb-users] is_default_instance In-Reply-To: References: Message-ID: Hi Andrei, Andrei Ivanov writes: > What meaning of is_default_instance column is? ODB doesn't have any pre-defined column with this name. So it must be one of your data members. Boris From boris at codesynthesis.com Mon Apr 4 10:46:24 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 4 10:46:16 2016 Subject: [odb-users] session_required exception when using custom session In-Reply-To: References: Message-ID: Hi Marcel, Marcel Nehring writes: > if (!session::has_current ()) > throw session_required (); > > So of course this will always throw since I do not use ODBs session > implementation. I did, however, provide the --session-type command > line option. I also see my custom implementation being used at other > occasions. Yes, that's a bug. I've fixed it by adding to the custom session interface: static bool _has_cache (); "The _has_cache() function shall return true if the object cache is in effect in the current thread." This function is now called by the object loading view implementation. Would you like a pre-release? Thanks, Boris From mne at qosmotec.com Mon Apr 4 12:12:38 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Mon Apr 4 12:13:25 2016 Subject: AW: [odb-users] session_required exception when using custom session In-Reply-To: References: Message-ID: <8314a73f632942799261d83a2ba2d403@QEX.qosmotec.com> Hi Boris, thank you very much for your quick response! Yes, if you would be so nice to provide a pre-release that would be great! Regards, Marcel From andrei.i.ivanov at commandus.com Mon Apr 4 20:56:47 2016 From: andrei.i.ivanov at commandus.com (Andrei Ivanov) Date: Tue Apr 5 11:36:41 2016 Subject: [odb-users] is_default_instance In-Reply-To: References: Message-ID: Ahm, Thanks! I just update grpc and ODB libraries, which generates classes for GRPC adds a new member. 2016-04-04 22:49 GMT+09:00 Boris Kolpackov : > Hi Andrei, > > Andrei Ivanov writes: > > > What meaning of is_default_instance column is? > > ODB doesn't have any pre-defined column with this name. So it must be > one of your data members. > > Boris > -- Best regards, Andrei Ivanov Software developer tel:+7 (411) 242-3685 tel:+7 (914) 104-0619 fax:+1 (801) 880-0903 http://www.facebook.com/andrei.i.ivanov http://twitter.com/#!/commandus http://commandus.com/ jid:andrei.i.ivanov@gmail.com Y!:ensen_andy skype:commanduss From a.pasternak at mt-robot.com Wed Apr 6 08:26:35 2016 From: a.pasternak at mt-robot.com (Andreas Pasternak) Date: Wed Apr 6 08:26:47 2016 Subject: [odb-users] Setting index length Message-ID: <5705007B.5080305@mt-robot.com> Hello all, I created indexes for my tables using ODB. Now I get the following error: what(): 1170 (42000): BLOB/TEXT column 'd_frame_id' used in key specification without a key length This means that I have to specify the length of the corresponding index. I have the following code: #pragma db index("mt::ps::TestData_idx") \ member(d_.m_test_) /std::string*/ \ ) But where do I specify with this syntax length? Thank you! Andreas From boris at codesynthesis.com Wed Apr 6 10:06:49 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 6 10:06:49 2016 Subject: [odb-users] session_required exception when using custom session In-Reply-To: <8314a73f632942799261d83a2ba2d403@QEX.qosmotec.com> References: <8314a73f632942799261d83a2ba2d403@QEX.qosmotec.com> Message-ID: Hi Marcel, Marcel Nehring writes: > Yes, if you would be so nice to provide a pre-release that would be great! Here you go: http://codesynthesis.com/~boris/tmp/odb/pre-release/a6/ Boris From odb at a-cunningham.com Wed Apr 6 16:16:20 2016 From: odb at a-cunningham.com (Andrew Cunningham) Date: Wed Apr 6 16:16:32 2016 Subject: [odb-users] SQLite writing during select Message-ID: I am doing some performance tuning (profiling opening a 9GB file) and I am confused as to why appears SQLite is writing to the database while essentially I am reading the database file while loading a std::vector > Any insights would be helpful. odb-sqlite-2.4-vc12.dll!winWrite(sqlite3_file * id, const void * pBuf, int amt, __int64 offset) Line 36373 C odb-sqlite-2.4-vc12.dll!vdbeSorterListToPMA(SortSubtask * pTask, SorterList * pList) Line 80821 C odb-sqlite-2.4-vc12.dll!vdbeSorterFlushPMA(VdbeSorter * pSorter) Line 80961 C > odb-sqlite-2.4-vc12.dll!sqlite3VdbeExec(Vdbe * p) Line 76730 C odb-sqlite-2.4-vc12.dll!sqlite3Step(Vdbe * p) Line 70730 C odb-sqlite-2.4-vc12.dll!sqlite3_step(sqlite3_stmt * pStmt) Line 70791 From tony at rightsoft.com.au Wed Apr 6 21:50:54 2016 From: tony at rightsoft.com.au (Tony Rietwyk) Date: Wed Apr 6 21:51:16 2016 Subject: [odb-users] SQLite writing during select In-Reply-To: References: Message-ID: <004401d1906f$ec6756a0$c53603e0$@rightsoft.com.au> Hi Andrew, It looks like SQLite is using temporary tables to sort the items. It should have settings to redirect the sorting to another location, if the database is read-only. Hope that helps, Tony > Sent: Thursday, 7 April 2016 6:16 AM > > I am doing some performance tuning (profiling opening a 9GB file) and I am > confused as to why appears SQLite is writing to the database while > essentially I am reading the database file while loading a > std::vector > > > Any insights would be helpful. > > > > odb-sqlite-2.4-vc12.dll!winWrite(sqlite3_file * id, const void * pBuf, > int amt, __int64 offset) Line 36373 C > odb-sqlite-2.4-vc12.dll!vdbeSorterListToPMA(SortSubtask * pTask, > SorterList * pList) Line 80821 C > odb-sqlite-2.4-vc12.dll!vdbeSorterFlushPMA(VdbeSorter * pSorter) Line > 80961 C > > odb-sqlite-2.4-vc12.dll!sqlite3VdbeExec(Vdbe * p) Line 76730 C > odb-sqlite-2.4-vc12.dll!sqlite3Step(Vdbe * p) Line 70730 C > odb-sqlite-2.4-vc12.dll!sqlite3_step(sqlite3_stmt * pStmt) Line > 70791 From andrew at a-cunningham.com Wed Apr 6 12:19:12 2016 From: andrew at a-cunningham.com (Andrew Cunningham) Date: Thu Apr 7 00:39:43 2016 Subject: [odb-users] Low level SQL question Message-ID: I am doing some performance tuning (profiling opening a 9GB file) and I am confused as to why appears SQLite is writing to the database while essentially I am reading the database file while loading a std::vector > Any insights would be helpful. odb-sqlite-2.4-vc12.dll!winWrite(sqlite3_file * id, const void * pBuf, int amt, __int64 offset) Line 36373 C odb-sqlite-2.4-vc12.dll!vdbeSorterListToPMA(SortSubtask * pTask, SorterList * pList) Line 80821 C odb-sqlite-2.4-vc12.dll!vdbeSorterFlushPMA(VdbeSorter * pSorter) Line 80961 C > odb-sqlite-2.4-vc12.dll!sqlite3VdbeExec(Vdbe * p) Line 76730 C odb-sqlite-2.4-vc12.dll!sqlite3Step(Vdbe * p) Line 70730 C odb-sqlite-2.4-vc12.dll!sqlite3_step(sqlite3_stmt * pStmt) Line 70791 Andrew From andrew at a-cunningham.com Wed Apr 6 18:43:35 2016 From: andrew at a-cunningham.com (Andrew Cunningham) Date: Thu Apr 7 00:39:43 2016 Subject: [odb-users] SQLIte issue Message-ID: After more investigation I found that SQLite is writing to a PMA cache file. I gather the PMA buffer should be the size of the main cache, but there is what I think is a bug in SQLite as follows... When you set the main cache using the style *PRAGMA **schema.**cache_size = -**kibibytes* *;* It appears the code that sets up the PMA cache is not understanding that this value can be -ve and defaults to a small value. In function sqlite3VdbeSorterInit .... .... mxCache = db->aDb[0].pSchema->cache_size; if( mxCache<(int)szPma ) mxCache = (int)szPma; pSorter->mxPmaSize = MIN((i64)mxCache*pgsz, SQLITE_MAX_PMASZ); .... From boris at codesynthesis.com Thu Apr 7 11:39:55 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 7 11:39:44 2016 Subject: [odb-users] Setting index length In-Reply-To: <5705007B.5080305@mt-robot.com> References: <5705007B.5080305@mt-robot.com> Message-ID: Hi Andreas, Andreas Pasternak writes: > what(): 1170 (42000): BLOB/TEXT column 'd_frame_id' used in key > specification without a key length > > This means that I have to specify the length of the corresponding index. > > [...] > > But where do I specify with this syntax length? It's all in the manual, specifically, Section 17.6, "MySQL Index Definitions". Boris From boris at codesynthesis.com Thu Apr 7 11:41:30 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 7 11:41:19 2016 Subject: [odb-users] SQLIte issue In-Reply-To: References: Message-ID: Hi Andrew, Andrew Cunningham writes: > After more investigation I found that SQLite is writing to a PMA cache > file. I gather the PMA buffer should be the size of the main cache, but > there is what I think is a bug in SQLite as follows... Probably a good idea to report/confirm on the SQLite mailing list. Boris From andrew at a-cunningham.com Thu Apr 7 12:37:41 2016 From: andrew at a-cunningham.com (Andrew Cunningham) Date: Fri Apr 8 10:22:54 2016 Subject: [odb-users] SQLIte issue In-Reply-To: References: Message-ID: Done On Thu, Apr 7, 2016 at 8:41 AM, Boris Kolpackov wrote: > Hi Andrew, > > Andrew Cunningham writes: > > > After more investigation I found that SQLite is writing to a PMA cache > > file. I gather the PMA buffer should be the size of the main cache, but > > there is what I think is a bug in SQLite as follows... > > Probably a good idea to report/confirm on the SQLite mailing list. > > Boris > From sexymimi64 at gmail.com Mon Apr 11 08:06:14 2016 From: sexymimi64 at gmail.com (=?UTF-8?Q?Michael_Mart=C3=ADn_Moro?=) Date: Mon Apr 11 08:06:46 2016 Subject: [odb-users] making query with nested relationships Message-ID: Greetings, I want to make a rather complex query, and I'm wondering how to put it in ODB's terms. I have these objects: Event has one SubjectDetails SubjectDetails has many StudentGroups StudentGroup has a degree and course attributes. I need to fetch all the Events who are related to StudentGroups with a given degree and course attribute. Basically, I would need something such as: odb::pgsql::query::subject_details->student_group->degree == 1 && odb::pgsql::query::subject_details->student_group->course == 2 But I haven't found a way to write such requests yet. I'm not even sure it's possible, even using Views. Maybe I'm not looking in the right direction. Any help with that would be very welcome. -- *Micha?l Mart?n Moro* { Epitech. Tek4 } { UCA Cad?z - Computer Engineering } From mne at qosmotec.com Mon Apr 11 08:45:06 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Mon Apr 11 08:45:53 2016 Subject: AW: [odb-users] making query with nested relationships In-Reply-To: References: Message-ID: <7c7496a48ccf40b88087c1c6de38888a@QEX.qosmotec.com> Hi Micha?l, one way that should work is to use an object loading view. There you can specify all three corresponding types of objects (i.e. Event, SubjectDetails and StudentGroup). In your query to load the events you can then filter on each object type separately. It could look like: #pragma db view object(StudentGroup) object(SubjectDetails inner) object(Event inner) struct YourView { Event *event; }; Then the query would be something like: odb::pgsql::query::StudentGroup::degree == 1 && odb::pgsql::query::StudentGroup::course == 2 When iterating the results you can use the 'event' member of the view to get the matching event. Have a look at the manual, section 10 (especially subsections 10.2 and 10.5) for the details. Regards, Marcel -----Urspr?ngliche Nachricht----- Von: odb-users-bounces@codesynthesis.com [mailto:odb-users-bounces@codesynthesis.com] Im Auftrag von Michael Mart?n Moro Gesendet: Montag, 11. April 2016 14:06 An: odb-users@codesynthesis.com Betreff: [odb-users] making query with nested relationships Greetings, I want to make a rather complex query, and I'm wondering how to put it in ODB's terms. I have these objects: Event has one SubjectDetails SubjectDetails has many StudentGroups StudentGroup has a degree and course attributes. I need to fetch all the Events who are related to StudentGroups with a given degree and course attribute. Basically, I would need something such as: odb::pgsql::query::subject_details->student_group->degree == 1 && odb::pgsql::query::subject_details->student_group->course == 2 But I haven't found a way to write such requests yet. I'm not even sure it's possible, even using Views. Maybe I'm not looking in the right direction. Any help with that would be very welcome. -- *Micha?l Mart?n Moro* { Epitech. Tek4 } { UCA Cad?z - Computer Engineering } From abv150ci at gmail.com Mon Apr 11 12:14:25 2016 From: abv150ci at gmail.com (=?UTF-8?Q?Aar=C3=B3n_Bueno_Villares?=) Date: Mon Apr 11 12:15:17 2016 Subject: [odb-users] Multiple placeholders Message-ID: Can views have more than one placeholders (?) to pass more than one parameter? For example, a "and filter" for the where clause and a group by clause, or parametrized limits, and such kind of things. From boris at codesynthesis.com Tue Apr 12 11:50:51 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 12 11:50:36 2016 Subject: [odb-users] Multiple placeholders In-Reply-To: References: Message-ID: Hi Aar?n, Aar?n Bueno Villares writes: > Can views have more than one placeholders (?) to pass more than one > parameter? For example, a "and filter" for the where clause and a group by > clause, or parametrized limits, and such kind of things. Not yet, but there are plans to support this (will have to drop C++98 support first; see below). In the meantime, the workaround is to push the final "query trailer" construction to runtime, for example: db.query (query::name == "John" + "ORDER BY" + query::age) Here is the entry in our "change management" repository for this issue: - Multiple (?) or order_by() in query condition Consider: #pragma ... query(foo.bar.not_null () && (?)) If we substitute "ORDER BY ..." for (?), then we will get "... AND ORDER BY" in the statement. We can make it work by changing && to + but then if we actually have additional conditions, that won't work. One idea: have order_by() pragma? Though we can also have LIMIT, OFFSET, etc. This should also align with ORDER BY, etc syntax in general queries. Another idea: support multiple (?) that are "filled" from multiple query() arguments (C++11 variadic template). Boris From abv150ci at gmail.com Tue Apr 12 12:55:39 2016 From: abv150ci at gmail.com (=?UTF-8?Q?Aar=C3=B3n_Bueno_Villares?=) Date: Tue Apr 12 12:56:30 2016 Subject: [odb-users] Multiple placeholders In-Reply-To: References: Message-ID: > > Not yet, but there are plans to support this (will have to drop C++98 > support > first; see below). [...] (C++11 variadic template). Not necessarily, isn't?. The ODB compiler could generate so many template parameters as ocurrences of (?) or something like that (I don't know the relationship between your "core code" and your "generated code", but I guess the placeholder management could be done on the generated code without using variadic templates, though it could be worst from a design point of view). Anyway, it doesn't need to break retrocompatibility; if a user cannot compile C++11 code, they can't use queries with multiple-placeholders, and that's all. While inventing, another idea could be adding numeric placeholders: (?0), (?1), etc, similar to those of boost::format. From mne at qosmotec.com Thu Apr 14 05:43:40 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Thu Apr 14 05:44:22 2016 Subject: [odb-users] Feature request Message-ID: <6255d9f319244b62af1ad01f61292ded@QEX.qosmotec.com> Hi Boris, this time I have a feature request. I saw that there are already variables defined holding the name of database tables odb::access::object_traits_impl< ::MyClass, id_oracle >::table_name Would it be possible to make them accessible to the user of ODB? In our code I need to lock a database table in some situations. While I can do so by using native SQL queries I currently have to manually provide the table name. If one day the name of the table changes and I forget to change my string I will only discover this at runtime. If I could delegate this work to the ODB compiler that would increase maintainability. A similar problem arises if I need to manually specify to load only a specific level of a polymorphic object. Currently I use a query condition on the typeid_ member of ODBs query class. But I have to provide the class name manually as string, which is error prone and does not include any compile time checks. If I could write something like db.query(odb::query::typeid_ == MyClass); or similar this would avoid possible runtime errors as well. What do you think? Regards, Marcel From micrsosft at live.com Tue Apr 12 20:59:14 2016 From: micrsosft at live.com (zhiganglee) Date: Thu Apr 14 08:37:42 2016 Subject: [odb-users] Using ODBC in the dynamic link library Message-ID: Multiple dynamic link library how to properly use odb. I am currently experiencing linker problems . From boris at codesynthesis.com Thu Apr 14 08:53:36 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 14 08:53:25 2016 Subject: [odb-users] Multiple placeholders In-Reply-To: References: Message-ID: Hi Aar?n, Aar?n Bueno Villares writes: > Not necessarily, isn't?. The ODB compiler could generate so many template > parameters as ocurrences of (?) or something like that (I don't know the > relationship between your "core code" and your "generated code", but I > guess the placeholder management could be done on the generated code > without using variadic templates, though it could be worst from a design > point of view). Yes, you are wrong ;-). The query() function is part of the database class and is not auto-generated. > Anyway, it doesn't need to break retrocompatibility; if a user cannot > compile C++11 code, they can't use queries with multiple-placeholders, > and that's all. There are already a thousand little knobs like these in ODB (look for example at smart pointer support) and I would much prefer not to add yet another one. We are planning to drop C++98 after the next release anyway. > While inventing, another idea could be adding numeric placeholders: (?0), > (?1), etc, similar to those of boost::format. Let's get multiple placeholders working first. Boris From boris at codesynthesis.com Fri Apr 15 12:59:47 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Apr 15 12:59:37 2016 Subject: [odb-users] Feature request In-Reply-To: <6255d9f319244b62af1ad01f61292ded@QEX.qosmotec.com> References: <6255d9f319244b62af1ad01f61292ded@QEX.qosmotec.com> Message-ID: Hi Marcel, Marcel Nehring writes: > I saw that there are already variables defined holding the name of database tables > > odb::access::object_traits_impl< ::MyClass, id_oracle >::table_name > > Would it be possible to make them accessible to the user of ODB? You already can as odb::object_traits::table_name (it derives from *_impl). While it is not documented, you can rely on it, I don't think we will already call it anything else or remove it. > A similar problem arises if I need to manually specify to load only a > specific level of a polymorphic object. Currently I use a query condition on > the typeid_ member of ODBs query class. But I have to provide the class name > manually as string, which is error prone and does not include any compile > time checks. If I could write something like > > db.query(odb::query::typeid_ == MyClass); > > or similar this would avoid possible runtime errors as well. Again, I believe you can already access it like this: odb::object_traits::info.discriminator Boris From adanesh at noornet.net Mon Apr 18 01:35:27 2016 From: adanesh at noornet.net (=?utf-8?B?2LnZhNuMINiv2KfZhti0?=) Date: Mon Apr 18 01:35:50 2016 Subject: [odb-users] Re: odb-users Digest, Vol 68, Issue 12 Message-ID: <1460957727484.6290@noornet.net> Hi Boris, I couldn't find 'table_name' in 'odb::object_traits' class in my project. Also this class doesn't have 'info' member. What's wrong? I'm using odb 2.4.0. In addition, is there any way to find out the name of the relation table and the name of the fields in that table? For example, in my class I have a member like this: QList> m_otherClassList; How can I access to the name of them in code? Ali ---------------------------------------------------------------------- Date: Fri, 15 Apr 2016 18:59:47 +0200 From: Boris Kolpackov Subject: Re: [odb-users] Feature request To: Marcel Nehring Cc: "odb-users@codesynthesis.com" Message-ID: Content-Type: text/plain; charset=us-ascii Hi Marcel, Marcel Nehring writes: > I saw that there are already variables defined holding the name of database tables > > odb::access::object_traits_impl< ::MyClass, id_oracle >::table_name > > Would it be possible to make them accessible to the user of ODB? You already can as odb::object_traits::table_name (it derives from *_impl). While it is not documented, you can rely on it, I don't think we will already call it anything else or remove it. > A similar problem arises if I need to manually specify to load only a > specific level of a polymorphic object. Currently I use a query condition on > the typeid_ member of ODBs query class. But I have to provide the class name > manually as string, which is error prone and does not include any compile > time checks. If I could write something like > > db.query(odb::query::typeid_ == MyClass); > > or similar this would avoid possible runtime errors as well. Again, I believe you can already access it like this: odb::object_traits::info.discriminator Boris ------------------------------ From adanesh at noornet.net Mon Apr 18 01:51:02 2016 From: adanesh at noornet.net (=?utf-8?B?2LnZhNuMINiv2KfZhti0?=) Date: Mon Apr 18 01:51:11 2016 Subject: [odb-users] Feature request In-Reply-To: <1460957727484.6290@noornet.net> References: <1460957727484.6290@noornet.net> Message-ID: <1460958662095.66662@noornet.net> I'm sorry! I forgot to change the subject. ________________________________________ From: ??? ???? Sent: Monday, April 18, 2016 10:05 AM To: odb-users@codesynthesis.com Subject: Re: odb-users Digest, Vol 68, Issue 12 Hi Boris, I couldn't find 'table_name' in 'odb::object_traits' class in my project. Also this class doesn't have 'info' member. What's wrong? I'm using odb 2.4.0. In addition, is there any way to find out the name of the relation table and the name of the fields in that table? For example, in my class I have a member like this: QList> m_otherClassList; How can I access to the name of them in code? Ali ---------------------------------------------------------------------- Date: Fri, 15 Apr 2016 18:59:47 +0200 From: Boris Kolpackov Subject: Re: [odb-users] Feature request To: Marcel Nehring Cc: "odb-users@codesynthesis.com" Message-ID: Content-Type: text/plain; charset=us-ascii Hi Marcel, Marcel Nehring writes: > I saw that there are already variables defined holding the name of database tables > > odb::access::object_traits_impl< ::MyClass, id_oracle >::table_name > > Would it be possible to make them accessible to the user of ODB? You already can as odb::object_traits::table_name (it derives from *_impl). While it is not documented, you can rely on it, I don't think we will already call it anything else or remove it. > A similar problem arises if I need to manually specify to load only a > specific level of a polymorphic object. Currently I use a query condition on > the typeid_ member of ODBs query class. But I have to provide the class name > manually as string, which is error prone and does not include any compile > time checks. If I could write something like > > db.query(odb::query::typeid_ == MyClass); > > or similar this would avoid possible runtime errors as well. Again, I believe you can already access it like this: odb::object_traits::info.discriminator Boris ------------------------------ From dieter.govaerts at bricsys.com Mon Apr 18 08:54:53 2016 From: dieter.govaerts at bricsys.com (dieter.govaerts@bricsys.com) Date: Mon Apr 18 08:55:00 2016 Subject: [odb-users] Drop table in schema migration Message-ID: <1460984093.56442985@apps.rackspace.com> Hello, I would like to recreate a set of classes to include polymorphism using db migration. There is no need to maintain the data so I would just have increased the version, drop the tables, increase the version, recreate the classes with polymorphism. I see however no documented way to immediately drop the classes/tables from the db. Simply omitting the the header from the "odb --generate-schema-only --schema-format separate --at-once" command didn't work. I'm working on a SQLite db with schema creation in C++. Best regards, Dieter Govaerts From tony.lin at ringcentral.com Sat Apr 16 03:03:28 2016 From: tony.lin at ringcentral.com (Tony Lin) Date: Mon Apr 18 09:24:24 2016 Subject: [odb-users] Failed to Build odb with Clang and libc++ Message-ID: Hi Sir/Madam, I tried to build odb with clang and the STL libc++ as below steps and failed for checking pthread. Can you please help look to this? 1. Build Android toolchain ./make-standalone-toolchain.sh --verbose --platform=android-23 --toolchain=arm-linux-androideabi-4.9 --use-llvm --stl=libc++ --install-dir=/Users/tony.lin/Library/Android/android-ndk-r11c/mytoolchains --ndk-dir=/Users/tony.lin/Library/Android/android-ndk-r11c 2. Configure and Make ./configure CC=clang CXX=clang++ CXXFLAGS="-Os -pthread --std=c++11 --stdlib=libc++" --disable-shared --host=arm-linux-androideabi --prefix=`pwd`/../install; make; ? checking whether the clang++ linker (/Users/tony.lin/Library/Android/android-ndk-r11c/mytoolchains/arm-linux-androideabi/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate configure: creating ./config.lt config.lt: creating libtool checking for the pthreads library -lpthreads... no checking for the pthreads library -lpthread... no checking whether pthreads work without any flags... no checking whether pthreads work with -Kthread... no checking whether pthreads work with -kthread... no checking for the pthreads library -llthread... no checking whether pthreads work with -pthread... no checking whether pthreads work with -pthreads... no checking whether pthreads work with -mthreads... no checking whether pthreads work with --thread-safe... no checking whether pthreads work with -mt... no checking for pthread-config... no configure: error: thread support not available; use --disable-threads to force single-threaded mode Br, Tony Lin From jhondoe2009 at gmail.com Sun Apr 17 16:35:40 2016 From: jhondoe2009 at gmail.com (John Smith) Date: Mon Apr 18 09:24:25 2016 Subject: [odb-users] Error Message-ID: Hi, when I am "Build and install ODB compiler for linux" give me the next error: "checking whether g++ supports plugins... no configure: error: g++ does not support plugins; reconfigure GCC with --enable-plugin" Could you explain how to do it, please? I only tried to install msigna in linux. And I was doing the nexts instructions: [image: Im?genes integradas 1] The error appear in : Build and install ODB compiler for linux, in the sentence: ./configure Thanks Jhon -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 48020 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20160417/da7c816e/image-0001.png From boris at codesynthesis.com Mon Apr 18 10:14:53 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 18 10:15:02 2016 Subject: [odb-users] Failed to Build odb with Clang and libc++ In-Reply-To: References: Message-ID: Hi Tony, Tony Lin writes: > ./configure CC=clang CXX=clang++ CXXFLAGS="-Os -pthread ... > > checking for the pthreads library -lpthreads... no > checking for the pthreads library -lpthread... no > checking whether pthreads work without any flags... no > checking whether pthreads work with -Kthread... no > checking whether pthreads work with -kthread... no > checking for the pthreads library -llthread... no > checking whether pthreads work with -pthread... no > checking whether pthreads work with -pthreads... no > checking whether pthreads work with -mthreads... no > checking whether pthreads work with --thread-safe... no > checking whether pthreads work with -mt... no > checking for pthread-config... no > configure: error: thread support not available; use --disable-threads to force single-threaded mode First try to remove -pthread from CXXFLAGS. ODB will try to figure out which option to use automatically. If that doesn't help, look into config.log for details on why the thread test fails. Boris From boris at codesynthesis.com Mon Apr 18 10:17:44 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 18 10:17:53 2016 Subject: [odb-users] Error In-Reply-To: References: Message-ID: Hi John, John Smith writes: > "checking whether g++ supports plugins... no > configure: error: g++ does not support plugins; reconfigure GCC with > --enable-plugin" > > Could you explain how to do it, please? See the accompanying INSTALL file. > I only tried to install msigna in linux. And I was doing the nexts > instructions: > > [image: Im?genes integradas 1] Don't post images of your errors to this mailing list. See the posting guidelines for details: http://codesynthesis.com/support/posting-guidelines.xhtml Boris From boris at codesynthesis.com Mon Apr 18 10:25:55 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 18 10:26:04 2016 Subject: [odb-users] Feature request In-Reply-To: References: <6255d9f319244b62af1ad01f61292ded@QEX.qosmotec.com> Message-ID: Hi, Boris Kolpackov writes: > odb::object_traits::table_name > odb::object_traits::info.discriminator Correction, these should be: odb::object_traits_impl::table_name odb::object_traits_impl::info.discriminator Where DB_ID can be odb::id_common if you are only using a single database. Otherwise, you have to specify the actual database id: namespace odb { enum database_id { id_mysql, id_sqlite, id_pgsql, id_oracle, id_mssql, id_common }; } Boris From boris at codesynthesis.com Mon Apr 18 10:29:15 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 18 10:29:25 2016 Subject: [odb-users] Feature request In-Reply-To: <1460958662095.66662@noornet.net> References: <1460957727484.6290@noornet.net> <1460958662095.66662@noornet.net> Message-ID: Hi, > I couldn't find 'table_name' in 'odb::object_traits' class > in my project. Yes, that was incorrect. I sent a correction to the original thread. > In addition, is there any way to find out the name of the relation > table and the name of the fields in that table? For example, in my > class I have a member like this: > > QList> m_otherClassList; > > How can I access to the name of them in code? No, this information is not (easily) available from the generated code. Boris From boris at codesynthesis.com Mon Apr 18 10:40:46 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 18 10:40:56 2016 Subject: [odb-users] Drop table in schema migration In-Reply-To: <1460984093.56442985@apps.rackspace.com> References: <1460984093.56442985@apps.rackspace.com> Message-ID: Hi Dieter, dieter.govaerts@bricsys.com writes: > I would like to recreate a set of classes to include polymorphism using db > migration. There is no need to maintain the data so I would just have > increased the version, drop the tables, increase the version, recreate the > classes with polymorphism. I see however no documented way to immediately > drop the classes/tables from the db. Simply omitting the the header from the > "odb --generate-schema-only --schema-format separate --at-once" command > didn't work. I am not sure what you mean by "immediately drop the classes/tables from the db". Also, are the old and new classes use the same table names? A concrete example would really help with understanding of what you are trying to achieve. Boris From dieter.govaerts at bricsys.com Mon Apr 18 10:58:21 2016 From: dieter.govaerts at bricsys.com (Dieter Govaerts) Date: Mon Apr 18 10:58:29 2016 Subject: [odb-users] Drop table in schema migration In-Reply-To: References: <1460984093.56442985@apps.rackspace.com> Message-ID: <1460991501.929214336@apps.rackspace.com> Hello Boris, On Monday, 18 April, 2016 16:40, "Boris Kolpackov" said: > dieter.govaerts@bricsys.com writes: > >> I would like to recreate a set of classes to include polymorphism using db >> migration. There is no need to maintain the data so I would just have >> increased the version, drop the tables, increase the version, recreate the >> classes with polymorphism. I see however no documented way to immediately >> drop the classes/tables from the db. Simply omitting the the header from the >> "odb --generate-schema-only --schema-format separate --at-once" command >> didn't work. > > I am not sure what you mean by "immediately drop the classes/tables from the > db". Also, are the old and new classes use the same table names? A concrete > example would really help with understanding of what you are trying to > achieve. I meant to actually drop the table from the db as opposed to soft-delete as described in 13.4 of the manual. The new classes and the old classes will use the same names. I currently have following classes in the db: - Building - Story These classes are unrelated (polymorphic wise). I would like to replace it with the following hierarchy: SpatialStructure ^ ^ / \ Building Story such that I can refer to either a building or a story with the ID of a SpatialStructure. As said, data migration is not important. What I wanted was to create a new version 5 which forgets the original classes as if they never existed (drop table). Then create a new version 6 with the new structure. Dieter From adanesh at noornet.net Tue Apr 19 05:37:31 2016 From: adanesh at noornet.net (=?utf-8?B?2LnZhNuMINiv2KfZhti0?=) Date: Tue Apr 19 05:37:42 2016 Subject: [odb-users] Update the id of an object which has a relation with the other object In-Reply-To: <201604181600.u3IG0BFM003385@codesynthesis.com> References: <201604181600.u3IG0BFM003385@codesynthesis.com> Message-ID: <1461058651536.26633@noornet.net> Hi Boris, I want to update the id of an object which has a relation with the other object. For example: QList> m_otherClassList; I used the method that you mentioned before. The idea was to map another special class to the same table that would allow you to change the id. Here is an outline: #pragma db object table("my_object") class my_object // You original object. { ... #pragma db id column("id") unsigned int id; }; #pragma db object table("my_object") struct my_object_id { my_object_id (unsigned int o, unsigned int n): old_id (o), new_id (n) {} #pragma db id column("id") unsigned int old_id; #pragma db column("id") unsigned int new_id; }; my_object o = ...; db.update (my_object_id (o.id, -o.id)); But in my case, because of the relation, I got the "foreign key constraint failed" error. I used odb 2.4.0 and sqlite. Can you please advice how to resolve this problem? Ali From mne at qosmotec.com Tue Apr 19 09:14:54 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Tue Apr 19 09:15:36 2016 Subject: AW: [odb-users] Feature request In-Reply-To: References: <6255d9f319244b62af1ad01f61292ded@QEX.qosmotec.com> Message-ID: <603f630d398d4010bb344c3a3e6b6ef7@QEX.qosmotec.com> Hi Boris, thanks, this seems to work. Regards, Marcel From jhondoe2009 at gmail.com Mon Apr 18 13:56:38 2016 From: jhondoe2009 at gmail.com (John Smith) Date: Tue Apr 19 09:47:13 2016 Subject: [odb-users] Error In-Reply-To: References: Message-ID: Hi, First at all thanks for your fast replay. Second, I'm sorry to post images in the question. I didn't know the rules. Third. The error that I showed you was with the steps of the "INSTALL" file. Thanks Regards 2016-04-18 16:17 GMT+02:00 Boris Kolpackov : > Hi John, > > John Smith writes: > > > "checking whether g++ supports plugins... no > > configure: error: g++ does not support plugins; reconfigure GCC with > > --enable-plugin" > > > > Could you explain how to do it, please? > > See the accompanying INSTALL file. > > > > I only tried to install msigna in linux. And I was doing the nexts > > instructions: > > > > [image: Im?genes integradas 1] > > Don't post images of your errors to this mailing list. See the posting > guidelines for details: > > http://codesynthesis.com/support/posting-guidelines.xhtml > > Boris > From tony.lin at ringcentral.com Mon Apr 18 21:59:05 2016 From: tony.lin at ringcentral.com (Tony Lin) Date: Tue Apr 19 09:47:13 2016 Subject: [odb-users] Failed to Build odb with Clang and libc++ In-Reply-To: References: Message-ID: <15AA68E6-9E85-429C-AE6C-1C28480699F6@ringcentral.com> Hi Boris, The same failed result. I checked config.log and it seems it still uses arm-linux-androideabi-g++ not clang++ and failed to check pthreads for arm-linux-androideabi-g++. Can you please help take a look? -------------- next part -------------- A non-text attachment was scrubbed... Name: config.log Type: application/octet-stream Size: 49000 bytes Desc: config.log Url : http://codesynthesis.com/pipermail/odb-users/attachments/20160419/77f9cf7b/config-0001.obj -------------- next part -------------- Br, Tony Lin > On Apr 18, 2016, at 10:14 PM, Boris Kolpackov wrote: > > Hi Tony, > > Tony Lin writes: > >> ./configure CC=clang CXX=clang++ CXXFLAGS="-Os -pthread ... >> >> checking for the pthreads library -lpthreads... no >> checking for the pthreads library -lpthread... no >> checking whether pthreads work without any flags... no >> checking whether pthreads work with -Kthread... no >> checking whether pthreads work with -kthread... no >> checking for the pthreads library -llthread... no >> checking whether pthreads work with -pthread... no >> checking whether pthreads work with -pthreads... no >> checking whether pthreads work with -mthreads... no >> checking whether pthreads work with --thread-safe... no >> checking whether pthreads work with -mt... no >> checking for pthread-config... no >> configure: error: thread support not available; use --disable-threads to force single-threaded mode > > First try to remove -pthread from CXXFLAGS. ODB will try to figure > out which option to use automatically. If that doesn't help, look into > config.log for details on why the thread test fails. > > Boris From boris at codesynthesis.com Tue Apr 19 10:01:32 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 19 10:01:41 2016 Subject: [odb-users] Drop table in schema migration In-Reply-To: <1460991501.929214336@apps.rackspace.com> References: <1460984093.56442985@apps.rackspace.com> <1460991501.929214336@apps.rackspace.com> Message-ID: Hi Dieter, Dieter Govaerts writes: > I meant to actually drop the table from the db as opposed to soft-delete as > described in 13.4 of the manual. The new classes and the old classes will > use the same names. > > I currently have following classes in the db: > - Building > - Story > These classes are unrelated (polymorphic wise). I would like to replace > it with the following hierarchy: > > SpatialStructure > ^ ^ > / \ > Building Story > > such that I can refer to either a building or a story with the ID of a > SpatialStructure. > > As said, data migration is not important. What I wanted was to create a new > version 5 which forgets the original classes as if they never existed (drop > table). Then create a new version 6 with the new structure. Thanks for clarifying this, now it makes sense. ODB tracks changes (for schema migration) based on table names. So if you replace your classes but keep the original table names, ODB will see it as changes to the old classes (you can take a look at the changelog -- it is all in terms of database schema changes, not C++ class changes). So the simplest way to achieve what you want would be to remove the old classes and assign new table names to the new one (with the db table() pragma). ODB will then drop the old table and create the new ones automatically. You could probably make the same table name approach work with some effort. For example, you could use the --omit-{drop,create} options to generate schemas (probably with different names; see --schema-name) for the new and old classes and then apply them at the right stage of the migration process. But, as you can see, this can get involved. Boris From boris at codesynthesis.com Tue Apr 19 10:09:13 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 19 10:09:23 2016 Subject: [odb-users] Failed to Build odb with Clang and libc++ In-Reply-To: <15AA68E6-9E85-429C-AE6C-1C28480699F6@ringcentral.com> References: <15AA68E6-9E85-429C-AE6C-1C28480699F6@ringcentral.com> Message-ID: Hi Tony, Tony Lin writes: > I checked config.log and it seems it still uses arm-linux-androideabi-g++ > not clang++ [...]. Can you please help take a look? I don't mind helping but I would expect you to at least make an effort to figure out what's going on. At the very beginning of config.log that you sent you can see the command line you used to run configure. You can clearly see, or rather not see, any CC or CXX options (unlike in the command line that you quoted in your email). It took me 15 seconds to spot this. Boris From boris at codesynthesis.com Tue Apr 19 10:13:39 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 19 10:13:48 2016 Subject: [odb-users] Error In-Reply-To: References: Message-ID: Hi John, John Smith writes: > The error that I showed you was with the steps of the "INSTALL" file. What INSTALL file is that? Where are you getting the instructions you showed in the image in your original email? Is this some third-party HOWTO? Boris From boris at codesynthesis.com Tue Apr 19 10:23:19 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 19 10:23:30 2016 Subject: [odb-users] Update the id of an object which has a relation with the other object In-Reply-To: <1461058651536.26633@noornet.net> References: <201604181600.u3IG0BFM003385@codesynthesis.com> <1461058651536.26633@noornet.net> Message-ID: Hi Ali, > I want to update the id of an object which has a relation with the > other object. Sounds like a job for ON UPDATE CASCADE. I think this should work: #pragma db value_options("ON UPDATE CASCADE") QList> m_otherClassList; Or, if you had a pointer instead of a container of pointers: #pragma db options("ON UPDATE CASCADE") std::shared_ptr m_otherClass; Boris From ellav at checkpoint.com Wed Apr 20 03:52:17 2016 From: ellav at checkpoint.com (Ella Vishnevsky) Date: Wed Apr 20 03:52:27 2016 Subject: [odb-users] Creating schema and adding tables without dropping data Message-ID: <4E3D0839F36EF04D988AECF0CA558E15DAFF67F6@DAG-EX10.ad.checkpoint.com> Hey, I'm using 2.3.0 version & sqlite I wanted to implement the following scenario: 1. Check if sqlite db file exists: a. Does not exist : i. Create new file with all tables that have the "db object" pragma. b. Exists: i. Add the new tables without erasing data from old tables I started with the first one, but seems that the file is not being created. This is the field : odb::database *m_db; Create function: void Init_OneDB(const std::string &_db_name, long _mode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); Implementation: m_db = new odb::sqlite::database("TEST_ONE_DB",_mode); Although the file does not exist, an empty file is not being created. a. I thought of using schema_catalog::exists(*m_db) but it returns true. b. I thought of persisting dummy entity but I get crash : terminate called after throwing an instance of 'odb::sqlite::database_exception' what(): 1 (0): no such table: person. c. I looked at the example of schema/embedded and creating it by using query on person & creating schema if exception is being caught. That worked but how can it be implemented when a file exists, but new tables should be inserted. For example : my sqlite file contains person table. If the sqlite file does not exit - > the query fails -> I reach the catch exception and use the schema_catalog::create_schema. Now I added a new table : person2. How can I "merge" it? The code will query person->see that it exits -> and won't use create_schema -> person2 will not be added. On the other hand, if I always use create_schema - I will delete all my data. m_db = new odb::sqlite::database("TEST_ONE_DB",_mode); //if (odb::schema_catalog::exists(*m_db)) //{ //} typedef odb::query query; typedef odb::result result; odb::transaction t (m_db->begin ()); try { m_db->query (false); } catch(const odb::exception& e) { std::cout << "***** CREATING SCHEMA ****** " << std::endl; schema_catalog::create_schema (*m_db); } t.commit(); From boris at codesynthesis.com Thu Apr 21 11:53:41 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 21 11:53:51 2016 Subject: [odb-users] Creating schema and adding tables without dropping data In-Reply-To: <4E3D0839F36EF04D988AECF0CA558E15DAFF67F6@DAG-EX10.ad.checkpoint.com> References: <4E3D0839F36EF04D988AECF0CA558E15DAFF67F6@DAG-EX10.ad.checkpoint.com> Message-ID: Hi Ella, Ella Vishnevsky writes: > I wanted to implement the following scenario: > > 1. Check if sqlite db file exists: > a. Does not exist : > i. Create new file with all tables that have the "db object" pragma. > b. Exists: > i. Add the new tables without erasing data from old tables The tricky part is to distinguish between "old" and "new" tables. There are two ways you can do this: 1. Use ODB schema evolution support (Chapter 13). This way ODB will keep track of what's new/old (and more; like making changes to old tables, etc). 2. Keep track of new tables manually by partitioning them into separate entries in the schema catalog (with the --schema-name option). You will then have to figure out "where" on the timeline your database is and apply the missing entries from the catalog (to achieve this in #1 ODB keeps track of the database schema version in a special table). Boris From SGroot at lely.com Fri Apr 22 10:06:11 2016 From: SGroot at lely.com (Steffen Groot) Date: Fri Apr 22 12:49:39 2016 Subject: [odb-users] --suppress-migration issues Message-ID: Hello all, We're using ODB on a sqlite database. I'd like to add an on_delete(cascade) constraint to an existing data model. This is not possible to migrate with sqlite, so ODB gives an error when running the pre-compiler. So, in this case i'd like to do the migration myself and run the compiler with the --suppress-migration option. However, I still get the error, so I'm not able to generate the new model at all. Is this a bug? I can work around the problem by doing it in 2 steps, but I guess the --supress-migration option should just suppress the error? On a slightly related note, is it possible to access the 'create table' statement that exists in the generated code? From the source I guess not, but it would be usefull in my custom migration script. (Since the alter table statement is so limited in sqlite, I want to do rename table - create new table - migrate data - remove renamed table. Would be also be a nice feature for ODB of course ;) ) Greetings, Steffen From mne at qosmotec.com Mon Apr 25 04:21:44 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Mon Apr 25 04:22:26 2016 Subject: [odb-users] Problem with session cache and weak_ptr Message-ID: Hi, I think I discovered a problem with ODB's object loading mechanism in conjunction with weak_ptr. I am using a custom session implementation so that my session's cache behaves a bit different from ODB's. Therefore it might happen, that I have an object in my cache that references another object via a weak_ptr member. If the pointee goes out of scope so that the weak_ptr expires I run into problems when loading the pointing object. The pointing object is still in my cache, so ODB correctly gets the instance from there. I then see, that ODB asks the cache for the (already expired) pointee. The cache cannot provide it, so I see ODB inserting it into the cache. After loading finishes, however, the weak_ptr member is still empty. Both objects correctly exist in my cache but the link is missing/invalid. Looks like ODB does not (re)set the weak_ptr to the newly loaded instance. Any thoughts on this? Regards, Marcel From boris at codesynthesis.com Mon Apr 25 05:40:01 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Apr 25 05:40:11 2016 Subject: [odb-users] --suppress-migration issues In-Reply-To: References: Message-ID: Hi Steffen, Steffen Groot writes: > We're using ODB on a sqlite database. I'd like to add an > on_delete(cascade) constraint to an existing data model. This is not > possible to migrate with sqlite, so ODB gives an error when running the > pre-compiler. So, in this case i'd like to do the migration myself and run > the compiler with the --suppress-migration option. However, I still get > the error, so I'm not able to generate the new model at all. Is this a > bug? > > I can work around the problem by doing it in 2 steps, but I guess the > --supress-migration option should just suppress the error? The --suppress-migration option only suppresses the generation of schema migration statements (SQL ALTER ...), it doesn't "suppress" schema migration support itself (to do that you would just remove the model version pragma). The recommended way to achieve this with schema migration is to create a new table (with on_delete(cascade)) and then migrate the data. Here is an example. Suppose this is your class at version 1: // version 1 // #pragma db object class person { ... string first; string last; }; Now you want to add on_delete(cascade): // version 2 // #pragma db object table("person") deleted(2) // Map to the old table. struct old_person { string first; string last; }; #pragma db object table("person2") class person { ... string first; string last; }; The idea here is to create a (soft-deleted) "ghost" of an old class (old_person) and use it to migrate the data to the new table. Section 13.4, "Soft Object Model Changes" has more details and an example. > On a slightly related note, is it possible to access the 'create table' > statement that exists in the generated code? From the source I guess not, > but it would be usefull in my custom migration script. Not in the generated code but you can generate them as a standalone SQL file which you can then chop and slice as you please. > (Since the alter table statement is so limited in sqlite, I want to do > rename table - create new table - migrate data - remove renamed table. > Would be also be a nice feature for ODB of course ;) ) Yes, maybe in the future. The concern is the complexity/reliability. Also, hopefully, SQLite folks will improve their ALTER support in the next major version. Boris From adanesh at noornet.net Tue Apr 26 01:21:20 2016 From: adanesh at noornet.net (=?utf-8?B?2LnZhNuMINiv2KfZhti0?=) Date: Tue Apr 26 01:21:33 2016 Subject: [odb-users] Update the id of an object which has a relation with the other object In-Reply-To: References: <201604181600.u3IG0BFM003385@codesynthesis.com> <1461058651536.26633@noornet.net>, Message-ID: <1461648080690.60594@noornet.net> Hi Boris, > Sounds like a job for ON UPDATE CASCADE. I think this should work: > #pragma db value_options("ON UPDATE CASCADE") > QList> m_otherClassList; It doesn't work for me. Error message: 1: near "UPDATE": syntax error I checked the generated query. I think it is incorrect. CREATE TABLE "TagIndex_keywords" ( "object_id" INTEGER NOT NULL, "index" INTEGER NOT NULL, "value" INTEGER NULL ON UPDATE CASCADE, CONSTRAINT "object_id_fk" FOREIGN KEY ("object_id") REFERENCES "TagIndex" ("id") ON DELETE CASCADE, CONSTRAINT "value_fk" FOREIGN KEY ("value") REFERENCES "KeywordIndex" ("id") DEFERRABLE INITIALLY DEFERRED) Ali ________________________________________ From: Boris Kolpackov Sent: Tuesday, April 19, 2016 6:53 PM To: ??? ???? Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Update the id of an object which has a relation with the other object Hi Ali, > I want to update the id of an object which has a relation with the > other object. Sounds like a job for ON UPDATE CASCADE. I think this should work: #pragma db value_options("ON UPDATE CASCADE") QList> m_otherClassList; Or, if you had a pointer instead of a container of pointers: #pragma db options("ON UPDATE CASCADE") std::shared_ptr m_otherClass; Boris From boris at codesynthesis.com Tue Apr 26 09:59:18 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 26 09:59:26 2016 Subject: [odb-users] Problem with session cache and weak_ptr In-Reply-To: References: Message-ID: Hi Marcel, Marcel Nehring writes: > I think I discovered a problem with ODB's object loading mechanism in > conjunction with weak_ptr. I am using a custom session implementation so > that my session's cache behaves a bit different from ODB's. Therefore it > might happen, that I have an object in my cache that references another > object via a weak_ptr member. If the pointee goes out of scope so that the > weak_ptr expires I run into problems when loading the pointing object. The > pointing object is still in my cache, so ODB correctly gets the instance > from there. I then see, that ODB asks the cache for the (already expired) > pointee. The cache cannot provide it, so I see ODB inserting it into the > cache. After loading finishes, however, the weak_ptr member is still > empty. Both objects correctly exist in my cache but the link is > missing/invalid. Looks like ODB does not (re)set the weak_ptr to the newly > loaded instance. Hm, that would be strange. Are you sure ODB is loading the same object as the one containing the expired weak_ptr member? If it were a different object, then that would explain the behavior you are observing. Boris From boris at codesynthesis.com Tue Apr 26 10:03:26 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Apr 26 10:03:37 2016 Subject: [odb-users] Update the id of an object which has a relation with the other object In-Reply-To: <1461648080690.60594@noornet.net> References: <201604181600.u3IG0BFM003385@codesynthesis.com> <1461058651536.26633@noornet.net> <1461648080690.60594@noornet.net> Message-ID: Hi Ali, > > Sounds like a job for ON UPDATE CASCADE. I think this should work: > > > > #pragma db value_options("ON UPDATE CASCADE") > > QList> m_otherClassList; > > "value" INTEGER NULL ON UPDATE CASCADE, > CONSTRAINT "value_fk" > FOREIGN KEY ("value") > REFERENCES "KeywordIndex" ("id") > DEFERRABLE INITIALLY DEFERRED) Yes, "ON UPDATE CASCADE" should be in the CONSTRAINT clause. I guess that's why we have the on_delete pragma ;-). I guess the two options are to manually tweak the schema to move it to the correct place or to implement the on_update pragma. I could do the latter but it will take me some time (pretty swamped at the moment). Boris From mne at qosmotec.com Tue Apr 26 11:26:58 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Tue Apr 26 11:27:39 2016 Subject: AW: [odb-users] Problem with session cache and weak_ptr In-Reply-To: References: Message-ID: <96d8d11a4c124466b9271f85f0dcdb5e@QEX.qosmotec.com> Hi Boris, > Are you sure ODB is loading the same object as the one containing the expired weak_ptr member? If it were a different object, then that would explain the behavior you are observing. Yes, I am pretty sure. What I do is load all objects with the weak_ptr member from the database, invalidate the weak_ptr, again load all objects from the database. The result is, that the weak_ptr are still expired but the objects they should point to are in my cache. I can double check and try to reproduce the problem tomorrow. I guess the problem should be reproducible with ODB's original session if I invalidate the weak_ptr manually. If this is true I could provide a test case. Regards, Marcel From Steve.Hales at garmin.com Tue Apr 26 17:26:08 2016 From: Steve.Hales at garmin.com (Hales, Steve) Date: Wed Apr 27 02:25:03 2016 Subject: [odb-users] Specializing wrapper_traits Message-ID: My team has a template class similar to odb::nullable that we would like to use to wrap nullable fields. I discovered the wrapper_traits class in ODB. It looks like we might be able to provide another specialization of wrapper_traits for our template class. Is that correct? If so, are there any examples available to provide guidance on how to achieve this? Thanks, Steve ________________________________ CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be confidential and/or legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you. From boris at codesynthesis.com Wed Apr 27 04:26:54 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 27 04:27:04 2016 Subject: [odb-users] Specializing wrapper_traits In-Reply-To: References: Message-ID: Hi Steve, Hales, Steve writes: > My team has a template class similar to odb::nullable that we would like to > use to wrap nullable fields. I discovered the wrapper_traits class in > ODB. It looks like we might be able to provide another specialization of > wrapper_traits for our template class. Is that correct? Yes, that's what it's for. > If so, are there any examples available to provide guidance on how > to achieve this? The ODB Boost profile library (libodb-boost) has a specialization for boost::optional. It shows how to do this "properly", i.e., it is completely non-intrusive and can be enabled via the profile mechanism (pass --profile|-p boost/optional). You can also do it like this, or you can add the necessary prologue/epilogue options (see boost/optional.options) to the ODB command line, or you can simply add the wrapper_traits specialization into the same header as you nullable class template and then you won't need to pass anything to the ODB compiler. Boris From boris at codesynthesis.com Wed Apr 27 04:29:51 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Apr 27 04:30:01 2016 Subject: [odb-users] Problem with session cache and weak_ptr In-Reply-To: <96d8d11a4c124466b9271f85f0dcdb5e@QEX.qosmotec.com> References: <96d8d11a4c124466b9271f85f0dcdb5e@QEX.qosmotec.com> Message-ID: Hi Marcel, Marcel Nehring writes: > I can double check and try to reproduce the problem tomorrow. I guess > the problem should be reproducible with ODB's original session if I > invalidate the weak_ptr manually. If this is true I could provide a > test case. Yes, I think this is a good idea. It does seem it should work the same with the default session implementation. Boris From Steve.Hales at garmin.com Wed Apr 27 11:43:21 2016 From: Steve.Hales at garmin.com (Hales, Steve) Date: Wed Apr 27 13:09:11 2016 Subject: [odb-users] Specializing wrapper_traits In-Reply-To: References: Message-ID: <854F7958-42C0-48A6-9DDB-5F4F28944A9D@garmin.com> Hi Boris, Thanks for your help. I believe we have this mostly working now. A follow-up question: What is the purpose of null_handler and null_default in wrapper_traits? Thanks, Steve On 4/27/16, 1:26 AM, "Boris Kolpackov" wrote: >Hi Steve, > >Hales, Steve writes: > >> My team has a template class similar to odb::nullable that we would like to >> use to wrap nullable fields. I discovered the wrapper_traits class in >> ODB. It looks like we might be able to provide another specialization of >> wrapper_traits for our template class. Is that correct? > >Yes, that's what it's for. > > >> If so, are there any examples available to provide guidance on how >> to achieve this? > >The ODB Boost profile library (libodb-boost) has a specialization for >boost::optional. It shows how to do this "properly", i.e., it is completely >non-intrusive and can be enabled via the profile mechanism (pass >--profile|-p boost/optional). You can also do it like this, or you can add >the necessary prologue/epilogue options (see boost/optional.options) to the >ODB command line, or you can simply add the wrapper_traits specialization >into the same header as you nullable class template and then you won't need >to pass anything to the ODB compiler. > >Boris ________________________________ CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be confidential and/or legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you. From mne at qosmotec.com Thu Apr 28 04:36:34 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Thu Apr 28 04:37:16 2016 Subject: AW: [odb-users] Problem with session cache and weak_ptr In-Reply-To: References: <96d8d11a4c124466b9271f85f0dcdb5e@QEX.qosmotec.com> Message-ID: Hi Boris, I was able to reproduce the problem with ODB's original session implementation. See the code below for a test case. Regards, Marcel //sandbox.cpp #include "sandbox.h" #include "sandbox-odb.h" #include #include #include #include int main(int argc, char ** argv) { std::unique_ptr db = std::make_unique("odb", "secret", "XE", "localhost"); std::vector> employees; odb::session session; { odb::transaction transaction(db->begin()); auto results(db->query()); auto resultIter = results.begin(); for (/**/; resultIter != results.end(); ++resultIter) { employees.push_back(resultIter.load()); } transaction.commit(); } for (const auto &emp : employees) { assert(!emp->employer.expired()); emp->employer.reset(); } employees.clear(); { odb::transaction transaction(db->begin()); auto results = db->query(); auto resultIter = results.begin(); for (/**/; resultIter != results.end(); ++resultIter) { employees.push_back(resultIter.load()); } transaction.commit(); } for (const auto &emp : employees) { // this assertion fails assert(!emp->employer.expired()); } return 0; } //sandbox.h #pragma once #include #include #pragma db namespace pointer(std::shared_ptr) session namespace test { struct employee; #pragma db object struct employer { #pragma db id auto long long id; std::vector> employees; }; #pragma db object struct employee { #pragma db id auto long long id; std::weak_ptr employer; }; } From boris at codesynthesis.com Thu Apr 28 09:53:13 2016 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Apr 28 09:53:24 2016 Subject: [odb-users] Specializing wrapper_traits In-Reply-To: <854F7958-42C0-48A6-9DDB-5F4F28944A9D@garmin.com> References: <854F7958-42C0-48A6-9DDB-5F4F28944A9D@garmin.com> Message-ID: Hi Steve, Hales, Steve writes: > A follow-up question: What is the purpose of null_handler and null_default > in wrapper_traits? odb::wrapper_traits is a general mechanism for any kinds of "wrappers" (i.e., objects that "hold" other objects). And some of them don't have the NULL pointer/value semantics. std::reference_wrapper is a good example of one. So null_handler indicates whether the wrapper has a notion of NULL/absent value. If it is true, then null_default indicates whether a member of such a wrapper type should be treated as NULL-able by default (i.e., you don't need to specify '#pragma db null' for it). Boris From abv150ci at gmail.com Thu Apr 28 23:50:48 2016 From: abv150ci at gmail.com (=?UTF-8?Q?Aar=C3=B3n_Bueno_Villares?=) Date: Thu Apr 28 23:51:40 2016 Subject: [odb-users] Object loading view defined in a separate file: object_statements is not being instantiated Message-ID: I have a persistent class called wamo::model_db (wamo is a namespace), defined in a file called metamodel-db.hpp (model-db.{h,c,i}pp are the names of the generated files, without the `meta` prefix). Each meta* file has some object loading views defined inside. Every thing works fine. I have also another persistent class called wamo::colormodel_db, which has a shared_ptr member (with its corresponding relantionship defined in the database). So, the metacolormodel-db.hpp file includes the file of model-db, and also it contains its own object loading views. Finally, we have wamo::resourcemodel_db, defined in metaresourdemodel-db.hpp, with same features. Everything works fine here as well. The thing is that I want to add I new object loading view in a separated file, called metamodel-searcher-db.hpp, which relates (with join clauses and so on), model, colormodel and resourdemodel. Every dependence is included. The error the compiler throws to me when compiling the generated file is: /usr/local/include/odb/mysql/statement-cache.txx:33:57: error: invalid static_cast from type ?odb::mysql::statements_base? to type ?statements_type& {aka odb::mysql::object_statements&}? return static_cast (*i->second); ^ /usr/local/include/odb/mysql/statement-cache.txx:36:54: error: invalid use of incomplete type ?statements_type {aka class odb::mysql::object_statements}? new (details::shared) statements_type (conn_)); ^ In file included from blablabla, blablabla, blablabla from model-searcher-db.cpp:7: /usr/local/include/odb/mysql/forward.hxx:54:11: error: declaration of ?statements_type {aka class odb::mysql::object_statements}? class object_statements; So, the `object_statements` template is not being instantiated. The problem is not related to this exact relationship, because if, instead of putting that view in a separated file, I move it to any other file (provide it includes directly or indirectly all the required `object(...)`s), it compiles without problems. The only difference between that file and the other ones (for example, if I define that view within colormodel-db.hpp), is that that separeted file has no "persistent classes" defined in the same file, and I think that is somehow making that that template is not being instantiated. What can I do to make it work? I need it is in a separated file for other reasons out of scope in that post. Best regards, Peregring-lk. From dieter.govaerts at bricsys.com Fri Apr 29 07:55:12 2016 From: dieter.govaerts at bricsys.com (Dieter Govaerts) Date: Fri Apr 29 07:55:20 2016 Subject: [odb-users] object_already_persistent exception and polymorphic class Message-ID: <1461930912.192515761@apps.rackspace.com> Hello, I came across the following issue with polymorphic classes in a sqlite db: #pragma db object polymorphic struct person { person() : id_(0) {} #pragma db id auto unsigned id_; }; #pragma db object struct employee: public person { employee(std::string name) : name_(name) {} #pragma db unique std::string name_; }; db.persist(new employee("John")); db.persist(new employee("John")); then the second persist will fail with an object_already_persistent exception as expected but it will leave the db in an inconsistent state. The second persist will insert the person row first and then fails on the insert of the employee row due to the unique constraint but the person row will not be cleaned up. So we will find a (2, "employee") row in the person table but no corresponding row in the employee table. Is this a bug or are we expected to clean this up manually and so yes, how? Regards, Dieter From mne at qosmotec.com Fri Apr 29 10:14:29 2016 From: mne at qosmotec.com (Marcel Nehring) Date: Fri Apr 29 10:15:33 2016 Subject: AW: [odb-users] object_already_persistent exception and polymorphic class In-Reply-To: <1461930912.192515761@apps.rackspace.com> References: <1461930912.192515761@apps.rackspace.com> Message-ID: <92102a8bfe104d86b28388e22b2f3cf1@QEX.qosmotec.com> Hi Dieter, sounds like you catch the exception and then commit the transaction anyway? You should not do that. If you do something like try { odb::transaction t(db.begin()); db.persist(new employee("John")); db.persist(new employee("John")); t.commit(); } catch (const odb::exception& e) { std::cerr << e.what () << endl; } then the transaction is rolled-back automatically because ODB's transaction class conforms to the RAII principle. This should solve your problem. Regards, Marcel From andrew at a-cunningham.com Fri Apr 29 17:20:51 2016 From: andrew at a-cunningham.com (Andrew Cunningham) Date: Sat Apr 30 10:40:03 2016 Subject: [odb-users] Containers of containers not detected Message-ID: Hi Boris, It would be great if the ODB compiler could detect "containers of containers" and throw an error. I am using a std::map and the "value" object is holding a std::vector. The ODB compiler accepts that quite happily, but this violates "container of containers" AFAIK. But surprisingly, if the std::vector is declared #pragma db type("BLOB") then the code actually functions correctly and loads the nested data container. If the BLOB #pragma is removed , then the std::vector data is not loaded So it seems I have unintentionally backed myself into a corner. - Is the "container of containers" a hard limitation that will remain in future versions of ODB? - Is the fact that using a BLOB makes the code work just blind good luck? e.g. #pragma db value class ValueObject { .... #pragma db type("BLOB") std::vector< unsigned char > vec_; }; #pragma db object class Other { .... std::map aMap_; } I'll send you a project that illustrates this.