Related Documentation Download this Manual Excerpts from this Manual


This page has moved or been replaced. The new page is located here:

Please update any bookmarks that point to the old page.

Download this Manual
User Comments
  Posted by David Phillips on April 8, 2011
Suggest wrapping those allocated objects in auto pointers.

std::auto_ptr< sql::Connection > apConn( driver->connect("tcp://", "root", "root" ) ) ;

std::auto_ptr< sql::Statement > apStmnt( apConn->createStatement( ) ) ;

std::auto_ptr< sql::ResultSet > apRes( apStmnt->executeQuery("SELECT 'Hello World!' AS _message") ) ;

//Dont have to manually delete the pointers now and no
//memory leak if exception is thrown
Sign Up Login You must be logged in to post a comment.