From boris at codesynthesis.com Sun Jun 2 11:18:31 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Jun 2 11:17:13 2013 Subject: [odb-users] Building on Debian (testing/jessie) In-Reply-To: <51A7E1B3.9020705@adi-ware.ch> References: <51A7E1B3.9020705@adi-ware.ch> Message-ID: Hi Adrian, Adrian Imboden writes: > I found out about odb because of the very interesting C++Now presentation. I am glad you liked it! > When I want to build odb compiler, I get this output: > > # ./bootstrap > > [...] > > configure.ac:12: error: possibly undefined macro: m4_equote I am pretty sure you have checked out the code from the Git repository rather than using one of the packages. The problem is, the autotools (and VC++) build systems are auto-generated during the distribution preparation. So, for example, configure.ac in Git is a template that still has to be preprocessed. The easiest way to build ODB would be to use the distribution packages that we have prepared. Then you don't need to run bootstrap and can just go directly to configure and make. You can also check the INSTALL file for more information on this method. Alternatively, if you still want to use ODB from Git, then you can check the INSTALL-GIT file which describes how this can be done. Note that it requires quite a bit more initial setup compared to the first approach. > Is building on Debian supported or not? Yes, we make a complete Debian build from grounds up for every release. > I just upgraded my system from wheezy to Jessie because I suspected > that the required automake version is higher than my installed one > (Google suggested that to me). Actually, getting a combination of versions of autoconf, automake, and libtool that works reliably is quite tricky. The version of libtool that is available in Debian is very old and we use a newer version to prepare the release. That's why it is generally a good idea to avoid running bootstrap and rather use configure generated by the package maintainer. Boris From contact at rkade.fr Thu Jun 6 10:34:45 2013 From: contact at rkade.fr (rkadeFR) Date: Thu Jun 6 10:34:49 2013 Subject: [odb-users] Object creator with boost::posix_time::ptime member : exception from boost Message-ID: <51B09E05.2060701@rkade.fr> I have an existent database, and try to map the DB with my cpp objects for some queries. When I compiled, no errors. But when I run some queries on my objects, I have the exception "terminate called after throwing an instance of 'boost::exception_detail::clone_impl >'". I have some "0000-00-00 00:00:00" datetime in my DB (I can't change that). This exception is thrown exactly at the moment when I call a function on the iterator of my result. ex: iP->GetId() The documentation says that the object is created at this step of my program. (cf http://www.codesynthesis.com/products/odb/doc/manual.xhtml#4.4 ) So i put lots of log, and I can only see the private constructor called, and then... nothing except my exception. Can you explain me the way the iterator works ? And the work around I need to implement in order to avoid the exception ? Thank you, My object is something like : #include #include #include #pragma db object table("person") class Person { public: Person ( const std::string& name, const boost::posix_time::ptime& dateTime) : name(name), dateTime(dateTime) {} unsigned long GetId() const { return this->id; } const boost::posix_time::ptime GetDateTime() const { return this->dateTime; } const std::string GetName() const { return this->name; } private: Person() {} friend class odb::access; #pragma db column("id") id type("INT(10)") get(GetId) unsigned long id; #pragma db column("name") type("VARCHAR(25)") get(GetName) std::string name; #pragma db column("dateTime") type("DATETIME") get(GetDateTime) boost::posix_time::ptime tsAdded; } From boris at codesynthesis.com Thu Jun 6 11:38:48 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 6 11:37:33 2013 Subject: [odb-users] Object creator with boost::posix_time::ptime member : exception from boost In-Reply-To: <51B09E05.2060701@rkade.fr> References: <51B09E05.2060701@rkade.fr> Message-ID: Hi, rkadeFR writes: > I have some "0000-00-00 00:00:00" datetime in my DB (I can't change that). > > So i put lots of log, and I can only see the private constructor > called, and then... nothing except my exception. > > Can you explain me the way the iterator works? The actual object loading happens when you dereference the iterator. What probably happens in your case is ODB is trying to load one of the objects with the "0000-00-00 00:00:00" value and since it is not valid for Boost ptime, an exception is thrown. > And the work around I need to implement in order to avoid the > exception ? The easiest would be to change your database to represent invalid datetimes (that's what I assume "0000-00-00 00:00:00" are used for) as NULL values. ODB will then map such NULL values to the special not_a_date_time value -- nice and clean. The alternative would be for us to add extra code to ODB in order to recognize all-zero datetime values and treat them as NULL. Boris From contact at rkade.fr Thu Jun 6 11:45:54 2013 From: contact at rkade.fr (rkadeFR) Date: Thu Jun 6 11:45:58 2013 Subject: [odb-users] Object creator with boost::posix_time::ptime member : exception from boost In-Reply-To: References: <51B09E05.2060701@rkade.fr> Message-ID: <51B0AEB2.9040502@rkade.fr> On 06/06/2013 17:38, Boris Kolpackov wrote: > Hi, > > rkadeFR writes: > >> I have some "0000-00-00 00:00:00" datetime in my DB (I can't change that). >> >> So i put lots of log, and I can only see the private constructor >> called, and then... nothing except my exception. >> >> Can you explain me the way the iterator works? > The actual object loading happens when you dereference the iterator. > What probably happens in your case is ODB is trying to load one of > the objects with the "0000-00-00 00:00:00" value and since it is > not valid for Boost ptime, an exception is thrown. Something I noticed: my member is a boost::posix_time::ptime object, but the exception is about a gregorian::date. I read the code of boost, and I assume that pTime includes a gregorian::date object. > >> And the work around I need to implement in order to avoid the >> exception ? > The easiest would be to change your database to represent invalid > datetimes (that's what I assume "0000-00-00 00:00:00" are used for) > as NULL values. ODB will then map such NULL values to the special > not_a_date_time value -- nice and clean. 1- I can't change the database 2- It's used as a negative infinite value :s > > The alternative would be for us to add extra code to ODB in order > to recognize all-zero datetime values and treat them as NULL. Can I change the constructor of the object? Or the copy? If I understand, ODB construct an empty object with the private cTor, and then fill the member with some copy? Can I change the behavior of this copy to handle the exception? > Boris From contact at rkade.fr Thu Jun 6 13:02:17 2013 From: contact at rkade.fr (rkadeFR) Date: Thu Jun 6 13:02:21 2013 Subject: [odb-users] Object creator with boost::posix_time::ptime member : exception from boost In-Reply-To: <51B0AEB2.9040502@rkade.fr> References: <51B09E05.2060701@rkade.fr> <51B0AEB2.9040502@rkade.fr> Message-ID: <51B0C099.2020709@rkade.fr> On 06/06/2013 17:45, rkadeFR wrote: > > On 06/06/2013 17:38, Boris Kolpackov wrote: >> Hi, >> >> rkadeFR writes: >> >>> I have some "0000-00-00 00:00:00" datetime in my DB (I can't change >>> that). >>> >>> So i put lots of log, and I can only see the private constructor >>> called, and then... nothing except my exception. >>> >>> Can you explain me the way the iterator works? >> The actual object loading happens when you dereference the iterator. >> What probably happens in your case is ODB is trying to load one of >> the objects with the "0000-00-00 00:00:00" value and since it is >> not valid for Boost ptime, an exception is thrown. > Something I noticed: my member is a boost::posix_time::ptime > object, but the exception is about a gregorian::date. I read the code > of boost, and I assume that pTime includes a gregorian::date object. >> >>> And the work around I need to implement in order to avoid the >>> exception ? >> The easiest would be to change your database to represent invalid >> datetimes (that's what I assume "0000-00-00 00:00:00" are used for) >> as NULL values. ODB will then map such NULL values to the special >> not_a_date_time value -- nice and clean. > 1- I can't change the database > 2- It's used as a negative infinite value :s >> >> The alternative would be for us to add extra code to ODB in order >> to recognize all-zero datetime values and treat them as NULL. > Can I change the constructor of the object? > Or the copy? I tried to change the behavior of the setter on another object. And I figure out that odb use the setter to fill the members of the objects through these setters. But as a setter, it takes already a const boost::posix_time::ptime& object, which is created before by ODB. I think the exception is thrown before by ODB than it reaches the setter method. void SetDateTime( const boost::posix_time::ptime& dateTime) { std::cout << "this is setter date time" << std::endl; this->dateTime = dateTime; } with the pragma... set(SetDateTime). > > If I understand, ODB construct an empty object with the private > cTor, and then fill the member with some copy? > Can I change the behavior of this copy to handle the exception? >> Boris > > From boris at codesynthesis.com Thu Jun 6 13:12:45 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 6 13:11:28 2013 Subject: [odb-users] Object creator with boost::posix_time::ptime member : exception from boost In-Reply-To: <51B0AEB2.9040502@rkade.fr> References: <51B09E05.2060701@rkade.fr> <51B0AEB2.9040502@rkade.fr> Message-ID: Hi, rkadeFR writes: > 1- I can't change the database > 2- It's used as a negative infinite value :s Ok, so mapping it to neg_infin would be more appropriate. > If I understand, ODB construct an empty object with the private > cTor, and then fill the member with some copy? That's about right. The exception is thrown when ODB tries to initialize an instance of ptime from the loaded value, before assigning it to the data member in the object. > Can I change the behavior of this copy to handle the exception? Yes, ODB allows you to provide completely custom code that converts between the database value (in your case, that would be MYSQL_TIME struct) and C++ value (that would be ptime). There you can do pretty much any conversions you want. Also, if you are going this route, then you can also map DATETIME to something other than Boost ptime (e.g., your own date-time representation or struct tm). This guide has detailed information on how to do all this: http://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/ You can also use the odb/boost/date-time/mysql/posix-time-traits.hxx file from the libodb-boost as a reference. There is also another option which doesn't require a custom value_traits specialization. It is a bit "hackish" (or cool; depending on how you look at it ;-)) and is better suited for once-off customizations that are only needed in specific classes. The overall idea is to use virtual data members and use the image type (MYSQL_TIME in our case) as its type. We will also need to provide our own accessors/modifiers that convert between our data member (or ptime type) and the image type. Here is an outline: #include // MYSQL_TIME class Person { ... void tsAddedConvert (const MYSQL_TIME& v) { using namespace boost::gregorian; using namespace boost::posix_time; if (v.year == 0 && v.month == 0 && v.day == 0 && v.hour == 0 && v.minute == 0 && v.second == 0) tsAdded = ptime (neg_infin); else tsAdded = ptime (date (v.year, v.month, v.day), time_duration (v.hour, v.minute, v.second)); } MYSQL_TIME tsAddedConvert () const { using namespace boost::gregorian; using namespace boost::posix_time; MYSQL_TIME v; v.neg = false; if (tsAdded.is_neg_infinity ()) { v.year = 0; v.month = 0; v.day = 0; v.hour = 0; v.minute = 0; v.second = 0; } else { const date& d (tsAdded.date ()); v.year = d.year (); v.month = d.month (); v.day = d.day (); const time_duration& t (tsAdded.time_of_day ()); v.hour = t.hours (); v.minute = t.minutes (); v.second = t.seconds (); } v.second_part = 0; return v; } #pragma db column("dateTime") type("DATETIME") #pragma db member(dateTime) virtual(MYSQL_TIME) access(tsAddedConvert) #pragma db transient boost::posix_time::ptime tsAdded; }; It is also possible to forward to the default ptime value_traits for the default cases (we would need to move the tsAddedConvert() functions to the .cxx file though). Boris From contact at rkade.fr Thu Jun 6 13:20:05 2013 From: contact at rkade.fr (rkadeFR) Date: Thu Jun 6 13:20:10 2013 Subject: [odb-users] Object creator with boost::posix_time::ptime member : exception from boost In-Reply-To: References: <51B09E05.2060701@rkade.fr> <51B0AEB2.9040502@rkade.fr> Message-ID: <51B0C4C5.6090902@rkade.fr> On 06/06/2013 19:12, Boris Kolpackov wrote: > Hi, > > rkadeFR writes: > >> 1- I can't change the database >> 2- It's used as a negative infinite value :s > Ok, so mapping it to neg_infin would be more appropriate. > > >> If I understand, ODB construct an empty object with the private >> cTor, and then fill the member with some copy? > That's about right. The exception is thrown when ODB tries to > initialize an instance of ptime from the loaded value, before > assigning it to the data member in the object. > > >> Can I change the behavior of this copy to handle the exception? > Yes, ODB allows you to provide completely custom code that converts > between the database value (in your case, that would be MYSQL_TIME > struct) and C++ value (that would be ptime). There you can do pretty > much any conversions you want. Also, if you are going this route, > then you can also map DATETIME to something other than Boost ptime > (e.g., your own date-time representation or struct tm). This guide > has detailed information on how to do all this: > > http://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/ > > You can also use the odb/boost/date-time/mysql/posix-time-traits.hxx > file from the libodb-boost as a reference. > > There is also another option which doesn't require a custom value_traits > specialization. It is a bit "hackish" (or cool; depending on how you look > at it ;-)) and is better suited for once-off customizations that are only > needed in specific classes. The overall idea is to use virtual data members > and use the image type (MYSQL_TIME in our case) as its type. We will also > need to provide our own accessors/modifiers that convert between our > data member (or ptime type) and the image type. Here is an outline: > > #include // MYSQL_TIME > > class Person > { > ... > > void tsAddedConvert (const MYSQL_TIME& v) > { > using namespace boost::gregorian; > using namespace boost::posix_time; > > if (v.year == 0 && > v.month == 0 && > v.day == 0 && > v.hour == 0 && > v.minute == 0 && > v.second == 0) > tsAdded = ptime (neg_infin); > else > tsAdded = ptime (date (v.year, v.month, v.day), > time_duration (v.hour, v.minute, v.second)); > } > > MYSQL_TIME tsAddedConvert () const > { > using namespace boost::gregorian; > using namespace boost::posix_time; > > MYSQL_TIME v; > v.neg = false; > > if (tsAdded.is_neg_infinity ()) > { > v.year = 0; > v.month = 0; > v.day = 0; > > v.hour = 0; > v.minute = 0; > v.second = 0; > } > else > { > const date& d (tsAdded.date ()); > v.year = d.year (); > v.month = d.month (); > v.day = d.day (); > > const time_duration& t (tsAdded.time_of_day ()); > v.hour = t.hours (); > v.minute = t.minutes (); > v.second = t.seconds (); > } > > v.second_part = 0; > return v; > } > > #pragma db column("dateTime") type("DATETIME") > #pragma db member(dateTime) virtual(MYSQL_TIME) access(tsAddedConvert) > > #pragma db transient > boost::posix_time::ptime tsAdded; > }; > > It is also possible to forward to the default ptime value_traits for > the default cases (we would need to move the tsAddedConvert() functions > to the .cxx file though). > > Boris Ok great, I'm gonna try to implement my own type :) From PStath at Axxcelera.com Thu Jun 6 14:59:38 2013 From: PStath at Axxcelera.com (Stath, Paul) Date: Thu Jun 6 14:59:56 2013 Subject: [odb-users] Enable RSS feed for odb-users? Message-ID: <5B5D636C5F0AA747B37D0EFC72B563C404B12251@RIC-MS02.MWSG.int> Boris -- Would it be possible to get an RSS feed for odb-users, similar to the RSS feed "ODB News Feed"? (I'm making the perhaps incorrect assumption that "ODB News Feed" is an RSS of the odb-announcements list.) I'm in the process of attempting to lighten my in-box by moving my mailing list subscriptions to RSS feeds where available. -- Paul From tenchu.tarik at hotmail.fr Wed Jun 5 12:12:53 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Thu Jun 6 15:48:07 2013 Subject: [odb-users] Join Between Tables Message-ID: Hello, I Have three tables that I mapped, and I would like to know how to do a join between them. Do I necessarily need to create a view? Best Wishes, Tarik From boris at codesynthesis.com Thu Jun 6 16:01:06 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 6 16:00:01 2013 Subject: [odb-users] Join Between Tables In-Reply-To: References: Message-ID: Hi Tarik, Tarik BENZ writes: > I Have three tables that I mapped, and I would like to know > how to do a join between them. Do I necessarily need to create a view? ODB automatically creates a JOIN in two cases (well, technically, there is a third case: polymorphic objects, but that is not generally visible to the end user): 1. When there is a relationship between objects (i.e., one points to the other). In this case, ODB "JOIN's in" the pointed-to objects in queries so that you can refer to data members from these objects. For example: db.query (query::employer->name == "Example, Inc"); Note that this JOIN'ing of related objects is only done one level deep. 2. In views that are based on more than one object (or database table). There is a lot of flexibility in views and you can JOIN objects and/or database tables using relationships and/or custom conditions. So, unless the JOIN that you are looking for naturally follows from the relationship between your objects, the views are probably your best choice. Boris From boris at codesynthesis.com Fri Jun 7 03:09:12 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 7 03:07:56 2013 Subject: [odb-users] Enable RSS feed for odb-users? In-Reply-To: <5B5D636C5F0AA747B37D0EFC72B563C404B12251@RIC-MS02.MWSG.int> References: <5B5D636C5F0AA747B37D0EFC72B563C404B12251@RIC-MS02.MWSG.int> Message-ID: Hi Paul, Stath, Paul writes: > I'm in the process of attempting to lighten my in-box by moving my > mailing list subscriptions to RSS feeds where available. Have you looked at the digest option? In essence, instead of receiving every post individually (and in real time), you can configure your subscription to send you a single email with all the accumulated posts once in a while. You can enable digest for your subscription here: http://www.codesynthesis.com/mailman/options/odb-users > Would it be possible to get an RSS feed for odb-users, similar to the > RSS feed "ODB News Feed"? I took a look and there doesn't seem to be an easy way to add this support in mailman (it is on their TODO list). Also, my problem with an RSS feed of a mailing list is that there is no easy way to reply to a post. Before you could have written a quick reply to a question you know the answer to because it is so easy. With RSS you probably won't bother. If you still want an RSS feed, then I think the best option is to add odb-users to gmane.org, which provides all kinds of RSS feeds for the mailing lists it tracks. > (I'm making the perhaps incorrect assumption that "ODB News Feed" is > an RSS of the odb-announcements list.) Yes, the two provide the same information and the RSS feed is hand- maintained. This works well because odb-announcements is a read-only mailing list. Boris From contact at rkade.fr Fri Jun 7 07:10:46 2013 From: contact at rkade.fr (rkadeFR) Date: Fri Jun 7 07:10:52 2013 Subject: [odb-users] Object creator with boost::posix_time::ptime member : exception from boost In-Reply-To: <51B0C4C5.6090902@rkade.fr> References: <51B09E05.2060701@rkade.fr> <51B0AEB2.9040502@rkade.fr> <51B0C4C5.6090902@rkade.fr> Message-ID: <51B1BFB6.5050307@rkade.fr> On 06/06/2013 19:20, rkadeFR wrote: > > On 06/06/2013 19:12, Boris Kolpackov wrote: >> Hi, >> >> rkadeFR writes: >> >>> 1- I can't change the database >>> 2- It's used as a negative infinite value :s >> Ok, so mapping it to neg_infin would be more appropriate. >> >> >>> If I understand, ODB construct an empty object with the private >>> cTor, and then fill the member with some copy? >> That's about right. The exception is thrown when ODB tries to >> initialize an instance of ptime from the loaded value, before >> assigning it to the data member in the object. >> >> >>> Can I change the behavior of this copy to handle the exception? >> Yes, ODB allows you to provide completely custom code that converts >> between the database value (in your case, that would be MYSQL_TIME >> struct) and C++ value (that would be ptime). There you can do pretty >> much any conversions you want. Also, if you are going this route, >> then you can also map DATETIME to something other than Boost ptime >> (e.g., your own date-time representation or struct tm). This guide >> has detailed information on how to do all this: >> >> http://www.codesynthesis.com/~boris/blog/2012/10/16/custom-cxx-to-database-type-mapping-in-odb/ >> >> >> You can also use the odb/boost/date-time/mysql/posix-time-traits.hxx >> file from the libodb-boost as a reference. >> >> There is also another option which doesn't require a custom value_traits >> specialization. It is a bit "hackish" (or cool; depending on how you >> look >> at it ;-)) and is better suited for once-off customizations that are >> only >> needed in specific classes. The overall idea is to use virtual data >> members >> and use the image type (MYSQL_TIME in our case) as its type. We will >> also >> need to provide our own accessors/modifiers that convert between our >> data member (or ptime type) and the image type. Here is an outline: >> >> #include // MYSQL_TIME >> >> class Person >> { >> ... >> >> void tsAddedConvert (const MYSQL_TIME& v) >> { >> using namespace boost::gregorian; >> using namespace boost::posix_time; >> >> if (v.year == 0 && >> v.month == 0 && >> v.day == 0 && >> v.hour == 0 && >> v.minute == 0 && >> v.second == 0) >> tsAdded = ptime (neg_infin); >> else >> tsAdded = ptime (date (v.year, v.month, v.day), >> time_duration (v.hour, v.minute, v.second)); >> } >> >> MYSQL_TIME tsAddedConvert () const >> { >> using namespace boost::gregorian; >> using namespace boost::posix_time; >> >> MYSQL_TIME v; >> v.neg = false; >> >> if (tsAdded.is_neg_infinity ()) >> { >> v.year = 0; >> v.month = 0; >> v.day = 0; >> >> v.hour = 0; >> v.minute = 0; >> v.second = 0; >> } >> else >> { >> const date& d (tsAdded.date ()); >> v.year = d.year (); >> v.month = d.month (); >> v.day = d.day (); >> >> const time_duration& t (tsAdded.time_of_day ()); >> v.hour = t.hours (); >> v.minute = t.minutes (); >> v.second = t.seconds (); >> } >> >> v.second_part = 0; >> return v; >> } >> >> #pragma db column("dateTime") type("DATETIME") >> #pragma db member(dateTime) virtual(MYSQL_TIME) >> access(tsAddedConvert) >> >> #pragma db transient >> boost::posix_time::ptime tsAdded; >> }; >> >> It is also possible to forward to the default ptime value_traits for >> the default cases (we would need to move the tsAddedConvert() functions >> to the .cxx file though). >> >> Boris > Ok great, > > I'm gonna try to implement my own type :) > > Ok ! Done for what I wanted :) Thank you so much :) From PStath at Axxcelera.com Fri Jun 7 12:03:20 2013 From: PStath at Axxcelera.com (Stath, Paul) Date: Fri Jun 7 15:04:31 2013 Subject: [odb-users] Enable RSS feed for odb-users? In-Reply-To: References: <5B5D636C5F0AA747B37D0EFC72B563C404B12251@RIC-MS02.MWSG.int>, Message-ID: <5B5D636C5F0AA747B37D0EFC72B563C404B12CD9@RIC-MS02.MWSG.int> Boris -- > Have you looked at the digest option? In essence, instead of receiving I'm already using digest mode. I don't have a problem w/ the velocity of odb-users, but do have a problem with a couple of the other mailing lists that I subscribe to. (Digest doesn't make it much better either.) So I'm attempting to get all of my mailing list subs as RSS feeds. > I took a look and there doesn't seem to be an easy way to add this > support in mailman (it is on their TODO list). I too looked to see if GNU Mailman provided RSS feeds, but no one has provided one. (I'm actually amazed, as I think this would be extremely useful. And would be a logical function for the archiver to perform.) > Also, my problem with an RSS feed of a mailing list is that there is > no easy way to reply to a post. Before you could have written a quick > reply to a question you know the answer to because it is so easy. With > RSS you probably won't bother. This is a good point. It is not as easy as a simple email reply. Of course since I use digest mode, you have almost always responded before I even see the question. ;) > If you still want an RSS feed, then I think the best option is to add > odb-users to gmane.org, which provides all kinds of RSS feeds for the > mailing lists it tracks. This is how I have handled the other mailing lists I subscribe to. I had not realized that I could simply request a new list to be tracked. That will work for me. Thanks. -- Paul From jneuhart at tlirr.com Fri Jun 7 16:36:31 2013 From: jneuhart at tlirr.com (Jordan J. Neuhart) Date: Fri Jun 7 16:36:38 2013 Subject: [odb-users] Polymorphic id name not carried through to dervied table Message-ID: <681FA42AB546F84C8CFDFCAA6D89A62802E727A9@husker.tlirr.local> Greetings, I have a polymorphic class hierarchy and when I check the generated SQL files, I see that the column name that I specified for the id column of the base class is not the same as the name of the id column for the derived class. I have attached the generated files so that you can see this. I am using the Qt profile and the SQLite odb library on Windows 7. I am using the latest version of the odb compiler. Thanks, Jordan Neuhart Database Administrator Sofware Developer T-L Irrigation Co. P.O. Box 1047 151 East Hwy 6 & AB Road Hastings, NE 68902-1047 office: 402-462-4128 ext. 264 800-330-4264 ext. 264 cell: 402-217-1377 email: jjn@tlirr.com website: http://www.tlirr.com From boris at codesynthesis.com Sat Jun 8 09:26:51 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sat Jun 8 09:25:36 2013 Subject: [odb-users] Polymorphic id name not carried through to dervied table In-Reply-To: <681FA42AB546F84C8CFDFCAA6D89A62802E727A9@husker.tlirr.local> References: <681FA42AB546F84C8CFDFCAA6D89A62802E727A9@husker.tlirr.local> Message-ID: Hi Jordan, Jordan J. Neuhart writes: > I have a polymorphic class hierarchy and when I check the generated SQL > files, I see that the column name that I specified for the id column of > the base class is not the same as the name of the id column for the > derived class. Yes, that was an oversight. We should propagate the custom column name to the derived classes. I've fixed this and you can get the ODB compiler with this fix here: http://www.codesynthesis.com/~boris/tmp/odb/odb-2.2.2-i686-windows.zip Boris From vwygos at gmail.com Sun Jun 9 13:32:44 2013 From: vwygos at gmail.com (Piotr Wygocki) Date: Sun Jun 9 14:57:06 2013 Subject: [odb-users] ODB Message-ID: Hi' I've been to your presentation on c++now. I like ODB very much but there is one think that bothers me. The think is that you cannot run which translates directly to this kind of query: "UPDATE table SET id = id + 1 WHERE id > 10". or "DELETE FROM table WHERE id > 10". In my previous company I used dbs a lot and lack of this kind of queries would be disqualifying for a framework. Good luck with future developement! Regards, Piotr From boris at codesynthesis.com Sun Jun 9 15:02:56 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Sun Jun 9 15:01:40 2013 Subject: [odb-users] ODB In-Reply-To: References: Message-ID: Hi Piotr, Piotr Wygocki writes: > I like ODB very much but there is one think that bothers me. The > think is that you cannot run which translates directly to this kind > of query: > > "UPDATE table SET id = id + 1 WHERE id > 10". Yes, we call these "mass update" statements (since they affect multiple objects). There are plans to support mass updates (and mass, inserts for databases that support them) in the near future. > "DELETE FROM table WHERE id > 10". This one is actually already supported: db.erase_query (query::id > 10); Boris From jneuhart at tlirr.com Mon Jun 10 12:26:52 2013 From: jneuhart at tlirr.com (Jordan J. Neuhart) Date: Mon Jun 10 12:26:59 2013 Subject: [odb-users] Polymorphic id name not carried through to dervied table In-Reply-To: References: <681FA42AB546F84C8CFDFCAA6D89A62802E727A9@husker.tlirr.local> Message-ID: <681FA42AB546F84C8CFDFCAA6D89A62802E727B1@husker.tlirr.local> Thanks Boris. Jordan -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Saturday, June 08, 2013 8:27 AM To: Jordan J. Neuhart Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Polymorphic id name not carried through to dervied table Hi Jordan, Jordan J. Neuhart writes: > I have a polymorphic class hierarchy and when I check the generated > SQL files, I see that the column name that I specified for the id > column of the base class is not the same as the name of the id column > for the derived class. Yes, that was an oversight. We should propagate the custom column name to the derived classes. I've fixed this and you can get the ODB compiler with this fix here: http://www.codesynthesis.com/~boris/tmp/odb/odb-2.2.2-i686-windows.zip Boris From jneuhart at tlirr.com Tue Jun 11 17:51:55 2013 From: jneuhart at tlirr.com (Jordan J. Neuhart) Date: Tue Jun 11 17:52:02 2013 Subject: [odb-users] MSVC Compiler Error C2872 when comipling a project using ODB with a polymorphic heirarchy Message-ID: <681FA42AB546F84C8CFDFCAA6D89A62802E727B6@husker.tlirr.local> Greetings Boris and all, I am working on a test project using ODB with Qt and I keep getting a compiler error which seems to be related to ODB. The set of compiler error output is: ************************************************************************ *************************************************** C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\li bodb\odb\polymorphic-info.hxx:63: error: C2872: 'database' : ambiguous symbol could be 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\l ibodb\odb\database.hxx:37: odb::database' or 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\l ibodb-sqlite\odb\sqlite\database.hxx:36: odb::sqlite::database' C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\li bodb\odb\polymorphic-map.hxx:30: see reference to class template instantiation 'odb::polymorphic_concrete_info' being compiled with [ R=odb::access::object_traits::object_type ] C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\test\T estTieredDiscount\discount-odb.cxx:223: see reference to class template instantiation 'odb::polymorphic_map' being compiled with [ R=odb::access::object_traits::object_type ] C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\li bodb\odb\polymorphic-info.hxx:65: error: C2872: 'database' : ambiguous symbol could be 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\l ibodb\odb\database.hxx:37: odb::database' or 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\l ibodb-sqlite\odb\sqlite\database.hxx:36: odb::sqlite::database' ************************************************************************ *************************************************** It seems to be related to polymorphism somehow. I am wondering if the issue is related to the fact that I have a base class which is both polymorphic and abstract. This base class contains the Object Id and the version number used for polymorphic conversion. I am using Qt 5.0.2 with the 64 bit compiler that comes with Visual Studio 2012 Express on Windows 7. I have successfully compiled another test project that uses a polymorphic hierarchy without issue using the same setup and libraries. Thank you for any help that you may provide. Jordan Neuhart Database Administrator Sofware Developer T-L Irrigation Co. P.O. Box 1047 151 East Hwy 6 & AB Road Hastings, NE 68902-1047 office: 402-462-4128 ext. 264 800-330-4264 ext. 264 cell: 402-217-1377 email: jjn@tlirr.com website: http://www.tlirr.com From boris at codesynthesis.com Wed Jun 12 04:46:56 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 04:45:38 2013 Subject: [odb-users] MSVC Compiler Error C2872 when comipling a project using ODB with a polymorphic heirarchy In-Reply-To: <681FA42AB546F84C8CFDFCAA6D89A62802E727B6@husker.tlirr.local> References: <681FA42AB546F84C8CFDFCAA6D89A62802E727B6@husker.tlirr.local> Message-ID: Hi Jordan, Jordan J. Neuhart writes: > C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\li > bodb\odb\polymorphic-info.hxx:63: error: C2872: 'database' : ambiguous > symbol > > could be > 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\l > ibodb\odb\database.hxx:37: odb::database' > > or > 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\l > ibodb-sqlite\odb\sqlite\database.hxx:36: odb::sqlite::database' This is a fairly annoying bug in VC++ where it complains about a bogus ambiguity. The really nasty part is that it is situation dependent, which is why we didn't pick this up with our tests. Anyway, I've qualified the affected names which should work around the problem. Can you give the bug fix a try and let me know if there are still any problems? http://www.codesynthesis.com/~boris/tmp/odb/libodb-2.2.3.zip Boris From shekli at list.ru Wed Jun 12 05:16:21 2013 From: shekli at list.ru (=?UTF-8?B?0LDQu9C10LrRgdCw0L3QtNGAINCy0LXRgNGI0LjQvdC40L0=?=) Date: Wed Jun 12 05:16:33 2013 Subject: [odb-users] scrollable cursors Message-ID: <1371028581.906897635@f432.i.mail.ru> Hi, Could you please answer does ODB support scrollable cursors with Postgres like ScrollableResults in hibernate? Thanks! -- Alexander Vershynin From tenchu.tarik at hotmail.fr Wed Jun 12 08:52:58 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Wed Jun 12 08:53:06 2013 Subject: [odb-users] String Query Message-ID: Hello, I would like to use a select case query and I don't know how to perform it with OBD. There is a way to do it with ODB or I need to write a string query? if I have to use a string query, how can we do this? Thanks in advance for your help! Best Wishes Tarik From boris at codesynthesis.com Wed Jun 12 09:15:39 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 09:14:21 2013 Subject: [odb-users] scrollable cursors In-Reply-To: <1371028581.906897635@f432.i.mail.ru> References: <1371028581.906897635@f432.i.mail.ru> Message-ID: Hi Alexander, ????????? ???????? writes: > Could you please answer does ODB support scrollable cursors with > Postgres like ScrollableResults in hibernate? No, ODB result sets only support forward iteration and the reason for this is that scrollable results, in most databases, have very poor performance compared to the streaming ones. If you are looking for scrollable results in order to support pagination, then a better option would be to use the Postgres LIMIT and OFFSET clauses. The archives of this mailing list have some examples, if you are interested. Boris From boris at codesynthesis.com Wed Jun 12 09:33:16 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 09:31:59 2013 Subject: [odb-users] String Query In-Reply-To: References: Message-ID: Hi Tarik, Tarik BENZ writes: > I would like to use a select case query and I don't know how to perform > it with OBD. The CASE clause can appear in different places in the query. Can you show plain SQL version of what you are trying to execute with ODB? Note also that it is ODB, not OBD Boris From tenchu.tarik at hotmail.fr Wed Jun 12 09:38:41 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Wed Jun 12 09:38:49 2013 Subject: [odb-users] String Query In-Reply-To: References: , Message-ID: Yes sorry, I don't know why I wrote "OBD"! I thing the best way to do what I want is to create a SQL Procedure. Is it possible to call a procedure with ODB? Tarik > Date: Wed, 12 Jun 2013 15:33:16 +0200 > From: boris@codesynthesis.com > To: tenchu.tarik@hotmail.fr > CC: odb-users@codesynthesis.com > Subject: Re: [odb-users] String Query > > Hi Tarik, > > Tarik BENZ writes: > > > I would like to use a select case query and I don't know how to perform > > it with OBD. > > The CASE clause can appear in different places in the query. Can you show > plain SQL version of what you are trying to execute with ODB? Note also > that it is ODB, not OBD > > Boris From jneuhart at tlirr.com Wed Jun 12 09:41:11 2013 From: jneuhart at tlirr.com (Jordan J. Neuhart) Date: Wed Jun 12 09:41:17 2013 Subject: [odb-users] MSVC Compiler Error C2872 when comipling a project using ODB with a polymorphic heirarchy In-Reply-To: References: <681FA42AB546F84C8CFDFCAA6D89A62802E727B6@husker.tlirr.local> Message-ID: <681FA42AB546F84C8CFDFCAA6D89A62802E727B7@husker.tlirr.local> Boris, That worked perfectly. No more compiler warnings. Thank you, Jordan Neuhart -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, June 12, 2013 3:47 AM To: Jordan J. Neuhart Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] MSVC Compiler Error C2872 when comipling a project using ODB with a polymorphic heirarchy Hi Jordan, Jordan J. Neuhart writes: > C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\ > li > bodb\odb\polymorphic-info.hxx:63: error: C2872: 'database' : ambiguous > symbol > > could be > 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb > \l > ibodb\odb\database.hxx:37: odb::database' > > or > 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb > \l > ibodb-sqlite\odb\sqlite\database.hxx:36: odb::sqlite::database' This is a fairly annoying bug in VC++ where it complains about a bogus ambiguity. The really nasty part is that it is situation dependent, which is why we didn't pick this up with our tests. Anyway, I've qualified the affected names which should work around the problem. Can you give the bug fix a try and let me know if there are still any problems? http://www.codesynthesis.com/~boris/tmp/odb/libodb-2.2.3.zip Boris From boris at codesynthesis.com Wed Jun 12 10:07:54 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 10:06:37 2013 Subject: [odb-users] String Query In-Reply-To: References: Message-ID: Hi Tarik, Tarik BENZ writes: > I thing the best way to do what I want is to create a SQL Procedure. Again, without knowing *what* you are trying to achieve it is hard for me to say whether it is the best way. But my guess would probably be that it is not. > Is it possible to call a procedure with ODB? Yes, you can use native views (Section 9.5 in the manual) to call stored procedures. Something along these lines (SQL Server example): // Assume my_stored_proc accepts two parameters (string and number) and // its result set contains two columns (string and number). // #pragma db view query("EXEC my_stored_proc (?)") struct my_stored_proc { std::string str; unsigned long num; }; typedef odb::query query; db.query (query::_val ("abc") + "," + query::_val (123)); Boris From tenchu.tarik at hotmail.fr Wed Jun 12 10:15:35 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Wed Jun 12 10:15:42 2013 Subject: [odb-users] String Query In-Reply-To: References: , , , Message-ID: 1. I have a period type (1 = day, 2 = week, 3 = month) 2. I have a period number ( 1, 2 , 3 ...) -> If my period type is 2 and my period number is 3, I will have a period of 3 weeks (2 * 3) 3. I have a reference date (January 1st 2013) What I want to do is : The user will select a period ( ex : beginning = Mars 5th 2013, end = April 13th 2013). I want to know if with the period type, period number and the reference date, we will be in this selected period. Tarik > Date: Wed, 12 Jun 2013 16:07:54 +0200 > From: boris@codesynthesis.com > To: tenchu.tarik@hotmail.fr > CC: odb-users@codesynthesis.com > Subject: Re: [odb-users] String Query > > Hi Tarik, > > Tarik BENZ writes: > > > I thing the best way to do what I want is to create a SQL Procedure. > > Again, without knowing *what* you are trying to achieve it is hard > for me to say whether it is the best way. But my guess would probably > be that it is not. > > > > Is it possible to call a procedure with ODB? > > Yes, you can use native views (Section 9.5 in the manual) to call stored > procedures. Something along these lines (SQL Server example): > > // Assume my_stored_proc accepts two parameters (string and number) and > // its result set contains two columns (string and number). > // > #pragma db view query("EXEC my_stored_proc (?)") > struct my_stored_proc > { > std::string str; > unsigned long num; > }; > > typedef odb::query query; > > db.query (query::_val ("abc") + "," + query::_val (123)); > > Boris From tenchu.tarik at hotmail.fr Wed Jun 12 12:34:18 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Wed Jun 12 12:34:25 2013 Subject: [odb-users] String Query In-Reply-To: References: , , , , , , , Message-ID: Is it possible to call a stored procedure with ODB? > From: tenchu.tarik@hotmail.fr > To: odb-users@codesynthesis.com > Subject: RE: [odb-users] String Query > Date: Wed, 12 Jun 2013 16:15:35 +0200 > > 1. I have a period type (1 = day, 2 = week, 3 = month) > 2. I have a period number ( 1, 2 , 3 ...) > -> If my period type is 2 and my period number is 3, I will have a period of 3 weeks (2 * 3) > > 3. I have a reference date (January 1st 2013) > > What I want to do is : > The user will select a period ( ex : beginning = Mars 5th 2013, end = April 13th 2013). > I want to know if with the period type, period number and the reference date, we will be in this selected period. > > Tarik > > > Date: Wed, 12 Jun 2013 16:07:54 +0200 > > From: boris@codesynthesis.com > > To: tenchu.tarik@hotmail.fr > > CC: odb-users@codesynthesis.com > > Subject: Re: [odb-users] String Query > > > > Hi Tarik, > > > > Tarik BENZ writes: > > > > > I thing the best way to do what I want is to create a SQL Procedure. > > > > Again, without knowing *what* you are trying to achieve it is hard > > for me to say whether it is the best way. But my guess would probably > > be that it is not. > > > > > > > Is it possible to call a procedure with ODB? > > > > Yes, you can use native views (Section 9.5 in the manual) to call stored > > procedures. Something along these lines (SQL Server example): > > > > // Assume my_stored_proc accepts two parameters (string and number) and > > // its result set contains two columns (string and number). > > // > > #pragma db view query("EXEC my_stored_proc (?)") > > struct my_stored_proc > > { > > std::string str; > > unsigned long num; > > }; > > > > typedef odb::query query; > > > > db.query (query::_val ("abc") + "," + query::_val (123)); > > > > Boris > From adrian at adi-ware.ch Wed Jun 12 13:31:59 2013 From: adrian at adi-ware.ch (Adrian Imboden) Date: Wed Jun 12 13:32:06 2013 Subject: [odb-users] Building on Debian (testing/jessie) In-Reply-To: References: <51A7E1B3.9020705@adi-ware.ch> Message-ID: <51B8B08F.1030001@adi-ware.ch> Sorry that i respond so late. Didn't got time until now. It works great! What would be the recommended way to contribute code? That was my primary reason to use the git repo at first. Adi On 02.06.2013 17:18, Boris Kolpackov wrote: > Hi Adrian, > > Adrian Imboden writes: > >> I found out about odb because of the very interesting C++Now presentation. > I am glad you liked it! > > >> When I want to build odb compiler, I get this output: >> >> # ./bootstrap >> >> [...] >> >> configure.ac:12: error: possibly undefined macro: m4_equote > I am pretty sure you have checked out the code from the Git repository > rather than using one of the packages. The problem is, the autotools > (and VC++) build systems are auto-generated during the distribution > preparation. So, for example, configure.ac in Git is a template that > still has to be preprocessed. > > The easiest way to build ODB would be to use the distribution packages > that we have prepared. Then you don't need to run bootstrap and can just > go directly to configure and make. You can also check the INSTALL file > for more information on this method. > > Alternatively, if you still want to use ODB from Git, then you can > check the INSTALL-GIT file which describes how this can be done. Note > that it requires quite a bit more initial setup compared to the first > approach. > > >> Is building on Debian supported or not? > Yes, we make a complete Debian build from grounds up for every release. > > >> I just upgraded my system from wheezy to Jessie because I suspected >> that the required automake version is higher than my installed one >> (Google suggested that to me). > Actually, getting a combination of versions of autoconf, automake, and > libtool that works reliably is quite tricky. The version of libtool that > is available in Debian is very old and we use a newer version to prepare > the release. That's why it is generally a good idea to avoid running > bootstrap and rather use configure generated by the package maintainer. > > Boris From jneuhart at tlirr.com Wed Jun 12 14:22:42 2013 From: jneuhart at tlirr.com (Jordan J. Neuhart) Date: Wed Jun 12 14:22:48 2013 Subject: [odb-users] MSVC Compiler Error C2872 when comipling a project using ODB with a polymorphic heirarchy In-Reply-To: References: <681FA42AB546F84C8CFDFCAA6D89A62802E727B6@husker.tlirr.local> Message-ID: <681FA42AB546F84C8CFDFCAA6D89A62802E727BA@husker.tlirr.local> Boris, Just out of curiosity, what did you have to do to fix this bug, just in case I run into it again later? Thanks, Jordan -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: Wednesday, June 12, 2013 3:47 AM To: Jordan J. Neuhart Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] MSVC Compiler Error C2872 when comipling a project using ODB with a polymorphic heirarchy Hi Jordan, Jordan J. Neuhart writes: > C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb\ > li > bodb\odb\polymorphic-info.hxx:63: error: C2872: 'database' : ambiguous > symbol > > could be > 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb > \l > ibodb\odb\database.hxx:37: odb::database' > > or > 'C:\Users\jjn\Documents\SourceCode\NewSalesDesign\sales_and_design\odb > \l > ibodb-sqlite\odb\sqlite\database.hxx:36: odb::sqlite::database' This is a fairly annoying bug in VC++ where it complains about a bogus ambiguity. The really nasty part is that it is situation dependent, which is why we didn't pick this up with our tests. Anyway, I've qualified the affected names which should work around the problem. Can you give the bug fix a try and let me know if there are still any problems? http://www.codesynthesis.com/~boris/tmp/odb/libodb-2.2.3.zip Boris From boris at codesynthesis.com Wed Jun 12 15:41:20 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 15:40:07 2013 Subject: [odb-users] Building on Debian (testing/jessie) In-Reply-To: <51B8B08F.1030001@adi-ware.ch> References: <51A7E1B3.9020705@adi-ware.ch> <51B8B08F.1030001@adi-ware.ch> Message-ID: Hi Adrian, Adrian Imboden writes: > What would be the recommended way to contribute code? For smaller things patches are probably the easiest. Do you have anything specific in mind that you would like to implement? Boris From boris at codesynthesis.com Wed Jun 12 15:44:08 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Jun 12 15:42:48 2013 Subject: [odb-users] MSVC Compiler Error C2872 when comipling a project using ODB with a polymorphic heirarchy In-Reply-To: <681FA42AB546F84C8CFDFCAA6D89A62802E727BA@husker.tlirr.local> References: <681FA42AB546F84C8CFDFCAA6D89A62802E727B6@husker.tlirr.local> <681FA42AB546F84C8CFDFCAA6D89A62802E727BA@husker.tlirr.local> Message-ID: Hi Jordan, Jordan J. Neuhart writes: > Just out of curiosity, what did you have to do to fix this bug, just in > case I run into it again later? The fix is to explicitly qualify the name. For example 'database' becomes 'odb::database'. If you run into any more of these problems, please also report them back to us so that we can fix them in the mainline code. As I mentioned earlier, it is not easy to detect all such cases automatically. So we fix them as people report them. Boris From tenchu.tarik at hotmail.fr Wed Jun 12 13:19:00 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Wed Jun 12 15:43:27 2013 Subject: [odb-users] Query Stored Procedure (SQL Server) Message-ID: Hello, I am trying to use the native view to call a stored function #pragma db view query("EXEC GetEligibleParticipant (?)") struct Preparation_View { std::string participantCode; odb::nullable lastName; odb::nullable firstName; } But I have this error during the compilation Preparation_View.hxx:13:8: error: view '::Preparation_View' has an incomplete query template and no associated objects Preparation_View.hxx:13:8: info: use db pragma query to provide a complete query template Preparation_View.hxx:13:8: info: or use db pragma object to associate one or more objects with the view Kind Regards From adrian at adi-ware.ch Wed Jun 12 15:55:31 2013 From: adrian at adi-ware.ch (Adrian Imboden) Date: Wed Jun 12 15:57:05 2013 Subject: [odb-users] Building on Debian (testing/jessie) In-Reply-To: References: <51A7E1B3.9020705@adi-ware.ch> <51B8B08F.1030001@adi-ware.ch> Message-ID: <51B8D233.6070304@adi-ware.ch> Not yet. But I like the idea to contribute if I use a free library. We'll see :). Adi PS: I'm subscribed to the mailing list Am 12.06.2013 21:41, schrieb Boris Kolpackov: > Hi Adrian, > > Adrian Imboden writes: > >> What would be the recommended way to contribute code? > > For smaller things patches are probably the easiest. Do you have > anything specific in mind that you would like to implement? > > Boris > -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3067 bytes Desc: S/MIME Kryptografische Unterschrift Url : http://codesynthesis.com/pipermail/odb-users/attachments/20130612/d7fb1a26/smime.bin From boris at codesynthesis.com Thu Jun 13 13:08:15 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 13 13:06:57 2013 Subject: [odb-users] Query Stored Procedure (SQL Server) In-Reply-To: References: Message-ID: Hi Tarik, Tarik BENZ writes: > I am trying to use the native view to call a stored function > > [...] > > But I have this error during the compilation > > Preparation_View.hxx:13:8: error: view '::Preparation_View' has an incomplete query template and no associated objects Yes, there were some parts missing for the stored procedure support. Can you try this binary for the ODB compiler and see if it works for you now: http://www.codesynthesis.com/~boris/tmp/odb/odb-2.2.2-i686-windows.zip Boris From shekli at list.ru Fri Jun 14 03:53:55 2013 From: shekli at list.ru (=?UTF-8?B?0LDQu9C10LrRgdCw0L3QtNGAINCy0LXRgNGI0LjQvdC40L0=?=) Date: Fri Jun 14 03:54:07 2013 Subject: =?UTF-8?B?UmVbMl06IFtvZGItdXNlcnNdIHNjcm9sbGFibGUgY3Vyc29ycw==?= In-Reply-To: References: <1371028581.906897635@f432.i.mail.ru> Message-ID: <1371196434.791058408@f176.mail.ru> Thanks! ?????, 12 ???? 2013, 15:15 +02:00 ?? Boris Kolpackov : >Hi Alexander, > >????????? ???????? < shekli@list.ru > writes: > >> Could you please answer does ODB support scrollable cursors with >> Postgres like ScrollableResults in hibernate? > >No, ODB result sets only support forward iteration and the reason >for this is that scrollable results, in most databases, have very >poor performance compared to the streaming ones. > >If you are looking for scrollable results in order to support >pagination, then a better option would be to use the Postgres >LIMIT and OFFSET clauses. The archives of this mailing list >have some examples, if you are interested. > >Boris -- ????????? ???????? From tenchu.tarik at hotmail.fr Fri Jun 14 04:42:49 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Fri Jun 14 05:55:25 2013 Subject: [odb-users] Query Stored Procedure (SQL Server) In-Reply-To: References: , Message-ID: Hi Boris, Thank you for the answer, Actually I solved my problem, because I wanted to call a function and not a stored procedure ("Select * from function((?))" instead of "EXEC procedure (?)"). So I can't tell you whether the binary you gave me solves this kind of problems. Thank you Tarik > Date: Thu, 13 Jun 2013 19:08:15 +0200 > From: boris@codesynthesis.com > To: tenchu.tarik@hotmail.fr > CC: odb-users@codesynthesis.com > Subject: Re: [odb-users] Query Stored Procedure (SQL Server) > > Hi Tarik, > > Tarik BENZ writes: > > > I am trying to use the native view to call a stored function > > > > [...] > > > > But I have this error during the compilation > > > > Preparation_View.hxx:13:8: error: view '::Preparation_View' has an incomplete query template and no associated objects > > Yes, there were some parts missing for the stored procedure support. > Can you try this binary for the ODB compiler and see if it works for > you now: > > http://www.codesynthesis.com/~boris/tmp/odb/odb-2.2.2-i686-windows.zip > > Boris From tenchu.tarik at hotmail.fr Fri Jun 14 06:59:10 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Fri Jun 14 07:07:09 2013 Subject: [odb-users] Retrieve data from function with native view Message-ID: Hello I have a sql server function that returns this : RETURNS @eligibleElementsTable TABLE ([participantCode] varchar(20), [lastName] varchar(512), [firstName] varchar(512), [subAccountCode] varchar(20), [participantTypeCode] varchar(20), [periodTypeCode] varchar(20), [value] float, [radiationTypeCode] varchar(20), [radiationTypeDescription] varchar(512), [componentTypeCode] varchar(20), [componentTypeDescription] varchar(512), [delayMax] int, [reset] int, [periodPreparationTime] int, [accountCode] varchar(20), [serviceCode] varchar(20)) And to call this function I have a native view : #pragma db view query("select * from GetElements(?)") struct Preparation_View { #pragma db type ("VARCHAR(20)") std::string participantCode; odb::nullable lastName; odb::nullable firstName; #pragma db type ("VARCHAR(20)") std::string subAccountCode; #pragma db type ("VARCHAR(20)") std::string participantTypeCode; #pragma db type ("VARCHAR(20)") std::string periodTypeCode; float value; #pragma db type ("VARCHAR(20)") std::string radiationTypeCode; std::string radiationTypeDescription; #pragma db type ("VARCHAR(20)") std::string componentTypeCode; std::string componentTypeDescription; odb::nullable delayMax; int reset; odb::nullable periodPreparationTime; #pragma db type ("VARCHAR(20)") std::string accountCode; #pragma db type ("VARCHAR(20)") std::string serviceCode; }; My problem is that it doesn't work because the query returns null when it should return something. Someone has an idea on what I am doing wrong? Tarik From tenchu.tarik at hotmail.fr Fri Jun 14 07:20:00 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Fri Jun 14 10:33:53 2013 Subject: [odb-users] Retrieve data from function with native view In-Reply-To: References: Message-ID: I Solved my problem! Thank you Tarik > From: tenchu.tarik@hotmail.fr > To: odb-users@codesynthesis.com > Date: Fri, 14 Jun 2013 12:59:10 +0200 > Subject: [odb-users] Retrieve data from function with native view > > Hello > > I have a sql server function that returns this : > > RETURNS @eligibleElementsTable TABLE > ([participantCode] varchar(20), > [lastName] varchar(512), > [firstName] varchar(512), > [subAccountCode] varchar(20), > [participantTypeCode] varchar(20), > [periodTypeCode] varchar(20), > [value] float, > [radiationTypeCode] varchar(20), > [radiationTypeDescription] varchar(512), > [componentTypeCode] varchar(20), > [componentTypeDescription] varchar(512), > [delayMax] int, > [reset] int, > [periodPreparationTime] int, > [accountCode] varchar(20), > [serviceCode] varchar(20)) > > And to call this function I have a native view : > > #pragma db view query("select * from GetElements(?)") > struct Preparation_View > { > #pragma db type ("VARCHAR(20)") > std::string participantCode; > odb::nullable lastName; > odb::nullable firstName; > #pragma db type ("VARCHAR(20)") > std::string subAccountCode; > #pragma db type ("VARCHAR(20)") > std::string participantTypeCode; > #pragma db type ("VARCHAR(20)") > std::string periodTypeCode; > float value; > #pragma db type ("VARCHAR(20)") > std::string radiationTypeCode; > std::string radiationTypeDescription; > #pragma db type ("VARCHAR(20)") > std::string componentTypeCode; > std::string componentTypeDescription; > odb::nullable delayMax; > int reset; > odb::nullable periodPreparationTime; > #pragma db type ("VARCHAR(20)") > std::string accountCode; > #pragma db type ("VARCHAR(20)") > std::string serviceCode; > }; > > My problem is that it doesn't work because the query > returns null when it should return something. > Someone has an idea on what I am doing wrong? > > Tarik > From boris at codesynthesis.com Fri Jun 21 10:08:00 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 21 10:08:07 2013 Subject: [odb-users] Multiple ODB 2.2.0 bugfixes released Message-ID: Hi, New bugfix releases for various ODB 2.2.0 components are now available: odb-2.2.2 (source and binaries) Various bugfixes. For the complete list, refer to the source code repository log: http://scm.codesynthesis.com/?p=odb/odb.git;a=shortlog;h=refs/heads/2.2 libodb-2.2.3 Minor bugfixes. For the complete list, refer to the source code repository log: http://scm.codesynthesis.com/?p=odb/libodb.git;a=shortlog;h=refs/heads/2.2 libodb-mssql-2.2.1 Fix for a bug in the ROWVERSION type handling. libodb-qt-2.2.1 Fix for a bug that affects applications using ODB with Qt5 in the dynamic multi-database mode. libodb-boost-2.2.1 Work around for the ambiguous name resolution bug in VC++. You can download the new packages from the ODB download page: http://www.codesynthesis.com/products/odb/download.xhtml SHA1 checksums for the files in these releases are as follows: c61a2e276ffeb2967a5ecc0fadf63d7dda862658 libodb-2.2.3.tar.bz2 44652ac83e4ed377471ed11685d9fb7ee68a2704 libodb-2.2.3.tar.gz 446807ab6060ed98b94cc1640660f29053ab3bb3 libodb-2.2.3.zip ba3eabd6d626df475c4af99ff82848ab63eba85d libodb-mssql-2.2.1.tar.bz2 fa3dc0a8c9a4bc69ff36d0f3d3c698bfdbbc62e3 libodb-mssql-2.2.1.tar.gz d29b1aa170c0df07aac9da8b49cc2cd3232e2aa2 libodb-mssql-2.2.1.zip 56eda4472ce82ae946f4fb318c00e546270d6b17 libodb-boost-2.2.1.tar.bz2 107d75a6a872c0c4b5c2e7cb87ce006c14ee4be4 libodb-boost-2.2.1.tar.gz f6831364b5fcebf0b0b5d9fd7de904cf128f3911 libodb-boost-2.2.1.zip 42294514368be823f7831dfd4adff997e6fc13f8 libodb-qt-2.2.1.tar.bz2 0c0872a60a186c4212699aec02b60cf7525efdcb libodb-qt-2.2.1.tar.gz 15e6dc9bec6ba6afb31314a0218cf04063af9fe5 libodb-qt-2.2.1.zip 9be107f0230d0b5b899d8d84a81c7bf966cf20f2 odb_2.2.2-1_amd64.deb 66c651eee6697ba7d124155213e66fd708917cab odb_2.2.2-1_i386.deb b2689632785e61da9f9dcf1d1534f2a459240d79 odb-2.2.2-1.i686.rpm b1861b68e1c51e9ebede259cffc4f7cdc8b331a2 odb-2.2.2-1.x86_64.rpm fbda36df7438e5d4ee811c92e7abc6033063c14e odb-2.2.2-i686-linux-gnu.tar.bz2 fcf9c9de67f9ccfe308c16731fb0fb9f029a2a0a odb-2.2.2-i686-macosx.tar.bz2 33eaeff615576cfcae0a3343a4a1732ed869de28 odb-2.2.2-i686-solaris.tar.bz2 d4189181f15b768b4446ddce2d07cb3d531018d4 odb-2.2.2-i686-windows.zip c667f6081387a7f5d8d71783b36c3a92194369cc odb-2.2.2-sparc-solaris.tar.bz2 172a2376c4e048933f31eec9ee2f26cc39c6e80f odb-2.2.2-x86_64-linux-gnu.tar.bz2 c7a03600a4e4da4246705d1b78de6725179a0a4e odb-2.2.2.tar.bz2 f461e28658ed9546d95efaa8d25f92f59b895311 odb-2.2.2.tar.gz c0c4b5808cb631fd2ec44553a18a168886b00627 odb-2.2.2.zip Boris From tenchu.tarik at hotmail.fr Mon Jun 24 04:26:38 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Mon Jun 24 05:17:34 2013 Subject: [odb-users] Create New Object Message-ID: Hello, I have an a class like this : class MyClass { std::shared_ptr foo; } My question is : "MyOtherClass" refers to a database table. To create a new "MyClass" object, do I need to retrieve the data into "MyOtherClass" from the database then affect this object to "foo" or I can just use the "ID" of the "MyOtherClass"? Because for the moment I load all the "MyOtherClass" data from the database, then I try to find the correct entry with it's "ID". I am not sure It is the correct way because it is really too heavy to do this! Thank you in advance for your help. Tarik From macromarship at gmail.com Mon Jun 24 06:27:50 2013 From: macromarship at gmail.com (Scott Zhang) Date: Mon Jun 24 06:27:58 2013 Subject: [odb-users] Create New Object In-Reply-To: References: Message-ID: Hi. Tarik. If you create MyClass directly. the foo within it will be null, or uninitialized. On Mon, Jun 24, 2013 at 4:26 PM, Tarik BENZ wrote: > Hello, > > I have an a class like this : > > class MyClass > { > std::shared_ptr foo; > } > > My question is : > "MyOtherClass" refers to a database table. > To create a new "MyClass" object, do I need to retrieve the data > into "MyOtherClass" from the database then affect this object to "foo" > or I can just use the "ID" of the "MyOtherClass"? > Because for the moment I load all the "MyOtherClass" data from the > database, > then I try to find the correct entry with it's "ID". I am not sure It is > the correct way > because it is really too heavy to do this! > > Thank you in advance for your help. > Tarik > From macromarship at gmail.com Mon Jun 24 06:42:36 2013 From: macromarship at gmail.com (Scott Zhang) Date: Mon Jun 24 06:42:43 2013 Subject: [odb-users] Create New Object In-Reply-To: References: Message-ID: I suggest you auto load that in your construct. On Mon, Jun 24, 2013 at 6:39 PM, Tarik BENZ wrote: > Hello Scott, > > Thank you for the answer, > Actually what I want is : > I have an "ID" for an entry to MyOtherClass table > I want to create a new "MyClass" and affect the "ID" the the foo object. > > Kind Regards, > Tarik > > ------------------------------ > Date: Mon, 24 Jun 2013 18:27:50 +0800 > Subject: Re: [odb-users] Create New Object > From: macromarship@gmail.com > To: tenchu.tarik@hotmail.fr > CC: odb-users@codesynthesis.com > > > Hi. Tarik. > If you create MyClass directly. the foo within it will be null, or > uninitialized. > > > > > On Mon, Jun 24, 2013 at 4:26 PM, Tarik BENZ wrote: > > Hello, > > I have an a class like this : > > class MyClass > { > std::shared_ptr foo; > } > > My question is : > "MyOtherClass" refers to a database table. > To create a new "MyClass" object, do I need to retrieve the data > into "MyOtherClass" from the database then affect this object to "foo" > or I can just use the "ID" of the "MyOtherClass"? > Because for the moment I load all the "MyOtherClass" data from the > database, > then I try to find the correct entry with it's "ID". I am not sure It is > the correct way > because it is really too heavy to do this! > > Thank you in advance for your help. > Tarik > > > > From tenchu.tarik at hotmail.fr Mon Jun 24 06:39:55 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Mon Jun 24 06:43:19 2013 Subject: [odb-users] Create New Object In-Reply-To: References: , Message-ID: Hello Scott, Thank you for the answer, Actually what I want is : I have an "ID" for an entry to MyOtherClass table I want to create a new "MyClass" and affect the "ID" the the foo object. Kind Regards, Tarik Date: Mon, 24 Jun 2013 18:27:50 +0800 Subject: Re: [odb-users] Create New Object From: macromarship@gmail.com To: tenchu.tarik@hotmail.fr CC: odb-users@codesynthesis.com Hi. Tarik. If you create MyClass directly. the foo within it will be null, or uninitialized. On Mon, Jun 24, 2013 at 4:26 PM, Tarik BENZ wrote: Hello, I have an a class like this : class MyClass { std::shared_ptr foo; } My question is : "MyOtherClass" refers to a database table. To create a new "MyClass" object, do I need to retrieve the data into "MyOtherClass" from the database then affect this object to "foo" or I can just use the "ID" of the "MyOtherClass"? Because for the moment I load all the "MyOtherClass" data from the database, then I try to find the correct entry with it's "ID". I am not sure It is the correct way because it is really too heavy to do this! Thank you in advance for your help. Tarik From boris at codesynthesis.com Mon Jun 24 06:47:57 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 24 06:48:04 2013 Subject: [odb-users] Create New Object In-Reply-To: References: Message-ID: Hi Tarik, Tarik BENZ writes: > class MyClass > { > std::shared_ptr foo; > } > > To create a new "MyClass" object, do I need to retrieve the data > into "MyOtherClass" from the database then affect this object to "foo" > or I can just use the "ID" of the "MyOtherClass"? Lazy pointers allow you to create "unloaded" pointers with just the object id. See Section 6.4, "Lazy Pointers" in the ODB manual, specifically, the example at the end of this section. Boris From tenchu.tarik at hotmail.fr Mon Jun 24 07:59:43 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Mon Jun 24 08:16:40 2013 Subject: [odb-users] Create New Object In-Reply-To: References: , Message-ID: Hello Boris, Thanks for your answer, I have changed my code to use the lazy pointers, but I have this error when I am trying to call "load()" method : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Foo *' (or there is no acceptable conversion) lazy-ptr.ixx this is how I use it : const std::shared_ptr getRefFoo() const { return this->currentObject->getRefFoo().load(); } const odb::lazy_shared_ptr getRefFoo() const { return this->ref_Foo; } Can you tell me what I am doing wrong here? Thank you, Tarik > Date: Mon, 24 Jun 2013 12:47:57 +0200 > From: boris@codesynthesis.com > To: tenchu.tarik@hotmail.fr > CC: odb-users@codesynthesis.com > Subject: Re: [odb-users] Create New Object > > Hi Tarik, > > Tarik BENZ writes: > > > class MyClass > > { > > std::shared_ptr foo; > > } > > > > To create a new "MyClass" object, do I need to retrieve the data > > into "MyOtherClass" from the database then affect this object to "foo" > > or I can just use the "ID" of the "MyOtherClass"? > > Lazy pointers allow you to create "unloaded" pointers with just the > object id. See Section 6.4, "Lazy Pointers" in the ODB manual, > specifically, the example at the end of this section. > > Boris From boris at codesynthesis.com Mon Jun 24 08:24:19 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Jun 24 08:30:52 2013 Subject: [odb-users] Create New Object In-Reply-To: References: Message-ID: Hi Tarik, Tarik BENZ writes: > error C2679: binary '=' : no operator found which takes a right-hand > operand of type 'Foo *' (or there is no acceptable conversion) lazy-ptr.ixx Which line does the error point to? You need to *always* provide this information! I keep telling you to include all the relevant information in your emails and you keep ignoring me. Next time you ask a question that doesn't include everything -- I am ignore you. > this is how I use it : > > const std::shared_ptr getRefFoo() const > { > return this->currentObject->getRefFoo().load(); > } > > const odb::lazy_shared_ptr getRefFoo() const > { > return this->ref_Foo; > } This doesn't make any sense to me. Is the first function calling the second? If that's the case, then perhaps it doesn't work because load() is not const? Generally, it is a bad idea to call load() in accessors since it can only be called within a transaction. Boris From tenchu.tarik at hotmail.fr Mon Jun 24 08:33:18 2013 From: tenchu.tarik at hotmail.fr (Tarik BENZ) Date: Mon Jun 24 08:38:56 2013 Subject: [odb-users] Create New Object In-Reply-To: References: , , , Message-ID: Line 1132 > Date: Mon, 24 Jun 2013 14:24:19 +0200 > From: boris@codesynthesis.com > To: tenchu.tarik@hotmail.fr > CC: odb-users@codesynthesis.com > Subject: Re: [odb-users] Create New Object > > Hi Tarik, > > Tarik BENZ writes: > > > error C2679: binary '=' : no operator found which takes a right-hand > > operand of type 'Foo *' (or there is no acceptable conversion) lazy-ptr.ixx > > Which line does the error point to? You need to *always* provide this > information! I keep telling you to include all the relevant information > in your emails and you keep ignoring me. Next time you ask a question > that doesn't include everything -- I am ignore you. > > > > this is how I use it : > > > > const std::shared_ptr getRefFoo() const > > { > > return this->currentObject->getRefFoo().load(); > > } > > > > const odb::lazy_shared_ptr getRefFoo() const > > { > > return this->ref_Foo; > > } > > This doesn't make any sense to me. Is the first function calling > the second? If that's the case, then perhaps it doesn't work > because load() is not const? > > Generally, it is a bad idea to call load() in accessors since > it can only be called within a transaction. > > Boris From info at peredin.com Mon Jun 24 18:49:36 2013 From: info at peredin.com (Per Edin) Date: Mon Jun 24 18:49:45 2013 Subject: [odb-users] ODB and CMake Message-ID: Hi! I'm using ODB with CMake and after digging around the web I decided to write a CMake module to make things easier. You can get a copy of the module at and more information is available at . Keep in mind it's a beta version; it works here but may not work over there. After some testing perhaps a link to it can be added to the Wiki. :) Comments, ideas, bug reports, and such are welcome! Have fun! From lidia at lemur-soft.com Tue Jun 25 01:46:37 2013 From: lidia at lemur-soft.com (Lidia Kalinovsky) Date: Tue Jun 25 01:46:44 2013 Subject: [odb-users] support for Windows RT Message-ID: Hello, Does ODB support Window RT ? If yes, can somebody share compilations instructions/tips ? Thanks in advance. Lidia -- Software integration and outsourcing services, Lemur-Soft, Giv'at Nili Israel, 37825 Phone : (+972) 545748325 Fax : (+972) 775345383 Email : lidia@lemur-soft.com Web: www.lemur-soft.com From boris at codesynthesis.com Tue Jun 25 07:09:33 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 25 07:09:40 2013 Subject: [odb-users] ODB and CMake In-Reply-To: References: Message-ID: Hi Per, Per Edin writes: > I'm using ODB with CMake and after digging around the web I decided to > write a CMake module to make things easier. We have a Wiki page for this and there is a link to one of the earlier attempts: http://wiki.codesynthesis.com/Using_ODB_with_CMake Not sure if you saw this. > You can get a copy of the module at > and more > information is available at . Great, thanks for sharing this! > Keep in mind it's a beta version; it works here but may not work over > there. After some testing perhaps a link to it can be added to the > Wiki. :) Yes, let me know when you are comfortable with me adding a link to the Wiki and I will be happy to do it. Boris From boris at codesynthesis.com Tue Jun 25 07:58:09 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Jun 25 07:58:16 2013 Subject: [odb-users] support for Windows RT In-Reply-To: References: Message-ID: Hi Lidia, Lidia Kalinovsky writes: > Does ODB support Window RT ? > If yes, can somebody share compilations instructions/tips ? Hm, I haven't heard of anyone using ODB with Windows RT yet. I, however, did a bit of reading and I think it should be possible (I assume you are interested in using ODB with SQLite in a native C++ WinRT application). In particular, I found this series of blog posts very useful: http://blogs.msdn.com/b/chuckw/archive/2012/09/17/dual-use-coding-techniques-for-games.aspx ODB only uses Win32 functions for concurrency. While I believe most of them are available for Windows Store applications, the one set that is not is the thread creation/termination functions. If you don't need to access an ODB database from multiple threads, then it will probably be the easiest to just disable thread support in ODB. Alternatively, it should be possible to provide a WinRT-based implementationw of the threading classes in ODB either using the thread pool facility or the C++11 API. But the first thing I would try is to disable threads and see if you can build libodb and libodb-sqlite. And also SQLite. BTW, have you tried that already? For libodb, I would try these steps: 1a. See if you can add a new target (for Windows RT/ARM) to the existing VS 2012 project. 1b. If that doesn't work, then I guess we will need to create a new project from scratch (could be easier to make it a static library to start with). 2. Edit the odb/details/config-vc.h file and change ODB_THREADS_WIN32 to ODB_THREADS_NONE. 3. Try to build the library and see what happens. I couldn't try these steps myself since apparently to develop a WinRT application you need Windows 8 (all my current VMs are Win 7). I can try to find time and give it a shot if there is interest. Boris From lidia at lemur-soft.com Tue Jun 25 08:14:59 2013 From: lidia at lemur-soft.com (Lidia Kalinovsky) Date: Tue Jun 25 08:15:07 2013 Subject: [odb-users] support for Windows RT In-Reply-To: References: Message-ID: Thanks a lot for quick response and info - I'll look at it. We don't need thread support. I am at stage of adding of new target to existing project - still without big success. it will be really helpful if project with such target could be provided. Lidia. On Tue, Jun 25, 2013 at 2:58 PM, Boris Kolpackov wrote: > Hi Lidia, > > Lidia Kalinovsky writes: > > > Does ODB support Window RT ? > > If yes, can somebody share compilations instructions/tips ? > > Hm, I haven't heard of anyone using ODB with Windows RT yet. > > I, however, did a bit of reading and I think it should be possible > (I assume you are interested in using ODB with SQLite in a native > C++ WinRT application). In particular, I found this series of blog > posts very useful: > > > http://blogs.msdn.com/b/chuckw/archive/2012/09/17/dual-use-coding-techniques-for-games.aspx > > ODB only uses Win32 functions for concurrency. While I believe > most of them are available for Windows Store applications, the one > set that is not is the thread creation/termination functions. > > If you don't need to access an ODB database from multiple threads, > then it will probably be the easiest to just disable thread support > in ODB. > > Alternatively, it should be possible to provide a WinRT-based > implementationw of the threading classes in ODB either using the > thread pool facility or the C++11 API. > > But the first thing I would try is to disable threads and see if you > can build libodb and libodb-sqlite. And also SQLite. BTW, have you > tried that already? > > For libodb, I would try these steps: > > 1a. See if you can add a new target (for Windows RT/ARM) to the > existing VS 2012 project. > > 1b. If that doesn't work, then I guess we will need to create a > new project from scratch (could be easier to make it a static > library to start with). > > 2. Edit the odb/details/config-vc.h file and change ODB_THREADS_WIN32 > to ODB_THREADS_NONE. > > 3. Try to build the library and see what happens. > > I couldn't try these steps myself since apparently to develop a > WinRT application you need Windows 8 (all my current VMs are Win 7). > I can try to find time and give it a shot if there is interest. > > Boris > -- Software integration and outsourcing services, Lemur-Soft, Giv'at Nili Israel, 37825 Phone : (+972) 545748325 Fax : (+972) 775345383 Email : lidia@lemur-soft.com Web: www.lemur-soft.com From info at peredin.com Tue Jun 25 15:39:41 2013 From: info at peredin.com (Per Edin) Date: Tue Jun 25 15:39:50 2013 Subject: [odb-users] ODB and CMake In-Reply-To: References: Message-ID: Hi Boris, Yes, I found that one when I was looking for a solution. :) You're free to add my link to the wiki at any time. Perhaps that will spread it even further and increase the amount of feedback! I discovered in my logs that some browsers/e-mail clients don't ignore the angle-brackets properly, so here are the two links again, without angles: http://download.peredin.com/get/odb/odb-cmake-0.1.tar.gz http://peredin.com/odb.cmake/ Per On Tue, Jun 25, 2013 at 1:09 PM, Boris Kolpackov wrote: > Hi Per, > > Per Edin writes: > >> I'm using ODB with CMake and after digging around the web I decided to >> write a CMake module to make things easier. > > We have a Wiki page for this and there is a link to one of the earlier > attempts: > > http://wiki.codesynthesis.com/Using_ODB_with_CMake > > Not sure if you saw this. > > >> You can get a copy of the module at >> and more >> information is available at . > > Great, thanks for sharing this! > > >> Keep in mind it's a beta version; it works here but may not work over >> there. After some testing perhaps a link to it can be added to the >> Wiki. :) > > Yes, let me know when you are comfortable with me adding a link to the > Wiki and I will be happy to do it. > > Boris From adam at navigatesurgical.com Wed Jun 26 16:32:16 2013 From: adam at navigatesurgical.com (Adam Walters) Date: Thu Jun 27 06:28:54 2013 Subject: [odb-users] Problems with ODB/MySQL and boost::posix_time recording sub-second values Message-ID: Hi, I am in the process of evaluating ODB and I was trying to create a simple event log table as part of that test. I was thrilled to note that MySQL has finally decided to support sub-second times in the form of TIMESTAMP(6) and DATETIME(6). After adding the appropriate pragma to my record object: #pragma db object class EventRecord { public: EventRecord(const std::string& eventMessage, boost::posix_time::ptime localTime) :_eventId(0), _eventMessage(eventMessage),_localTime(localTime) {} private: EventRecord() {} friend class odb::access; #pragma db id auto unsigned long _eventId; const std::string _eventMessage; #pragma db type("TIMESTAMP(6)") not_null boost::posix_time::ptime _localTime; }; the OBD compiler dutifully spat out the correct SQL for the table: CREATE TABLE `EventRecord` ( `eventId` BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, `eventMessage` TEXT NOT NULL, `localTime` TIMESTAMP(6) NOT NULL) When I run my example, however, the fractional time part for each record is stuck at zero. Is there something I am missing in the process that will enable this? Thanks, Adam From boris at codesynthesis.com Thu Jun 27 07:42:49 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 27 07:42:57 2013 Subject: [odb-users] Problems with ODB/MySQL and boost::posix_time recording sub-second values In-Reply-To: References: Message-ID: Hi Adam, Adam Walters writes: > I was thrilled to note that MySQL has finally decided to support > sub-second times in the form of TIMESTAMP(6) and DATETIME(6). > > [...] > > When I run my example, however, the fractional time part for each > record is stuck at zero. We just haven't had a chance to update the code yet. I went ahead and implemented this, however, I haven't had a chance to test it (still waiting for a VM with MySQL 5.6). If you want to give it a try in the meantime, here is the updated boost profile: http://www.codesynthesis.com/~boris/tmp/odb/libodb-boost-2.2.2.tar.gz If you do, please let us know whether it works/doesn't work for you. Boris From boris at codesynthesis.com Thu Jun 27 07:55:44 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Jun 27 07:55:52 2013 Subject: [odb-users] ODB and CMake In-Reply-To: References: Message-ID: Hi Per, Per Edin writes: > You're free to add my link to the wiki at any time. Done: http://wiki.codesynthesis.com/Using_ODB_with_CMake Let me know if you see anything wrong with the text. Thanks, Boris From info at peredin.com Fri Jun 28 01:57:41 2013 From: info at peredin.com (Per Edin) Date: Fri Jun 28 01:57:50 2013 Subject: [odb-users] ODB and CMake In-Reply-To: References: Message-ID: Hi Boris, The text is just fine. Thank you! Per On Thu, Jun 27, 2013 at 1:55 PM, Boris Kolpackov wrote: > Hi Per, > > Per Edin writes: > >> You're free to add my link to the wiki at any time. > > Done: http://wiki.codesynthesis.com/Using_ODB_with_CMake > > Let me know if you see anything wrong with the text. > > Thanks, > Boris From adam at navigatesurgical.com Thu Jun 27 17:21:42 2013 From: adam at navigatesurgical.com (Adam Walters) Date: Fri Jun 28 02:57:51 2013 Subject: [odb-users] Problems with ODB/MySQL and boost::posix_time recording sub-second values In-Reply-To: References: Message-ID: <01371c5ae93b4634b6a03e9650b88437@BLUPR02MB114.namprd02.prod.outlook.com> Hi Boris, Thanks for getting me a new library so quickly. My tests so far don't show a difference and I wonder if I am missing a vital step? I rebuilt the library from the code you provided and modified the reference in the linker for the executable I am building to use the new library. I even re-ran the ODB compiler on my class for good measure, but still no result. Any suggestions? Cheers, Adam -----Original Message----- From: Boris Kolpackov [mailto:boris@codesynthesis.com] Sent: June-27-13 4:43 AM To: Adam Walters Cc: odb-users@codesynthesis.com Subject: Re: [odb-users] Problems with ODB/MySQL and boost::posix_time recording sub-second values Hi Adam, Adam Walters writes: > I was thrilled to note that MySQL has finally decided to support > sub-second times in the form of TIMESTAMP(6) and DATETIME(6). > > [...] > > When I run my example, however, the fractional time part for each > record is stuck at zero. We just haven't had a chance to update the code yet. I went ahead and implemented this, however, I haven't had a chance to test it (still waiting for a VM with MySQL 5.6). If you want to give it a try in the meantime, here is the updated boost profile: http://www.codesynthesis.com/~boris/tmp/odb/libodb-boost-2.2.2.tar.gz If you do, please let us know whether it works/doesn't work for you. Boris From boris at codesynthesis.com Fri Jun 28 03:50:05 2013 From: boris at codesynthesis.com (Boris Kolpackov) Date: Fri Jun 28 03:50:11 2013 Subject: [odb-users] Problems with ODB/MySQL and boost::posix_time recording sub-second values In-Reply-To: <01371c5ae93b4634b6a03e9650b88437@BLUPR02MB114.namprd02.prod.outlook.com> References: <01371c5ae93b4634b6a03e9650b88437@BLUPR02MB114.namprd02.prod.outlook.com> Message-ID: Hi Adam, Adam Walters writes: > My tests so far don't show a difference and I wonder if I am missing a > vital step? Some things to try: 1. Rebuild your test completely. 2. Make sure you are using MySQL server 5.6.4 or later. That's where sub-second support was added. 3. It is also quite possible that you have to use the client library (libmysqlclient) from MySQL 5.6.4 or later since earlier versions might not send the sub-second part to the server. Otherwise I should have the VM with MySQL 5.6 ready on Monday and then I will figure it out. Boris From lidia at lemur-soft.com Fri Jun 28 07:43:29 2013 From: lidia at lemur-soft.com (Lidia Kalinovsky) Date: Fri Jun 28 07:43:36 2013 Subject: [odb-users] problem to create library with odb Message-ID: Hello I am trying to create some wrapper library using odb and the use it from some another place. More specific: 1. Create empty library project and copy all files from some provided with odb example ( relationship-sqlite ). 2. in driver.cxx, instead of main, declare some class (let's say class A ) and place all code from main code to some function of this class ( let's say a() ). Now we have library with class A that I would like to use at some another place. 3. create empty console application project , and just call function A obj; obj.a(); from above. I get odb::unknown_schema exception from create_database function. If I include all *.cxx files generated by odb compiler to the the calling application project, everything is fine. If possible, I would like to not do it, but rather hide them inside wrapper library. Could you advice please ? Thanks. Lidia. -- Software integration and outsourcing services, Lemur-Soft, Giv'at Nili Israel, 37825 Phone : (+972) 545748325 Fax : (+972) 775345383 Email : lidia@lemur-soft.com Web: www.lemur-soft.com