@@ -561,6 +561,7 @@ void MySQL_Connection::init(ConnectOptionsMap & properties)
561
561
bool opt_reconnect = false ;
562
562
int client_exp_pwd = false ;
563
563
bool opt_dns_srv = false ;
564
+ bool opt_multi_host = false ;
564
565
#if MYCPPCONN_STATIC_MYSQL_VERSION_ID < 80000
565
566
bool secure_auth= true ;
566
567
#endif
@@ -806,12 +807,22 @@ void MySQL_Connection::init(ConnectOptionsMap & properties)
806
807
try {
807
808
p_b = (it->second ).get <bool >();
808
809
} catch (sql::InvalidArgumentException&) {
809
- throw sql::InvalidArgumentException (" Wrong type passed for OPT_DNS_SRV expected bool" );
810
+ throw sql::InvalidArgumentException (" Wrong type passed for OPT_DNS_SRV, expected bool" );
810
811
}
811
812
if (!(p_b)) {
812
813
throw sql::InvalidArgumentException (" No bool value passed for OPT_DNS_SRV" );
813
814
}
814
815
opt_dns_srv = *p_b;
816
+ } else if (!it->first .compare (" OPT_MULTI_HOST" )) {
817
+ try {
818
+ p_b = (it->second ).get <bool >();
819
+ } catch (sql::InvalidArgumentException&) {
820
+ throw sql::InvalidArgumentException (" Wrong type passed for OPT_MULTI_HOST, expected bool" );
821
+ }
822
+ if (!(p_b)) {
823
+ throw sql::InvalidArgumentException (" No bool value passed for OPT_MULTI_HOST" );
824
+ }
825
+ opt_multi_host = *p_b;
815
826
} else if (!it->first .compare (" OPT_CHARSET_NAME" )) {
816
827
try {
817
828
p_s = (it->second ).get < sql::SQLString >();
@@ -989,15 +1000,6 @@ void MySQL_Connection::init(ConnectOptionsMap & properties)
989
1000
PROCESS_CONN_OPTION (int , intOptions);
990
1001
}
991
1002
992
- bool opt_multi_host = false ;
993
- it = properties.find (" OPT_MULTI_HOST" );
994
- try {
995
- if (it != properties.end ())
996
- opt_multi_host = it->second .get <bool >();
997
- } catch (sql::InvalidArgumentException&) {
998
- throw sql::InvalidArgumentException (" Wrong type passed for OPT_MULTI_HOST, expected bool" );
999
- }
1000
-
1001
1003
if (!opt_multi_host && uri.size () > 1 )
1002
1004
throw sql::InvalidArgumentException (" Missing option OPT_MULTI_HOST = true" );
1003
1005
0 commit comments