From bhartsb at gmail.com Tue Mar 1 18:33:59 2011 From: bhartsb at gmail.com (B Hart) Date: Tue Mar 1 18:34:06 2011 Subject: [odb-users] When is there going to be support for MS SQL? Message-ID: When is there going to be support for MS SQL? Also, with regard to the dynamic generation of DB schema: Is the Schema generation able to do any kind of normalization? E.g. If I had a Person Class and it contained address information, would I need to create a separate class for each or could it use one class and create 2 tables. I'm sort of assuming not. Thanks. From boris at codesynthesis.com Wed Mar 2 08:45:11 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Mar 2 08:43:58 2011 Subject: [odb-users] Passing persistence object to smart pointer In-Reply-To: <717242.83814.qm@web29006.mail.ird.yahoo.com> References: <717242.83814.qm@web29006.mail.ird.yahoo.com> Message-ID: Hi, In the future please keep your replies CC'ed to the odb-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Bright Dadson writes: > Is it possible to use boost::shared_ptr instead of std::auto_ptr as > the --default-pointer defintion for odb? if so, how do I pass > boost::shared_ptr as param to the odb codegen. Not at the moment, but we are working on the ODB profile for Boost which will allow this quite easily. We plan to release this in the next week or two. In the meantime, you can use std::tr1::shared_ptr (which has the Boost shared_ptr interface). To do this, simply add the following option to the ODB command line: --default-pointer std::tr1::shared_ptr And use std::tr1::shared_ptr instead of boost::shared_ptr in your code. Boris From boris at codesynthesis.com Wed Mar 2 08:50:09 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Mar 2 08:48:58 2011 Subject: [odb-users] When is there going to be support for MS SQL? In-Reply-To: References: Message-ID: Hi, B Hart writes: > When is there going to be support for MS SQL? The current roadmap is to have this support publicly available in about 3-4 months, perhaps earlier for beta testing. > Also, with regard to the dynamic generation of DB schema: Is the Schema > generation able to do any kind of normalization? E.g. If I had a Person > Class and it contained address information, would I need to create a > separate class for each or could it use one class and create 2 tables. No, if you want the address to be stored in a separate table, then you will need to create a separate persistent class for it. Then, in the Person class you can have a pointer to the address which will be translated to a reference in the database. Boris From bhartsb at gmail.com Wed Mar 2 11:40:26 2011 From: bhartsb at gmail.com (B Hart) Date: Wed Mar 2 11:40:35 2011 Subject: [odb-users] When is there going to be support for MS SQL? In-Reply-To: References: Message-ID: I wish it was available now. I would like to use MySQL, but unfortunately that is not an option:( Not withstanding, nice work! Good documentation as well. On Wed, Mar 2, 2011 at 5:50 AM, Boris Kolpackov wrote: > Hi, > > B Hart writes: > > > When is there going to be support for MS SQL? > > The current roadmap is to have this support publicly available in about 3-4 > months, perhaps earlier for beta testing. > > > > Also, with regard to the dynamic generation of DB schema: Is the Schema > > generation able to do any kind of normalization? E.g. If I had a Person > > Class and it contained address information, would I need to create a > > separate class for each or could it use one class and create 2 tables. > > No, if you want the address to be stored in a separate table, then you will > need to create a separate persistent class for it. Then, in the Person > class > you can have a pointer to the address which will be translated to a > reference > in the database. > > Boris > From boris at codesynthesis.com Thu Mar 3 07:17:43 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Mar 3 07:16:49 2011 Subject: [odb-users] When is there going to be support for MS SQL? In-Reply-To: References: Message-ID: Hi, B Hart writes: > I wish it was available now. I would like to use MySQL, but unfortunately > that is not an option:( Can't you start with MySQL and then switch to MS SQL? If you don't do anything MySQL-specific, then switching to MS SQL will be just a matter of recompiling with a different --database option. > Not withstanding, nice work! Good documentation as well. Thanks! Boris From losintikfos at yahoo.co.uk Wed Mar 2 12:27:36 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Thu Mar 3 07:17:22 2011 Subject: [odb-users] Passing persistence object to smart pointer Message-ID: <226951.74013.qm@web29005.mail.ird.yahoo.com> I have compiled my person.h file successfully with --default-pointer std::tr1::shared_ptr option. Now when I attempt to build the project, I end up with below exception: g++??? -c -MMD -MP -MF build/Debug/GNU-Linux-x86/_ext/1294481841/person-odb.o.d -o build/Debug/GNU-Linux-x86/_ext/1294481841/person-odb.o /root/Documents/project/test/person-odb.cxx ???????????????? from /root/Documents/project/test/person-odb.cxx:12: In file included from /root/Documents/project/test/person-odb.hxx:29, /usr/local/include/odb/tr1/pointer-traits.hxx:23: error: ?tr1? is not a member of ?std? /usr/local/include/odb/tr1/pointer-traits.hxx:23: error: ?tr1? is not a member of ?std? /usr/local/include/odb/tr1/pointer-traits.hxx:23: error: template argument 1 is invalid /usr/local/include/odb/tr1/pointer-traits.hxx:69: error: ?tr1? is not a member of ?std? /usr/local/include/odb/tr1/pointer-traits.hxx:69: error: ?tr1? is not a member of ?std? /usr/local/include/odb/tr1/pointer-traits.hxx:69: error: template argument 1 is invalid Do anyone know what I might be doing wrong? --- On Wed, 2/3/11, Bright Dadson wrote: Thanks Boris! Will remember to CC'ed odb-users mailing next time - It did escaped me! B --- On Wed, 2/3/11, Boris Kolpackov wrote: Hi, In the future please keep your replies CC'ed to the odb-users mailing list as discussed in the posting guidelines: http://www.codesynthesis.com/support/posting-guidelines.xhtml Bright Dadson writes: > Is it possible to use boost::shared_ptr instead of std::auto_ptr as > the --default-pointer defintion for odb? if so, how do I pass > boost::shared_ptr as param to the odb codegen. Not at the moment, but we are working on the ODB profile for Boost which will allow this quite easily. We plan to release this in the next week or two. In the meantime, you can use std::tr1::shared_ptr (which has the Boost shared_ptr interface). To do this, simply add the following option to the ODB command line: --default-pointer std::tr1::shared_ptr And use std::tr1::shared_ptr instead of boost::shared_ptr in your code. Boris From boris at codesynthesis.com Thu Mar 3 07:25:59 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Mar 3 07:24:57 2011 Subject: [odb-users] Passing persistence object to smart pointer In-Reply-To: <226951.74013.qm@web29005.mail.ird.yahoo.com> References: <226951.74013.qm@web29005.mail.ird.yahoo.com> Message-ID: Hi, Bright Dadson writes: > I have compiled my person.h file successfully with --default-pointer > std::tr1::shared_ptr option. > > Now when I attempt to build the project, I end up with below exception: You will need to include the header declaring std::tr1::shared_ptr either in person.h or in the generated code (using --hxx-prologue option). For GCC this header is: #include Boris From bhartsb at gmail.com Thu Mar 3 11:36:35 2011 From: bhartsb at gmail.com (B Hart) Date: Thu Mar 3 11:36:43 2011 Subject: [odb-users] When is there going to be support for MS SQL? In-Reply-To: References: Message-ID: I don't need to use anything MS SQL specific, but I'll need to be working with our production MS SQL Server within a 1 month time frame. It is for my work and I have no choice in the RDBMS. On Thu, Mar 3, 2011 at 4:17 AM, Boris Kolpackov wrote: > Hi, > > B Hart writes: > > > I wish it was available now. I would like to use MySQL, but unfortunately > > that is not an option:( > > Can't you start with MySQL and then switch to MS SQL? If you don't do > anything MySQL-specific, then switching to MS SQL will be just a matter > of recompiling with a different --database option. > > > > Not withstanding, nice work! Good documentation as well. > > Thanks! > > Boris > From boris at codesynthesis.com Mon Mar 7 07:52:35 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Mar 7 07:51:54 2011 Subject: [odb-users] When is there going to be support for MS SQL? In-Reply-To: References: Message-ID: Hi, B Hart writes: > I don't need to use anything MS SQL specific, but I'll need to be working > with our production MS SQL Server within a 1 month time frame. Yes, this is a bit tight. Boris From aphongka at gmail.com Thu Mar 10 05:17:56 2011 From: aphongka at gmail.com (Alexey Afanasyev) Date: Thu Mar 10 05:18:05 2011 Subject: [odb-users] Memory leaks with odb/mysql/database.hxx Message-ID: Hi, I am using boost/test which reports memory leaks in my odb project (static library). I tried to isolate the problematic area and it seems to be somewhere in odb/mysql/database.hxx. I created and empty test case but the test still reports memory leak until I remove # include I have not been able to locate the problem in the odb code yet. What could cause it? Thanks. From boris at codesynthesis.com Thu Mar 10 05:34:31 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Mar 10 05:34:16 2011 Subject: [odb-users] Memory leaks with odb/mysql/database.hxx In-Reply-To: References: Message-ID: Hi Alexey, Alexey Afanasyev writes: > I am using boost/test which reports memory leaks in my odb project > (static library). I tried to isolate the problematic area and it seems > to be somewhere in odb/mysql/database.hxx. I created and empty test > case but the test still reports memory leak until I remove # include > > > I have not been able to locate the problem in the odb code yet. What > could cause it? This is very strange. The odb/mysql/database.hxx header contains class declarations, so it is not clear to me how simply including it can cause a memory leak. Does the test provide any pointers to where the leak comes from (e.g., a stack trace)? Also, which platform are you trying this on? If you are on Linux, you may want to try valgrind. In fact, we extensively test every release for memory leaks with this tool. So I would be very surprised if the boost/test report is not bogus. Boris From aphongka at gmail.com Thu Mar 10 10:31:18 2011 From: aphongka at gmail.com (Alexey Afanasyev) Date: Thu Mar 10 10:31:25 2011 Subject: [odb-users] Memory leaks with odb/mysql/database.hxx In-Reply-To: References: Message-ID: Hi Boris, On Thu, Mar 10, 2011 at 1:34 PM, Boris Kolpackov wrote: > Also, which platform are you trying this on? If you are on Linux, you > may want to try valgrind. In fact, we extensively test every release > for memory leaks with this tool. So I would be very surprised if the > boost/test report is not bogus. Unfortunately, it is VS2008. Actually, it was visual studio crt which reported memory leaks. For some reason, VS does not report any issue when I debug inside the IDE, but when I run an executable from command line, it does. It seems to be a kind of tricky interaction between crt, boost/test and odb. I still have not found the reason. I have created a simple VS2008 solution which does not require any real database but shows the memory leak issue. If you have an opportunity to take a look (you need VS & boost) I'd send it to you. Is it OK to post it as an attachment in the list or shall i sent it in private? Alexey From boris at codesynthesis.com Thu Mar 10 10:47:18 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Mar 10 10:46:56 2011 Subject: [odb-users] Memory leaks with odb/mysql/database.hxx In-Reply-To: References: Message-ID: Hi Alexey, Alexey Afanasyev writes: > I have created a simple VS2008 solution which does not require any > real database but shows the memory leak issue. If you have an > opportunity to take a look (you need VS & boost) I'd send it to you. Yes, please. > Is it OK to post it as an attachment in the list or shall i sent it in > private? You can send it to me directly. I will then post what I find to the list. Boris From boris at codesynthesis.com Wed Mar 16 07:45:27 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Mar 16 07:45:43 2011 Subject: [odb-users] ODB 1.2.0 released Message-ID: Hi, We have released ODB 1.2.0. The NEWS file entries for this release are as follows: * New profile, boost, provides persistence support for the Boost libraries. This version covers the most commonly used types from the smart_ptr, unordered, and date_time libraries. For example, now you can write: #pragma db object class employee { ... boost::gregorian::date born_; boost::unordered_set emails_; boost::shared_ptr employer_; }; The boost profile implementation is provided by the libodb-boost library. For more information refer to Chapter 11, "Profiles Introduction" and Chapter 12, "Boost Profile" in the ODB manual as well as the 'boost' example in the odb-examples package. * Support for embedded database schemas. The new option, --schema-format, allows the selection of the schema format. The valid values for this option are 'sql' for a standalone SQL file and 'embedded' for a schema embedded into the generated C++ code. The new odb::schema_catalog class provides support for accessing embedded schemas from within the application. For details refer to Section 3.3, "Database" in the ODB manual as well as the 'schema/embedded' example in the odb-examples package. * New exceptions: odb::recoverable, odb::connection_lost, and odb::timeout. The odb::recoverable exception is a common base class for all recoverable ODB exceptions. The other two exceptions plus odb::deadlock now inherit from this base. Refer to Section 3.5, "Error Handling and Recovery" for details. * Support for connection validation (ping) in MySQL connection_pool_factory. This transparently deals with the MySQL server closing connections after a certain period of inactivity. * New namespace, odb::core, contains using-declarations for the core ODB constructs, such as the database, transaction, etc. The primary use of this namespace is in the using-directives: using namespace odb::core; The above form should be preferred over the old variant: using namespace odb; The new approach brings all the essential ODB names into the current namespace without any of the auxiliary objects such as traits, etc., which minimizes the likelihood of conflicts with other libraries. Note that you should still use the odb namespace when qualifying individual names, for example, odb::database. * New option aliases: -q for --generate-query and -s for --generate-schema. * Support for the default options file. Now, if configured, the ODB compiler loads the default options file (by default ../etc/odb/default.options, relative to the ODB compiler binary). This file can be used for installation-wide customization, such as adding extra include search paths. Source code and pre-compiled binary packages for this release are available from the ODB download page: http://www.codesynthesis.com/products/odb/download.xhtml SHA1 checksums for the files in this release are as follows: 366bb4fdd9c900a5b5cd47930ccab99d4f7120fa libodb-1.2.0.tar.bz2 7ae7d005f58696df8ed787d95c7fdfa4fbac3ede libodb-1.2.0.tar.gz 5a14afdacc489930dfbe2612c9c6f6f4e7a2d3c3 libodb-1.2.0.zip e7b050ecf17a7b625b3356ca54c18122506c579a libodb-boost-1.2.0.tar.bz2 79e3b68fe6512d03a9cf8b91bfcfe6d11b68455e libodb-boost-1.2.0.tar.gz bd1fee06f547a4b949e11dbf8904517ba7704d3c libodb-boost-1.2.0.zip a925cb169a08de6b3dab45c32119e61d6f6da4ce libodb-mysql-1.2.0.tar.bz2 173c153065329425ed0c8ec8ab2b807ef1dbe271 libodb-mysql-1.2.0.tar.gz 486166a47d518324545bf2be3bb877db0a7d3a13 libodb-mysql-1.2.0.zip ee5b18d06121d89463ab288c6a68bd95eae37491 libodb-tracer-1.2.0.tar.bz2 25131364958ce3197c7a62383e93564f7ee45fb2 libodb-tracer-1.2.0.tar.gz c3b6f54cc205032ebfeeab25d9186b309c36d229 libodb-tracer-1.2.0.zip a4ced7b0ed2dba6aca462022a59d2c2b16d15478 odb-1.2.0-i686-linux-gnu.tar.bz2 7ecc3ca9fcc9d3ae76c9f3cfa52839666af75ece odb-1.2.0-i686-macosx.tar.bz2 0f4cc2cd35d31e61a7b5086522de4586b70b274f odb-1.2.0-i686-solaris.tar.bz2 8883d7d72ca9233a74706c7da38f5c935d363b00 odb-1.2.0-i686-windows.zip b6d3a92907bdc6895326a81209b8db83fb3d7ba8 odb-1.2.0-sparc-solaris.tar.bz2 b9b583f2c4aa0dc01110b184f4b481c17638aa41 odb-1.2.0.tar.bz2 2f3d83a44909d1efa7067db98acb7399e822e7b3 odb-1.2.0.tar.gz 88527ac892d56eac0593477b5c8718eeb3b89863 odb-1.2.0-x86_64-linux-gnu.tar.bz2 b0c28ef2f20fbcb00a7395432f9c71de84fbf681 odb-1.2.0.zip 8c709d0899bde23de6b106d13890e099791a0f71 odb-examples-1.2.0.tar.bz2 114241c511c180d9cafdb8e32fff2c5a2ef65475 odb-examples-1.2.0.tar.gz b3e850d343274caaa25a5665314070b4243abcbb odb-examples-1.2.0.zip 43afba35440584ba27a53e550c82fa18023df39f odb-tests-1.2.0.tar.bz2 01b8357d750abc17cd3ed0a005f91dfd43f3b529 odb-tests-1.2.0.tar.gz ce88fea1ed82417e949f4b7b7181eae4143d68f3 odb-tests-1.2.0.zip Enjoy, Boris From boris at codesynthesis.com Wed Mar 16 08:32:31 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Mar 16 08:32:46 2011 Subject: [odb-users] Memory leaks with odb/mysql/database.hxx In-Reply-To: References: Message-ID: Hi Alexey, Boris Kolpackov writes: > I will then post what I find to the list. Thanks for the test case. There was indeed a memory block that was allocated in libodb's DllMain function which, according to the MSDN documentation, it wasn't always safe to deallocated. It turned out that normal termination of the process is also one of those situations. We have changes this logic in the just released ODB 1.2.0 so now we can always safely deallocate this memory block. I tried it on your test case and there are no more memory leaks. Thanks for reporting this! Boris