List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:October 15 2009 7:57am
Subject:Re: mysqlpp::Connection copy c'tor segfaults
View as plain text  
On Oct 14, 2009, at 9:24 PM, Adam Nielsen wrote:

> I'm trying to open a new connection to a MySQL database by  
> duplicating an
> existing connection (as the docs[1] seem to indicate this is an  
> acceptable
> method) however it causes my application to segfault.

That's not the purpose of the copy ctor.  It exists solely so you can  
say things like this:

     void foo() {
        Connection conn(...parms...);
        ...do stuff...
        return conn;
     }

Without a dedicated copy ctor to manage certain under-the-hood  
details, this would fail.

You might look at ConnectionPool, as that centralizes creation of  
multiple connections, using a common create() method for all.

Thread
mysqlpp::Connection copy c'tor segfaultsAdam Nielsen15 Oct
  • Re: mysqlpp::Connection copy c'tor segfaultsWarren Young15 Oct
    • Re: mysqlpp::Connection copy c'tor segfaultsJonathan Wakely15 Oct
      • Re: mysqlpp::Connection copy c'tor segfaultsWarren Young15 Oct
        • Re: mysqlpp::Connection copy c'tor segfaultsJonathan Wakely15 Oct