From: Warren Young Date: August 12 2010 8:57pm Subject: Re: I fixed this problem by setting pending_options in disconnect(). List-Archive: http://lists.mysql.com/plusplus/9015 Message-Id: <4C646026.1000303@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 8/11/2010 11:00 PM, Heejin Ju wrote: > > void > DBDriver::disconnect() > { > if (is_connected_) { > mysql_close(&mysql_); > memset(&mysql_, 0, sizeof(mysql_)); > is_connected_ = false; > error_message_.clear(); > > // added code begin > pending_options_ = applied_options_; > applied_options_.clear(); > // added code end > } > } It's not clear to me exactly what you're trying to do here. My guess is that you want MySQL++ to automatically reapply previously-set connection options when bouncing the connection. If so, I think MySQL++ is already doing the right thing, and that your change can cause problems. An explicit Connection::disconnect() followed by a connect() call on the same object doesn't always indicate a reconnect to the same server, with the same parameters. I'd guess that most of the time, code that does this is trying to connect to a different server, or at least renegotiate a different type of connection to the same server. I don't see why we'd want to restrict this call pattern in MySQL++ so you always get the same options on the new connection. The new connection might need different options. Furthermore, the way the library currently works doesn't prevent you from reapplying the options yourself. You don't need MySQL++ to change for this. It might be nice to have DBDriver::reconnect() (wrapped in Connection), which disconnects, re-enqueues all the options, then connects. My main objection to doing that is that I don't see where you'd actually use it. If you just need the connection to be automatically reestablished if it drops for some reason, MySQL++ already provides ReconnectOption. So, I'd need a use case where ReconnectOption isn't sufficient to justify adding this method.