Author: wyoung
Date: Sun Aug 30 06:38:48 2009
New Revision: 2570
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2570&view=rev
Log:
Earlier fix for the multiple-connect problem on Windows broke
pre-connect() option setting mechanism, because we weren't calling
mysql_init() until right before mysql_real_connect(). Still putting off
that call, but storing options in a pending options queue, which we
apply between the mysql_init() and mysql_real_connect() calls. As with
previous checkin, this again breaks the DBDriver ABI, but it doesn't
matter.
Modified:
trunk/lib/dbdriver.cpp
trunk/lib/dbdriver.h
Modified: trunk/lib/dbdriver.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/dbdriver.cpp?rev=2570&r1=2569&r2=2570&view=diff
==============================================================================
--- trunk/lib/dbdriver.cpp (original)
+++ trunk/lib/dbdriver.cpp Sun Aug 30 06:38:48 2009
@@ -107,7 +107,20 @@
// Set up to call MySQL C API
mysql_init(&mysql_);
- return true;
+
+ // Apply any pending options
+ error_message_.clear();
+ OptionListIt it = pending_options_.begin();
+ while (it != pending_options_.end() && set_option_impl(*it)) {
+ ++it;
+ }
+ if (it == pending_options_.end()) {
+ pending_options_.clear();
+ return true;
+ }
+ else {
+ return false;
+ }
}
@@ -276,6 +289,7 @@
}
else {
error_message_.clear();
+ pending_options_.push_back(o);
return true; // we won't know if it fails until ::connect()
}
}
Modified: trunk/lib/dbdriver.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/dbdriver.h?rev=2570&r1=2569&r2=2570&view=diff
==============================================================================
--- trunk/lib/dbdriver.h (original)
+++ trunk/lib/dbdriver.h Sun Aug 30 06:38:48 2009
@@ -697,6 +697,9 @@
/// \brief Data type of the list of applied connection options
typedef std::deque<Option*> OptionList;
+ /// \brief Iterator into an OptionList
+ typedef OptionList::iterator OptionListIt;
+
/// \brief Hidden assignment operator; we don't want to be copied
/// that way. What would it mean?
DBDriver& operator=(const DBDriver&);
@@ -704,6 +707,7 @@
MYSQL mysql_;
bool is_connected_;
OptionList applied_options_;
+ OptionList pending_options_;
mutable std::string error_message_;
};
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits