List:MySQL++« Previous MessageNext Message »
From:Arnon Jalon Date:December 15 2005 3:06pm
Subject:RE: opt_reconnect patch
View as plain text  
In case you didn't get the second zip that I sent, I'm pasting it here
(I commented it following the pattern of other comments):

Index: lib/connection.cpp
===================================================================
--- lib/connection.cpp  (revision 1151)
+++ lib/connection.cpp  (working copy)
@@ -95,6 +95,7 @@
        Connection::opt_type_boolean,   // opt_secure_auth
        Connection::opt_type_boolean,   // opt_multi_statements
        Connection::opt_type_boolean,   // opt_report_data_truncation
+       Connection::opt_type_boolean,   // opt_reconnect
 };


@@ -413,6 +414,10 @@
                        case opt_report_data_truncation:
                                return
set_option_impl(MYSQL_REPORT_DATA_TRUNCATION, &my_arg);
 #endif
+#if MYSQL_VERSION_ID >= 50013
+                       case opt_reconnect:
+                               return
set_option_impl(MYSQL_OPT_RECONNECT, &my_arg);
+#endif
                        case opt_FIRST: // warning eater when using old
C APIs
                        default:
                                return bad_option(option,
opt_type_boolean);
Index: lib/connection.h
===================================================================
--- lib/connection.h    (revision 1151)
+++ lib/connection.h    (working copy)
@@ -101,6 +101,10 @@
                // Set reporting of data truncation errors
                opt_report_data_truncation,

+               // Enable or disable automatic reconnection 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







Arnon Jalon / Software Engineer
T: +1.212.231.7159 / F: +1.212.760.1774
arnon.jalon@stripped
24/7 Real Media, Inc. (NASDAQ: TFSM)
132 West 31st Street, 9th floor
New York, NY 10001
WWW.247REALMEDIA.COM
>DELIVERING TODAY >DEFINING TOMORROW 

> -----Original Message-----
> From: Warren Young [mailto:mysqlpp@stripped] 
> Sent: Thursday, December 15, 2005 9:24 AM
> To: MySQL++ Mailing List
> Subject: Re: opt_reconnect patch
> 
> Jalon, Arnon wrote:
> >  
> > 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.
> 
> This sounds reasonable, but your patch didn't make it 
> through.  Instead of trying to attach it, it may work better 
> in your mailer to simply cut-and-paste the text of the patch 
> into the email.
> 
> > 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"?
> 
> I don't have any specific advice for you here, but I will 
> observe that there are other cases where the exact timing of 
> when you set the option does matter.  As long as MySQL++ 
> remains MySQL-specific, this is at worst going to be a matter 
> of documentation.  (On that note, I hope your patch includes 
> an appropriate update to the Doxygen comments.)
> 
> If we ever do make MySQL++ database-independent, sorting this 
> out should probably become a feature, where the library 
> understands the rules for each database type.
> 
> -- 
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:    
> http://lists.mysql.com/plusplus?unsub=1
> 
> 

Attachment: [application/x-zip-compressed] opt_reconnect.zip opt_reconnect.zip
Thread
opt_reconnect patchArnon Jalon9 Dec
  • Re: opt_reconnect patchWarren Young15 Dec
RE: opt_reconnect patchArnon Jalon14 Dec
RE: opt_reconnect patchArnon Jalon15 Dec
RE: opt_reconnect patchArnon Jalon19 Dec
  • Re: opt_reconnect patchWarren Young20 Dec
RE: opt_reconnect patchArnon Jalon20 Dec