From: Pete <pe...@ka...> - 2012-04-27 02:05:05
|
Hi Simon, I'm not sure what you mean by: > I can use the same odbc::DriverManager that I used with the > first query but not odbc::Connection or odbc::PreparedStatement. Attached is a little example that iterates over all orders in my database and while fetching each order from the result set, goes to the database and gets the related customers name by using the same connection, creating a new statement and processing the result from another query. This is also called "Multiple active result sets" or MARS. My test works with Orcle too. I'm sure you'll find it easy to adjust the sample to your database. You may notice my use of smart pointers which keep the code clean and simple. Also, recycling ako odbc::Statement objects makes little sense since they load meta data and establish fetch handlers so there is hardly a case for recycling. Pete > -----Original Message----- > From: Simon Walter [mailto:si...@gi...] > Sent: Thursday, 26 April 2012 2:01 p.m. > To: lib...@li... > Subject: [libodbcxx-devel] Can I reuse connections, statements? > > Hi all, > > I'm making a two successive queries to a DB. The second one > does not return any results unless I create a new connection. > I also cannot reuse a statement object. > > If this is by design and the way the library works, that's > fine. I just want make sure I'm not using it wrong. > > I can use the same odbc::DriverManager that I used with the > first query but not odbc::Connection or odbc::PreparedStatement. > > Cheers, > > Simon > > PS > > One comment about the documentation, which is overall excellent: > > odbc::Date::getTime indicates that only the time part of the > date is returned as time_t, when actually the entire date is > returned as time_t. > > "/Returns the time_t value of |00:00:00| at this date."/ > > Perhaps: "Returns the time_t value of this date." would be clearer. > > http://libodbcxx.sourceforge.net/libodbc++/progref/classodbc_1 > _1_date.html#a8 > > -- > simonsmicrophone.com > > > -------------------------------------------------------------- > ---------------- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the > latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > libodbcxx-devel mailing list > lib...@li... > https://lists.sourceforge.net/lists/listinfo/libodbcxx-devel > |