![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
mysql 5.0.13 introduced a flag that will allow the connection to automatically reconnect if it lost its connection to the server for some reason. I added a opt_reconnect flag to the Connection class to allow for this flag to be set. |
|
I've tested it by setting the option in my Connection object before connecting, and verified that it works. I was slightly confused because I noticed that the Connection object will only apply the options while it is connecting or if it is connected, meaning that it will only apply any options after real_connect has been called. Looking at the MySql 5 documentation for mysql_options, it says "|mysql_options()| should be called after |mysql_init()| and before |mysql_connect()| or |mysql_real_connect()|." Seeing as the behaviour associated with the flag I'm setting is working, I assume that that "should" is really just a "should"? |
#2
| |||
| |||
|
|
DELIVERING TODAY >DEFINING TOMORROW=20 -----Original Message----- From: Warren Young [mailto:mysqlpp (AT) etr-usa (DOT) com]=20 Sent: Thursday, December 15, 2005 9:24 AM To: MySQL++ Mailing List Subject: Re: opt_reconnect patch =20 Jalon, Arnon wrote: =20 mysql 5.0.13 introduced a flag that will allow the connection to=20 automatically reconnect if it lost its connection to the server for=20 some reason. I added a opt_reconnect flag to the=20 Connection class to=20 allow for this flag to be set. =20 This sounds reasonable, but your patch didn't make it=20 through. Instead of trying to attach it, it may work better=20 in your mailer to simply cut-and-paste the text of the patch=20 into the email. =20 I've tested it by setting the option in my Connection object before=20 connecting, and verified that it works. I was slightly confused=20 because I noticed that the Connection object will only apply the=20 options while it is connecting or if it is connected,=20 meaning that it=20 will only apply any options after real_connect has been called. =20 Looking at the MySql 5 documentation for mysql_options, it says=20 "|mysql_options()| should be called after |mysql_init()| and before=20 |mysql_connect()| or |mysql_real_connect()|." Seeing as the behaviour=20 associated with the flag I'm setting is working, I assume that that "should" is really=20 just a "should"? =20 I don't have any specific advice for you here, but I will=20 observe that there are other cases where the exact timing of=20 when you set the option does matter. As long as MySQL++=20 remains MySQL-specific, this is at worst going to be a matter=20 of documentation. (On that note, I hope your patch includes=20 an appropriate update to the Doxygen comments.) =20 If we ever do make MySQL++ database-independent, sorting this=20 out should probably become a feature, where the library=20 understands the rules for each database type. =20 --=20 MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: =20 http://lists.mysql.com/plusplus?unsu...edia (DOT) com =20 =20 |
#3
| |||
| |||
|
|
DELIVERING TODAY >DEFINING TOMORROW=20 -----Original Message----- From: Jalon, Arnon=20 Sent: Thursday, December 15, 2005 10:06 AM To: MySQL++ Mailing List Subject: RE: opt_reconnect patch =20 =20 In case you didn't get the second zip that I sent, I'm=20 pasting it here (I commented it following the pattern of=20 other comments): =20 Index: lib/connection.cpp = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D= |
|
--- lib/connection.cpp (revision 1151) +++ lib/connection.cpp (working copy) @@ -95,6 +95,7 @@ Connection: pt_type_boolean, // opt_secure_authConnection: pt_type_boolean, // opt_multi_statementsConnection: pt_type_boolean, // opt_report_data_truncation+ Connection: pt_type_boolean, // opt_reconnect}; =20 =20 @@ -413,6 +414,10 @@ case opt_report_data_truncation: return=20 set_option_impl(MYSQL_REPORT_DATA_TRUNCATION, &my_arg); #endif +#if MYSQL_VERSION_ID >=3D 50013 + case opt_reconnect: + return=20 +set_option_impl(MYSQL_OPT_RECONNECT, &my_arg); #endif case opt_FIRST: // warning eater when=20 using old C APIs default: return bad_option(option,=20 opt_type_boolean); Index: lib/connection.h = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3 D=3D=3D=3D=3D=3D=3D=3D=3D= |
|
--- lib/connection.h (revision 1151) +++ lib/connection.h (working copy) @@ -101,6 +101,10 @@ // Set reporting of data truncation errors opt_report_data_truncation, =20 + // Enable or disable automatic reconnection=20 to the server if + // the connection is found to have been lost. + opt_reconnect, + // Number of options supported. Never send this to // set_option()! opt_COUNT =20 =20 =20 =20 =20 =20 =20 Arnon Jalon / Software Engineer T: +1.212.231.7159 / F: +1.212.760.1774 arnon.jalon (AT) 247realmedia (DOT) com 24/7 Real Media, Inc. (NASDAQ: TFSM) 132 West 31st Street, 9th floor New York, NY 10001 WWW.247REALMEDIA.COM DELIVERING TODAY >DEFINING TOMORROW =20 -----Original Message----- From: Warren Young [mailto:mysqlpp (AT) etr-usa (DOT) com] Sent: Thursday, December 15, 2005 9:24 AM To: MySQL++ Mailing List Subject: Re: opt_reconnect patch =20 Jalon, Arnon wrote: =20 mysql 5.0.13 introduced a flag that will allow the connection to=20 automatically reconnect if it lost its connection to the=20 server for=20 some reason. I added a opt_reconnect flag to the Connection class to allow for this flag to be set. =20 This sounds reasonable, but your patch didn't make it through. =20 Instead of trying to attach it, it may work better in your=20 mailer to=20 simply cut-and-paste the text of the patch into the email. =20 I've tested it by setting the option in my Connection=20 object before=20 connecting, and verified that it works. I was slightly confused=20 because I noticed that the Connection object will only apply the=20 options while it is connecting or if it is connected, meaning that it will only apply any options after real_connect has been called. =20 Looking at the MySql 5 documentation for mysql_options, it says=20 "|mysql_options()| should be called after |mysql_init()|=20 and before |mysql_connect()| or |mysql_real_connect()|." Seeing as the behaviour associated with the flag I'm setting is working, I assume that that "should"=20 is really=20 just a "should"? =20 I don't have any specific advice for you here, but I will=20 observe that=20 there are other cases where the exact timing of when you set the=20 option does matter. As long as MySQL++ remains=20 MySQL-specific, this=20 is at worst going to be a matter of documentation. (On=20 that note, I=20 hope your patch includes an appropriate update to the Doxygen=20 comments.) =20 If we ever do make MySQL++ database-independent, sorting this out=20 should probably become a feature, where the library understands the=20 rules for each database type. =20 -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: =20 http://lists.mysql.com/plusplus?unsu...edia (DOT) com =20 =20 |
#4
| |||
| |||
|
|
Hate to pester you, Warren, |

|
we don't want to deploy my patched version of 2.0.7, unless we have confirmation that it will come in the next, or relatively next release. |
#5
| |||
| |||
|
|
DELIVERING TODAY >DEFINING TOMORROW=20 -----Original Message----- From: Warren Young [mailto:mysqlpp (AT) etr-usa (DOT) com]=20 Sent: Tuesday, December 20, 2005 2:50 AM To: MySQL++ Mailing List Subject: Re: opt_reconnect patch =20 Jalon, Arnon wrote: Hate to pester you, Warren, =20 It needed doing. ![]() =20 we don't want to deploy my patched version of 2.0.7, unless we have=20 confirmation that it will come in the next, or relatively=20 next release. =20 I don't know when the next release will be, but you may take=20 some comfort from knowing that it's been committed to Subversion. =20 --=20 MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: =20 http://lists.mysql.com/plusplus?unsu...edia (DOT) com =20 =20 |
![]() |
| Thread Tools | |
| Display Modes | |
| |