From kannan024 at gmail.com Tue Feb 1 10:55:02 2011 From: kannan024 at gmail.com (Kannan) Date: Tue Feb 1 10:55:25 2011 Subject: [odb-users] odb for oracle ? Message-ID: <4d482ce1.114ddf0a.7de4.73e2@mx.google.com> hello Borris, Do we have libodb-oracle similar to libodb-mysql. Also can odb be decoupled with database libraries ? Thanks, Kannan From boris at codesynthesis.com Tue Feb 1 14:38:58 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 1 14:23:38 2011 Subject: [odb-users] Re: odb for oracle ? In-Reply-To: <4d482ce1.114ddf0a.7de4.73e2@mx.google.com> References: <4d482ce1.114ddf0a.7de4.73e2@mx.google.com> Message-ID: Hi Kannan, Kannan writes: > Do we have libodb-oracle similar to libodb-mysql. No, not yet. But we are planning to add support for Oracle in the near future. > Also can odb be decoupled with database libraries? Not sure what you mean here. Can you explain? Boris From boris at codesynthesis.com Thu Feb 3 08:32:22 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 3 08:16:36 2011 Subject: [odb-users] Re: odb for oracle ? In-Reply-To: <4d4982b2.860fdf0a.2fa5.ffffb732@mx.google.com> References: <4d482ce1.114ddf0a.7de4.73e2@mx.google.com> <4d4982b2.860fdf0a.2fa5.ffffb732@mx.google.com> Message-ID: Hi Kannan, 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 Kannan writes: > I meant we will need to change the odb header file if the library gets changed. > If we could make in a way, we don't need to change the code, but just change > the database library to be linked will it work ? or will this approach become > similar to odbc ? > > #include > #include > #include //change will be required in the code > > #include "Person.hpp" > #include "Person-odb.hpp" You will need to change two lines of code in your application: the include directive above and the line that creates the concrete database instance: #include auto_ptr db (new odb::mysql::database (...)); Becomes (once Oracle runtime is available): #include auto_ptr db (new odb::oracle::database (...)); You can also factor out the creation of the concrete database instance into a separate source file or use preprocessor macros to control which database is used. Both of these technique are used in the ODB examples (see the database.hxx file). This way your application code stays unchanged and you only change the database macro/library in your build script. [The rest of the original email follows for context.] > > > I use Cmake for build > > project(Testodb) > cmake_minimum_required(VERSION 2.8) > #set(CMAKE_VERBOSE_MAKEFILE TRUE) > set(CMAKE_BUILD_TYPE DEBUG) > link_directories(/usr/local/lib) > > set(all_SOURCES main.cpp > name.cpp > Person.cpp > contact.cpp) > > set(dba_SOURCES Person.hpp > name.hpp > contact.hpp) > > set(gen_SOURCES) > > foreach(_file ${dba_SOURCES}) > string(REPLACE ".hpp" "-odb.cpp" gencppfile ${_file}) > add_custom_command( > OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${gencppfile} > COMMAND odb -d mysql --hxx-suffix .hpp --ixx-suffix .ipp --cxx-suffix .cpp > --output-dir ${CMAKE_CURRENT_SOURCE_DIR} > --generate-query --generate-schema ${CMAKE_CURRENT_SOURCE_DIR}/${_file} > > DEPENDS ${_file} > ) > #list(APPEND gen_SOURCES ${gencppfile}) > list(APPEND all_SOURCES ${gencppfile}) > endforeach() > > add_executable(Testodb ${all_SOURCES}) > target_link_libraries(Testodb odb-mysql odb) //Just change to odb-oracle for > oracle database. will it work ? > > Thanks, > Kannan Boris From aphongka at gmail.com Wed Feb 9 06:58:32 2011 From: aphongka at gmail.com (Alexey Afanasyev) Date: Wed Feb 9 06:58:39 2011 Subject: [odb-users] [Question] Reverse code generation (.h from .sql) Message-ID: Hello, There was the following discussion in the [Questions and future direction of ODB] thread: > > > 4. Can't the ODB code generator insert the "friend class odb::access;" > > > in entities that it finds so that the user does not have to do that? > > > Same with the #include > > > > While the friend declaration can be annoying, I don't think it is a > > good idea for ODB to modify hand-written C++ headers. Plus, there is > > no guarantee that the header won't be compiled by the native C++ > > compiler before ODB had a chance to change it. > > > > > If you already generate code, what harm is there in making it a little > easier to use by making it harder to forget "boilerplate" code. I might be wrong but I guess this was about the topic. There is one possible scenario implied by ODB - starting development with C++ entities. One should create C++ classes (header files) first and then generate SQL sentences to create an appropriate DB structure. But there is another scenario. There might be an existing DB structure first and one might want to use ODB against it. So, the question is if there is automation of the process of generating C++ entities (header files) by existing DB structure. And if not, are there any plans to make it? Thanks, Alexey From boris at codesynthesis.com Wed Feb 9 09:43:30 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 9 09:26:25 2011 Subject: [odb-users] [Question] Reverse code generation (.h from .sql) In-Reply-To: References: Message-ID: Hi Alexey, Alexey Afanasyev writes: > There is one possible scenario implied by ODB - starting development > with C++ entities. One should create C++ classes (header files) first > and then generate SQL sentences to create an appropriate DB structure. Well, that's one approach. The other is to map existing C++ classes to the existing database schema using various pragmas (e.g., table, column, type, etc). The 'schema' example shows how to do this. > But there is another scenario. There might be an existing DB structure > first and one might want to use ODB against it. So, the question is if > there is automation of the process of generating C++ entities (header > files) by existing DB structure. And if not, are there any plans to > make it? Yes, we are thinking about adding this support. The tricky part is to decide whether it should be a once-off or repetitive process. If you want to keep re-generating C++ classes from the database schema, then you cannot customize the generated code (e.g., add functions, etc.) since your changes will be over-written the next time you change the schema. On the other hand, by themselves the generated classes will be just data holders, so this is also somewhat limiting. Which scenario did you have in mind? Boris From dieter.vandewalle at newtec.eu Fri Feb 11 08:50:16 2011 From: dieter.vandewalle at newtec.eu (Dieter Van de Walle) Date: Fri Feb 11 10:37:39 2011 Subject: [odb-users] MySQL timeout: ODB not reconnecting? Message-ID: <380232873.132975.1297432216592.JavaMail.root@ntc-mailstore1.newtec.eu> Hello, We've been using ODB for persistency for a while now, and it is working very smoothly. There's some improvement possible, but very impressed. I have just encountered an annoying problem with the connection management of ODB though. When a DB connection is inactive, MySQL will timeout the connection after 8 hours. This causes ODB to lose the connection and fail any further DB actions with the error: "ODB error: 2006 (HY000): MySQL server has gone away" . Apparently the 'connection_pool_factory' does not reconnect when connections are gone... ?? I was able to fix this by using the 'new_connection_factory' instead of the default 'connection_pool_factory' . The 'connection_pool_factory' should check connection status though and reconnect if necessary it seems? Very annoying, since this will cause all further DB activity to fail until the session is restarted. This behaviour can be triggered by: - MySQL default connection timeout - Temporary network interruption ODB is unable to recover from this when using the 'connection_pool_factory' , very annoying! Is this a bug, or can I handle this somehow? Best regards, Dieter Van de Walle C++/Java developer MENOS Newtec CY N.V. Laarstraat 5, B-9100 Sint-Niklaas, Belgium Tel +32 3 780 65 07 (direct) or +32 3 780 65 00 (switchboard) www.newtec.eu Newtec?s MENOS system awarded IBC Innovation Award for Content Delivery & the IBC Judges? Award Newtec?s FlexACM awarded 2009 Teleport Technology of the Year by WTA *** e-mail confidentiality footer *** This message and any attachments thereto are confidential. They may also be privileged or otherwise protected by work product immunity or other legal rules. If you have received it by mistake, please let us know by e-mail reply and delete it from your system; you may not copy this message or disclose its contents to anyone. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore is in no way liable for any errors or omissions in the content of this message, which may arise as a result of e-mail transmission. If verification is required, please request a hard copy. From aphongka at gmail.com Fri Feb 11 10:56:09 2011 From: aphongka at gmail.com (Alexey Afanasyev) Date: Fri Feb 11 10:56:17 2011 Subject: [odb-users] [Question] Reverse code generation (.h from .sql) In-Reply-To: References: Message-ID: Hi Boris, On Wed, Feb 9, 2011 at 5:43 PM, Boris Kolpackov wrote: > > Alexey Afanasyev writes: > >> But there is another scenario. There might be an existing DB structure >> first and one might want to use ODB against it. So, the question is if >> there is automation of the process of generating C++ entities (header >> files) by existing DB structure. And if not, are there any plans to >> make it? > > Yes, we are thinking about adding this support. The tricky part is to > decide whether it should be a once-off or repetitive process. If you > want to keep re-generating C++ classes from the database schema, then > you cannot customize the generated code (e.g., add functions, etc.) > since your changes will be over-written the next time you change the > schema. On the other hand, by themselves the generated classes will > be just data holders, so this is also somewhat limiting. Which scenario > did you have in mind? I use a third party database in my application so I am mapping its schema to the c++ entities. The mapping process consumes considerable time, so auto-generation would help. I need also to be able to quickly react in case the database provider changes the schema. I might also switch to different database of different provider, so auto-generation would help in this case as well. Well, I plan to add some custom stuff to the entities' definitions (sources for odb compiler), so I would expect regeneration process would not remove my custom stuff. > Boris > Alexey From boris at codesynthesis.com Mon Feb 14 07:16:02 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 14 07:00:18 2011 Subject: [odb-users] MySQL timeout: ODB not reconnecting? In-Reply-To: <380232873.132975.1297432216592.JavaMail.root@ntc-mailstore1.newtec.eu> References: <380232873.132975.1297432216592.JavaMail.root@ntc-mailstore1.newtec.eu> Message-ID: Hi Dieter, Dieter Van de Walle writes: > We've been using ODB for persistency for a while now, and it is working > very smoothly. There's some improvement possible, but very impressed. Thanks, I am glad you are enjoying it. > I have just encountered an annoying problem with the connection management > of ODB though. When a DB connection is inactive, MySQL will timeout the > connection after 8 hours. This causes ODB to lose the connection and fail > any further DB actions with the error: "ODB error: 2006 (HY000): MySQL > server has gone away" . > > Apparently the 'connection_pool_factory' does not reconnect when > connections are gone... ?? > > I was able to fix this by using the 'new_connection_factory' instead of > the default 'connection_pool_factory'. The 'connection_pool_factory' > should check connection status though and reconnect if necessary it > seems? Yes, we were actually thinking about the same functionality. We won't be able to use MySQL reconnect feature because such transparent reconnects release prepared statements and ODB uses them heavily. But the pool factory can check the connection with mysql_ping before giving it out to the caller. If the connection has been lost, it can close it and create a new one. This will work transparently to the ODB users. There is, however, another related situation which we won't be able to handle transparently. Imagine that the connection is lost (e.g., due to an intermittent network failure) during a transaction. In this case the transaction will have to be rolled back (even MySQL auto-reconnect cannot transparently handle this case). You, as a user of ODB, will need to detect this situation (by catching an exception) and retry the transaction, similar to how it is done now with deadlocks. So the current plan is to introduce a special base exception, odb::recoverable, from which all potentially recoverable exceptions, such as odb::deadlock, odb::connection_lost, and odb::timeout, will derive. You will then be able to catch this exception and retry the transaction. Let me know if this sounds good to you and we will add this functionality. Boris From boris at codesynthesis.com Mon Feb 14 07:45:23 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 14 07:29:37 2011 Subject: [odb-users] [Question] Reverse code generation (.h from .sql) In-Reply-To: References: Message-ID: Hi Alexey, [CC'ed odb-users; please keep the mailing list CC'ed to your replies] Alexey Afanasyev writes: > 1) we are going to add some new functionality to our application based > on an existing database. In this case we just invent new entities and > map them to the new db. Here, automatic conversion from SQL to C++ > might spare our time; Agreed. > 2) we are switching to a database from another supplier, or our app > allows our customers to chose which database to use from a number of > databases of the same kind (covering the same domain but having > different schemata). In this case, we can try directly map each of the > databases to our C++ classes using pragmas. This mapping might be not > trivial and hardly automated. But there is another way to settle the > issue - automatically map each of the DBs to C++ and then at C++ level > create wrappers or adapters to unify access to all of them. So, SQL 2 > C++ conversion might help here as well. Also agreed. > But even if the DB was under our control and we were at the production > stage we would have difficulty to change our C++ objects without > appropriate changes in the DB. In my former project we used the > following method which was robust enough: > > - start with DB schema, create appropriate DB change and migration scripts; > - auto-generate entities from the changed DB schema; > - use the changed entities in the code. Yes, this is a common approach. We plan to support (more or less) automatic schema migration in the future so if you choose to use C++ classes as the primary specification of your object model (instead of the database schema), then the ODB compiler would generate the migration scripts/code for you. > Well, my scenario is something like I have described above. There is > an existing DB which I use in my application. But there is a number of > the DBs of the same kind on the market. So I have to keep in mind that > one day I might switch to a different schema. > > So, in my scenario, I need to generate C++ classes (headers) from the > existing DB schema. I do not need to generate schema from C++ classes. > I do not need to regenerate C++ often, while I might need to do so in > case my DB provider changed the schema or I switched to different > database. > > But I am also thinking of possibility of round-trip engineering. > > I see the difficulty with constant regeneration of the C++. I guess > simple inheritance won't work, will it? Inheritance will break in two places: (1) If there is inheritance between generated entities (in this case the derived class will inherit from the generated version instead of the hand-written one). Maybe we could work around this with virtual inheritance. (2) If there is a relationship between objects (object pointers). I also have another question regarding your use-case. Does your schema define anything that you would want to map to composite value types, containers, or object relationships? The reason for this question is that it won't be possible to automatically decide that something should be mapped to a composite value type (instead of just a set of data members directly in the object), a container (instead of just another object), or one-to-one relationship (instead of just the generic many-to-many). So we would probably have to have some kind of a mapping file which tells the ODB compiler how to map SQL tables to C++ classes. Also, would it be possible for you to send me your schema (off-list) so that I can take a look? Boris From losintikfos at yahoo.co.uk Tue Feb 15 12:50:40 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Tue Feb 15 15:09:51 2011 Subject: [odb-users] Netbeans build error Message-ID: <480077.69774.qm@web29017.mail.ird.yahoo.com> Hello guys, My first C++ ORM Project using ODB. I am trying to understand the error messages but for a novice, it seems i do not stand a chance. Do anyone know what I am doing wrong? I have attached a copy of the project. below is the message: "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf nbproject/Makefile-Debug.mk:76: warning: overriding commands for target `build/Debug/GNU-Linux-x86/Member-odb.o' nbproject/Makefile-Debug.mk:66: warning: ignoring old commands for target `build/Debug/GNU-Linux-x86/Member-odb.o' make[1]: Entering directory `/root/Documents/project/myproj' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/myproj nbproject/Makefile-Debug.mk:76: warning: overriding commands for target `build/Debug/GNU-Linux-x86/Member-odb.o' nbproject/Makefile-Debug.mk:66: warning: ignoring old commands for target `build/Debug/GNU-Linux-x86/Member-odb.o' make[2]: Entering directory `/root/Documents/project/myproj' mkdir -p build/Debug/GNU-Linux-x86 rm -f build/Debug/GNU-Linux-x86/Driver.o.d g++ -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/Driver.o.d -o build/Debug/GNU-Linux-x86/Driver.o Driver.cpp from Driver.cpp:10: /usr/local/include/odb/traits.hxx: In instantiation of ?odb::object_traits?: Driver.cpp:38: instantiated from here In file included from /usr/local/include/odb/database.hxx:14, /usr/local/include/odb/traits.hxx:78: error: invalid use of incomplete type ?struct odb::access::object_traits? /usr/local/include/odb/forward.hxx:23: error: declaration of ?struct odb::access::object_traits? /usr/local/include/odb/traits.hxx:78: error: invalid use of incomplete type ?struct odb::access::object_traits? /usr/local/include/odb/forward.hxx:23: error: declaration of ?struct odb::access::object_traits? /usr/local/include/odb/traits.hxx:88: error: invalid use of incomplete type ?struct odb::access::object_traits? /usr/local/include/odb/forward.hxx:23: error: declaration of ?struct odb::access::object_traits? /usr/local/include/odb/traits.hxx:90: error: invalid use of incomplete type ?struct odb::access::object_traits? /usr/local/include/odb/forward.hxx:23: error: declaration of ?struct odb::access::object_traits? /usr/local/include/odb/traits.hxx:91: error: invalid use of incomplete type ?struct odb::access::object_traits? /usr/local/include/odb/forward.hxx:23: error: declaration of ?struct odb::access::object_traits? /usr/local/include/odb/traits.hxx:92: error: invalid use of incomplete type ?struct odb::access::object_traits? /usr/local/include/odb/forward.hxx:23: error: declaration of ?struct odb::access::object_traits? Driver.cpp: In function ?int main(int, char**)?: Driver.cpp:38: error: cannot convert ?odb::object_traits::id_type? to ?long unsigned int? in assignment from Driver.cpp:10: /usr/local/include/odb/database.txx: In member function ?typename odb::object_traits::id_type odb::database::persist(T&) [with T = myproj::Member*]?: Driver.cpp:38: instantiated from here In file included from /usr/local/include/odb/database.hxx:185, /usr/local/include/odb/database.txx:20: error: no type named ?object_type? in ?struct odb::object_traits? /usr/local/include/odb/database.txx:21: error: no type named ?object_type? in ?struct odb::object_traits? /usr/local/include/odb/database.txx:27: error: no type named ?object_type? in ?struct odb::object_traits? /usr/local/include/odb/database.txx:28: error: no type named ?pointer_type? in ?struct odb::object_traits? /usr/local/include/odb/database.txx:27: error: no type named ?object_type? in ?struct odb::object_traits? /usr/local/include/odb/database.txx:27: error: no type named ?object_type? in ?struct odb::object_traits? make[2]: Leaving directory `/root/Documents/project/myproj' make[1]: Leaving directory `/root/Documents/project/myproj' make[2]: *** [build/Debug/GNU-Linux-x86/Driver.o] Error 1 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2 BUILD FAILED (exit value 2, total time: 1s) -------------- next part -------------- A non-text attachment was scrubbed... Name: myproj.zip Type: application/zip Size: 31586 bytes Desc: not available Url : http://codesynthesis.com/pipermail/odb-users/attachments/20110215/467a165d/myproj-0001.zip From boris at codesynthesis.com Wed Feb 16 01:20:29 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 16 01:05:12 2011 Subject: [odb-users] Netbeans build error In-Reply-To: <480077.69774.qm@web29017.mail.ird.yahoo.com> References: <480077.69774.qm@web29017.mail.ird.yahoo.com> Message-ID: Hi, Bright Dadson writes: > I have attached a copy of the project. I took a look at your makefiles, and I see you are running the ODB compiler like this: odb -d mysql --generate-query --generate-schema Member.cpp The ODB compiler should be invoked on the header file that defines the persistent classes, not the source file. So the above command line should be: odb -d mysql --generate-query --generate-schema Member.h The other thing that I had to fix to make the resulting code compile is to qualify the 'access' class in the friend declaration: friend class odb::access; If you just do : namespace N { using namespace odb; class Member { friend class access; }; } The C++ compiler assumes 'access' refers to a (yet undefined) class in namespace 'N'. After these two changes I was able to compile your code without any problems. Boris From losintikfos at yahoo.co.uk Wed Feb 16 07:14:05 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Wed Feb 16 08:50:13 2011 Subject: [odb-users] Netbeans build error In-Reply-To: References: <480077.69774.qm@web29017.mail.ird.yahoo.com> Message-ID: <637451.36488.qm@web29004.mail.ird.yahoo.com> Thanks Boris - that was very useful. Quick one though! I can compile Driver.cpp without any issues, but if i right-click on the project name and select Build, I end up with below exception. Do you know what what could be the issue? ----EXCEPTION------ build/Debug/GNU-Linux-x86/Member-odb.o:/usr/include/c++/4.4/exception:62: multiple definition of `odb::access::object_traits::query_type::id' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:138: first defined here build/Debug/GNU-Linux-x86/Member-odb.o:/usr/include/c++/4.4/exception:62: multiple definition of `odb::access::object_traits::query_type::title' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:138: first defined here build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/details/buffer.hxx:39: multiple definition of `odb::access::object_traits::query_type::first_name' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144: first defined here build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/mysql/traits.hxx:107: multiple definition of `odb::access::object_traits::query_type::middle_name' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144: first defined here build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/details/shared-ptr/base.ixx:50: multiple definition of `odb::access::object_traits::query_type::last_name' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144: first defined here build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/mysql/transaction-impl.ixx:14: multiple definition of `odb::access::object_traits::query_type::dob' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144: first defined here build/Debug/GNU-Linux-x86/Member-odb.o:/usr/local/include/odb/details/type-info.hxx:33: multiple definition of `odb::access::object_traits::query_type::join_date' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:144: first defined here build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0xf8): multiple definition of `odb::access::object_traits::persist_statement' build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0xf8): first defined here build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x1b0): multiple definition of `odb::access::object_traits::find_statement' build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x1b0): first defined here build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x284): multiple definition of `odb::access::object_traits::update_statement' build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x284): first defined here build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x2b8): multiple definition of `odb::access::object_traits::erase_statement' build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x2b8): first defined here build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x358): multiple definition of `odb::access::object_traits::query_clause' build/Debug/GNU-Linux-x86/Member-odb.o:(.rodata+0x358): first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::id(odb::access::object_traits::image_type const&)': /usr/include/c++/4.4/exception:62: multiple definition of `odb::access::object_traits::id(odb::access::object_traits::image_type const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:138: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::grow(odb::access::object_traits::image_type&, char*)': /usr/local/include/odb/mysql/traits.hxx:110: multiple definition of `odb::access::object_traits::grow(odb::access::object_traits::image_type&, char*)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:151: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::bind(st_mysql_bind*, odb::access::object_traits::image_type&, bool)': /root/Documents/project/mefam/Member-odb.cxx:204: multiple definition of `odb::access::object_traits::bind(st_mysql_bind*, odb::access::object_traits::image_type&, bool)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:204: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::bind(st_mysql_bind*, odb::access::object_traits::id_image_type&)': /root/Documents/project/mefam/Member-odb.cxx:276: multiple definition of `odb::access::object_traits::bind(st_mysql_bind*, odb::access::object_traits::id_image_type&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:276: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::init(odb::access::object_traits::image_type&, test::Member const&)': /root/Documents/project/mefam/Member-odb.cxx:286: multiple definition of `odb::access::object_traits::init(odb::access::object_traits::image_type&, test::Member const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:286: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::init(test::Member&, odb::access::object_traits::image_type const&, odb::database&)': /root/Documents/project/mefam/Member-odb.cxx:407: multiple definition of `odb::access::object_traits::init(test::Member&, odb::access::object_traits::image_type const&, odb::database&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:407: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::init(odb::access::object_traits::id_image_type&, unsigned long const&)': /root/Documents/project/mefam/Member-odb.cxx:481: multiple definition of `odb::access::object_traits::init(odb::access::object_traits::id_image_type&, unsigned long const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:481: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::persist(odb::database&, test::Member&)': /root/Documents/project/mefam/Member-odb.cxx:495: multiple definition of `odb::access::object_traits::persist(odb::database&, test::Member&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:495: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::update(odb::database&, test::Member const&)': /root/Documents/project/mefam/Member-odb.cxx:523: multiple definition of `odb::access::object_traits::update(odb::database&, test::Member const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:523: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::erase(odb::database&, unsigned long const&)': /root/Documents/project/mefam/Member-odb.cxx:557: multiple definition of `odb::access::object_traits::erase(odb::database&, unsigned long const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:557: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::find(odb::database&, unsigned long const&)': /root/Documents/project/mefam/Member-odb.cxx:582: multiple definition of `odb::access::object_traits::find(odb::database&, unsigned long const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:582: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::find_(odb::mysql::object_statements&, unsigned long const&)': /root/Documents/project/mefam/Member-odb.cxx:653: multiple definition of `odb::access::object_traits::find_(odb::mysql::object_statements&, unsigned long const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:653: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::find(odb::database&, unsigned long const&, test::Member&)': /root/Documents/project/mefam/Member-odb.cxx:620: multiple definition of `odb::access::object_traits::find(odb::database&, unsigned long const&, test::Member&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:620: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::result odb::access::object_traits::query(odb::database&, odb::access::object_traits::query_type const&)': /root/Documents/project/mefam/Member-odb.cxx:704: multiple definition of `odb::result odb::access::object_traits::query(odb::database&, odb::access::object_traits::query_type const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:704: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::query_(odb::database&, odb::access::object_traits::query_type const&, odb::mysql::object_statements&, odb::details::shared_ptr&)': /root/Documents/project/mefam/Member-odb.cxx:747: multiple definition of `odb::access::object_traits::query_(odb::database&, odb::access::object_traits::query_type const&, odb::mysql::object_statements&, odb::details::shared_ptr&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:747: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::result odb::access::object_traits::query(odb::database&, odb::access::object_traits::query_type const&)': /root/Documents/project/mefam/Member-odb.cxx:726: multiple definition of `odb::result odb::access::object_traits::query(odb::database&, odb::access::object_traits::query_type const&)' build/Debug/GNU-Linux-x86/Member-odb.o:/root/Documents/project/mefam/Member-odb.cxx:726: first defined here build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::raw_ptr_guard::~raw_ptr_guard()': Member-odb.cxx:(.text._ZN3odb13raw_ptr_guardIPN6test6MemberEED1Ev[odb::raw_ptr_guard::~raw_ptr_guard()]+0x14): undefined reference to `test::Member::~Member()' build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::pointer_factory::create()': Member-odb.cxx:(.text._ZN3odb6access15pointer_factoryIN6test6MemberEPS3_E6createEv[odb::access::pointer_factory::create()]+0x4b): undefined reference to `test::Member::Member()' build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::raw_ptr_guard::~raw_ptr_guard()': Member-odb.cxx:(.text._ZN3odb13raw_ptr_guardIPKN6test6MemberEED1Ev[odb::raw_ptr_guard::~raw_ptr_guard()]+0x14): undefined reference to `test::Member::~Member()' build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::raw_ptr_guard::reset(test::Member const*)': Member-odb.cxx:(.text._ZN3odb13raw_ptr_guardIPKN6test6MemberEE5resetES4_[odb::raw_ptr_guard::reset(test::Member const*)]+0x14): undefined reference to `test::Member::~Member()' build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::raw_ptr_guard::reset(test::Member*)': Member-odb.cxx:(.text._ZN3odb13raw_ptr_guardIPN6test6MemberEE5resetES3_[odb::raw_ptr_guard::reset(test::Member*)]+0x14): undefined reference to `test::Member::~Member()' build/Debug/GNU-Linux-x86/Driver.o: In function `main': /root/Documents/project/mefam/Driver.cpp:32: undefined reference to `test::Member::Member()' /root/Documents/project/mefam/Driver.cpp:33: undefined reference to `test::Member::setFirstName(std::basic_string, std::allocator >)' /root/Documents/project/mefam/Driver.cpp:34: undefined reference to `test::Member::setLastName(std::basic_string, std::allocator >)' collect2: ld returned 1 exit status make[2]: *** [dist/Debug/GNU-Linux-x86/mefam] Error 1 make[1]: *** [.build-conf] Error 2 make: *** [.build-impl] Error 2 BUILD FAILED (exit value 2, total time: 1s) ________________________________ From: Boris Kolpackov To: Bright Dadson Cc: odb-users@codesynthesis.com Sent: Wed, 16 February, 2011 6:20:29 Subject: Re: [odb-users] Netbeans build error Hi, Bright Dadson writes: > I have attached a copy of the project. I took a look at your makefiles, and I see you are running the ODB compiler like this: odb -d mysql --generate-query --generate-schema Member.cpp The ODB compiler should be invoked on the header file that defines the persistent classes, not the source file. So the above command line should be: odb -d mysql --generate-query --generate-schema Member.h The other thing that I had to fix to make the resulting code compile is to qualify the 'access' class in the friend declaration: friend class odb::access; If you just do : namespace N { using namespace odb; class Member { friend class access; }; } The C++ compiler assumes 'access' refers to a (yet undefined) class in namespace 'N'. After these two changes I was able to compile your code without any problems. Boris From boris at codesynthesis.com Wed Feb 16 09:09:39 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Wed Feb 16 08:54:28 2011 Subject: [odb-users] Netbeans build error In-Reply-To: <637451.36488.qm@web29004.mail.ird.yahoo.com> References: <480077.69774.qm@web29017.mail.ird.yahoo.com> <637451.36488.qm@web29004.mail.ird.yahoo.com> Message-ID: Hi Bright, Bright Dadson writes: > Quick one though! I can compile Driver.cpp without any issues, but if i > right-click on the project name and select Build, I end up with below > exception. Do you know what what could be the issue? Most likely you are linking-in the same object file twice or include .cpp file somewhere instead of .h. I tried to compile and link (using the g++ command line, not your project) just these three files: Member.cpp Member-odb.cxx, and Driver.cpp, and everything links without any issues. Boris From losintikfos at yahoo.co.uk Wed Feb 16 17:36:03 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Thu Feb 17 08:52:22 2011 Subject: [odb-users] Netbeans build error In-Reply-To: References: <480077.69774.qm@web29017.mail.ird.yahoo.com> <637451.36488.qm@web29004.mail.ird.yahoo.com> Message-ID: <158337.73821.qm@web29002.mail.ird.yahoo.com> The project I attached in my initial post is pretty much all I have. I have gone through it thoroughly - and cannot see any duplicate inclusions. I can happily compile the the file individually and link them using: c++ -o driver driver.o person-odb.o -lodb-mysql -lodb on command line. The issue occurs when I try to use the netbeans build facility. Which outputs exception with few of them similar to this: build/Debug/GNU-Linux-x86/Member-odb.o: In function `odb::access::object_traits::find(odb::database&, unsigned long const&, test::Member&)': Member-odb.cxx:(.text+0xe33): undefined reference to `odb::mysql::transaction::current()' The question is, can I have have netbeans do the build for me or I have to manually compile the files and link them via console!? Hi Bright, Bright Dadson writes: > Quick one though! I can compile Driver.cpp without any issues, but if i > right-click on the project name and select Build, I end up with below > exception. Do you know what what could be the issue? Most likely you are linking-in the same object file twice or include .cpp file somewhere instead of .h. I tried to compile and link (using the g++ command line, not your project) just these three files: Member.cpp Member-odb.cxx, and Driver.cpp, and everything links without any issues. Boris From boris at codesynthesis.com Thu Feb 17 09:19:28 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 17 09:04:33 2011 Subject: [odb-users] Netbeans build error In-Reply-To: <158337.73821.qm@web29002.mail.ird.yahoo.com> References: <480077.69774.qm@web29017.mail.ird.yahoo.com> <637451.36488.qm@web29004.mail.ird.yahoo.com> <158337.73821.qm@web29002.mail.ird.yahoo.com> Message-ID: Hi, Bright Dadson writes: > The project I attached in my initial post is pretty much all I have. > I have gone through it thoroughly - and cannot see any duplicate > inclusions. I can happily compile the the file individually and link > them using: c++ -o driver driver.o person-odb.o -lodb-mysql -lodb > on command line. > > The issue occurs when I try to use the netbeans build facility. > Which outputs exception with few of them similar to this: > > build/Debug/GNU-Linux-x86/Member-odb.o: In function > `odb::access::object_traits::find(odb::database&, unsigned long > const&, test::Member&)': > Member-odb.cxx:(.text+0xe33): undefined reference to > `odb::mysql::transaction::current()' This error is different from what you showed in your previous email. Before you had duplicate symbols, now you have unresolved symbols. So something must have changed. The odb::mysql::transaction::current() function is defined in the libodb-mysql library so try to make sure your Netbeans project links to it. > The question is, can I have have netbeans do the build for me or I have to > manually compile the files and link them via console!? Yes, I have tested a build with Netbeans and everything works fine. Here are the instructions: http://wiki.codesynthesis.com/Using_ODB_with_Netbeans Boris From dieter.vandewalle at newtec.eu Fri Feb 18 10:02:14 2011 From: dieter.vandewalle at newtec.eu (Dieter Van de Walle) Date: Fri Feb 18 10:02:22 2011 Subject: [odb-users] MySQL timeout: ODB not reconnecting? In-Reply-To: Message-ID: <182985617.163036.1298041334136.JavaMail.root@ntc-mailstore1.newtec.eu> Hello Boris, In the perfect case, ODB should handle this transparantly. So the behaviour I would like most is the following: In case the DB connection is lost, ODB automatically and transparantly tries to reconnect. The following parameters should be configurable: - Try to auto-reconnect / immediatly throw exception - Connection timeout - Number of times to try to connect before exception is thrown Most errors are caused by MySQL terminating a connection because of a timeout. In that case, a quick transparant reconnect will work very well. If the network goes down, I don't mind if ODB blocks for a while while trying to reconnect before throwing an exception. Thanks for the work on this great software! Dieter ----- Original Message ----- From: "Boris Kolpackov" To: "Dieter Van de Walle" Cc: odb-users@codesynthesis.com Sent: Monday, 14 February, 2011 1:16:02 PM Subject: Re: [odb-users] MySQL timeout: ODB not reconnecting? Hi Dieter, Dieter Van de Walle writes: > We've been using ODB for persistency for a while now, and it is working > very smoothly. There's some improvement possible, but very impressed. Thanks, I am glad you are enjoying it. > I have just encountered an annoying problem with the connection management > of ODB though. When a DB connection is inactive, MySQL will timeout the > connection after 8 hours. This causes ODB to lose the connection and fail > any further DB actions with the error: "ODB error: 2006 (HY000): MySQL > server has gone away" . > > Apparently the 'connection_pool_factory' does not reconnect when > connections are gone... ?? > > I was able to fix this by using the 'new_connection_factory' instead of > the default 'connection_pool_factory'. The 'connection_pool_factory' > should check connection status though and reconnect if necessary it > seems? Yes, we were actually thinking about the same functionality. We won't be able to use MySQL reconnect feature because such transparent reconnects release prepared statements and ODB uses them heavily. But the pool factory can check the connection with mysql_ping before giving it out to the caller. If the connection has been lost, it can close it and create a new one. This will work transparently to the ODB users. There is, however, another related situation which we won't be able to handle transparently. Imagine that the connection is lost (e.g., due to an intermittent network failure) during a transaction. In this case the transaction will have to be rolled back (even MySQL auto-reconnect cannot transparently handle this case). You, as a user of ODB, will need to detect this situation (by catching an exception) and retry the transaction, similar to how it is done now with deadlocks. So the current plan is to introduce a special base exception, odb::recoverable, from which all potentially recoverable exceptions, such as odb::deadlock, odb::connection_lost, and odb::timeout, will derive. You will then be able to catch this exception and retry the transaction. Let me know if this sounds good to you and we will add this functionality. Boris Newtec?s MENOS system awarded IBC Innovation Award for Content Delivery & the IBC Judges? Award Newtec?s FlexACM awarded 2009 Teleport Technology of the Year by WTA *** e-mail confidentiality footer *** This message and any attachments thereto are confidential. They may also be privileged or otherwise protected by work product immunity or other legal rules. If you have received it by mistake, please let us know by e-mail reply and delete it from your system; you may not copy this message or disclose its contents to anyone. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore is in no way liable for any errors or omissions in the content of this message, which may arise as a result of e-mail transmission. If verification is required, please request a hard copy. From losintikfos at yahoo.co.uk Thu Feb 17 17:48:18 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Fri Feb 18 10:44:45 2011 Subject: [odb-users] Netbeans build error In-Reply-To: References: <480077.69774.qm@web29017.mail.ird.yahoo.com> <637451.36488.qm@web29004.mail.ird.yahoo.com> <158337.73821.qm@web29002.mail.ird.yahoo.com> Message-ID: <369809.4052.qm@web29013.mail.ird.yahoo.com> Thanks Boris I have followed the instructions from the link and it builds without any issues, apart from below exception when I try to run the application. Access denied for user 'root'@'localhost' (using password: NO) I am using the command > ./test -u root -p mypass database=Dental Do you know what I am doing wrong? Hi, Bright Dadson writes: > The project I attached in my initial post is pretty much all I have. > I have gone through it thoroughly - and cannot see any duplicate > inclusions. I can happily compile the the file individually and link > them using: c++ -o driver driver.o person-odb.o -lodb-mysql -lodb > on command line. > > The issue occurs when I try to use the netbeans build facility. > Which outputs exception with few of them similar to this: > > build/Debug/GNU-Linux-x86/Member-odb.o: In function > `odb::access::object_traits::find(odb::database&, unsigned long > const&, test::Member&)': > Member-odb.cxx:(.text+0xe33): undefined reference to > `odb::mysql::transaction::current()' This error is different from what you showed in your previous email. Before you had duplicate symbols, now you have unresolved symbols. So something must have changed. The odb::mysql::transaction::current() function is defined in the libodb-mysql library so try to make sure your Netbeans project links to it. > The question is, can I have have netbeans do the build for me or I have to > manually compile the files and link them via console!? Yes, I have tested a build with Netbeans and everything works fine. Here are the instructions: http://wiki.codesynthesis.com/Using_ODB_with_Netbeans Boris From losintikfos at yahoo.co.uk Thu Feb 17 18:12:44 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Fri Feb 18 10:44:45 2011 Subject: [odb-users] Netbeans build error Message-ID: <796683.52633.qm@web29010.mail.ird.yahoo.com> Using this command worked perfect. Thank you. ./test --user root --database Dental --password mypass ________________________________ From: Bright Dadson To: Boris Kolpackov Cc: ODB user-group Sent: Thu, 17 February, 2011 22:48:18 Subject: Re: [odb-users] Netbeans build error Thanks Boris I have followed the instructions from the link and it builds without any issues, apart from below exception when I try to run the application. Access denied for user 'root'@'localhost' (using password: NO) I am using the command > ./test -u root -p mypass database=Dental Do you know what I am doing wrong? Hi, Bright Dadson writes: > The project I attached in my initial post is pretty much all I have. > I have gone through it thoroughly - and cannot see any duplicate > inclusions. I can happily compile the the file individually and link > them using: c++ -o driver driver.o person-odb.o -lodb-mysql -lodb > on command line. > > The issue occurs when I try to use the netbeans build facility. > Which outputs exception with few of them similar to this: > > build/Debug/GNU-Linux-x86/Member-odb.o: In function > `odb::access::object_traits::find(odb::database&, unsigned long > const&, test::Member&)': > Member-odb.cxx:(.text+0xe33): undefined reference to > `odb::mysql::transaction::current()' This error is different from what you showed in your previous email. Before you had duplicate symbols, now you have unresolved symbols. So something must have changed. The odb::mysql::transaction::current() function is defined in the libodb-mysql library so try to make sure your Netbeans project links to it. > The question is, can I have have netbeans do the build for me or I have to > manually compile the files and link them via console!? Yes, I have tested a build with Netbeans and everything works fine. Here are the instructions: http://wiki.codesynthesis.com/Using_ODB_with_Netbeans Boris From boris at codesynthesis.com Mon Feb 21 08:46:44 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Mon Feb 21 08:29:52 2011 Subject: [odb-users] MySQL timeout: ODB not reconnecting? In-Reply-To: <182985617.163036.1298041334136.JavaMail.root@ntc-mailstore1.newtec.eu> References: <182985617.163036.1298041334136.JavaMail.root@ntc-mailstore1.newtec.eu> Message-ID: Hi Dieter, Ok, we have added support for automatic reconnection (and ping) in connection_pool_factory. If you would like, I can make you a pre- release package (just let me know which platform and if you need the ODB compiler binary). Boris From losintikfos at yahoo.co.uk Mon Feb 21 10:18:54 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Mon Feb 21 15:13:40 2011 Subject: [odb-users] typedef query query issue Message-ID: <370502.39559.qm@web29018.mail.ird.yahoo.com> hello guys, I am following the example: typedef odb::query query; typedef odb::result result; // Say hello to those over 30. // { transaction t (db->begin ()); result r (db->query (query::age > 30)); for (result::iterator i (r.begin ()); i != r.end (); ++i) { cout << "Hello, " << i->first () << "!" << endl; } t.commit (); } Unfortunately the syntax query::age do not seem to resolve the object type age. I have made age a public attribute and re-generated the odb-classes yet no joy. I am using Netbeans. Do anyone knows what I am doing wrong? From losintikfos at yahoo.co.uk Mon Feb 21 12:16:52 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Mon Feb 21 15:13:40 2011 Subject: [odb-users] object already persistent Message-ID: <760938.19842.qm@web29020.mail.ird.yahoo.com> I have created a record in my person table using the ODB persist example which works fine. I have then amended the code to change the name of the person which i expect to be a new record. but when i execute the application i get object already persistent printed. I added this #pragma db id auto to my persistent class generation therefore expect records to be inserted without any issue and hence new id automatically issued by MySQL. Do anyone know why message? From boris at codesynthesis.com Tue Feb 22 03:10:50 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Feb 22 02:54:00 2011 Subject: [odb-users] object already persistent In-Reply-To: <760938.19842.qm@web29020.mail.ird.yahoo.com> References: <760938.19842.qm@web29020.mail.ird.yahoo.com> Message-ID: Hi, Bright Dadson writes: > I have then amended the code to change the name of the person which i > expect to be a new record. It is a new object only if it has a new object id. > but when i execute the application i get object already persistent > printed. I added this #pragma db id auto to my persistent class > generation therefore expect records to be inserted without any issue > and hence new id automatically issued by MySQL. If you added the db auto pragma, you need to also re-create the database schema with the generated .sql file. Boris From dieter.vandewalle at newtec.eu Tue Feb 22 03:43:24 2011 From: dieter.vandewalle at newtec.eu (Dieter Van de Walle) Date: Tue Feb 22 03:43:33 2011 Subject: [odb-users] MySQL timeout: ODB not reconnecting? In-Reply-To: Message-ID: <98097454.172051.1298364204449.JavaMail.root@ntc-mailstore1.newtec.eu> Hello Boris, Thank you for making the change. We don't need a pre-release package though, the current solution suits our needs. Thanks, Dieter ----- Original Message ----- From: "Boris Kolpackov" To: "Dieter Van de Walle" Cc: odb-users@codesynthesis.com Sent: Monday, 21 February, 2011 2:46:44 PM Subject: Re: [odb-users] MySQL timeout: ODB not reconnecting? Hi Dieter, Ok, we have added support for automatic reconnection (and ping) in connection_pool_factory. If you would like, I can make you a pre- release package (just let me know which platform and if you need the ODB compiler binary). Boris Discover our world of Innovation and Product leadership - Be efficient, end-to-end with FlexACM Find out more @ www.newtec.eu/flexacm Meet us @ www.newtec.eu/events *** e-mail confidentiality footer *** This message and any attachments thereto are confidential. They may also be privileged or otherwise protected by work product immunity or other legal rules. If you have received it by mistake, please let us know by e-mail reply and delete it from your system; you may not copy this message or disclose its contents to anyone. E-mail transmission cannot be guaranteed to be secure or error free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore is in no way liable for any errors or omissions in the content of this message, which may arise as a result of e-mail transmission. If verification is required, please request a hard copy. From losintikfos at yahoo.co.uk Thu Feb 24 06:16:18 2011 From: losintikfos at yahoo.co.uk (Bright Dadson) Date: Thu Feb 24 09:43:55 2011 Subject: [odb-users] Passing persistence object to smart pointer Message-ID: <316075.58409.qm@web29003.mail.ird.yahoo.com> Hi Guys, I was wondering if it is possible to pass persistence object person as used in the demo to auto_ptr? I tried auto_ptr joan(new person()); and got below exception which I immediately thought I am violating the usage of my persistence object. But having still thought of this - I was wondering if it is possible to pass ownership to smart pointers without below exception been spat. Exception: usr/local/include/odb/database.ixx: In person function ?typename odb::object_traits::id_type odb::database::persist(const P&) [with T = person, P = std::auto_ptr]?: In file included from /usr/local/include/odb/database.hxx:184, /usr/local/include/odb/database.ixx:50: instantiated from ?typename odb::object_traits::id_type odb::database::persist(P&) [with T = person, P = std::auto_ptr]? driver.cpp:48: instantiated from here /usr/local/include/odb/database.ixx:40: error: invalid initialization of reference of type ?person* const&? from expression of type ?const std::auto_ptr? make: *** [build/Debug/GNU-Linux-x86/driver.o] Error 1 From boris at codesynthesis.com Thu Feb 24 09:52:15 2011 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Feb 24 09:50:25 2011 Subject: [odb-users] Passing persistence object to smart pointer In-Reply-To: <316075.58409.qm@web29003.mail.ird.yahoo.com> References: <316075.58409.qm@web29003.mail.ird.yahoo.com> Message-ID: Hi, Bright Dadson writes: > I tried auto_ptr joan(new person()); > > [...] > > /usr/local/include/odb/database.ixx:40: error: invalid initialization of > reference of type ?person* const&? from expression of type ?const > std::auto_ptr? By default ODB assumes the object pointer is the raw pointer (e.g., person*). If you want to use auto_ptr as the object pointer, you can run the ODB compiler with the following option: --default-pointer std::auto_ptr Alternatively, if you don't want to change the object pointer, then you can always pass a reference instead of a pointer to the database functions, for example: db->persist (*joan); Boris