On Oct 13, 2009, at 10:48 PM, B Singh wrote:
> Is it bad idea to have connection object in heap ?
No, I think most real programs using MySQL++ do it that way. It's on
the stack in the examples just to keep them simple.
> I see all samples are using stack variable for connection and only
> heap for
> multistatementoption.
Actually, the cpool example keeps its Connection objects on the heap,
too. It's not obvious because we use the default creation mechanism
in ConnectionPool::create(), rather than provide our own.
> delete m_pcommonMultiStOption;
There's your bug. MySQL++ owns the option objects after you pass them
to Connection::set_option(). If you delete them yourself, you get a
double-delete, which is what's crashing your program.