apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Dubov <oa...@yahoo.com>
Subject Re: [PATCH]: enable automatic reconnect for mysql >= 5.0.13
Date Wed, 24 May 2006 05:26:41 GMT
I'm using 5.0.18. I've tested the patch over night and
it worked. Now I think it could be by accident,
because comment in the libmysql/client.c suggests that
mysql_real_connect resets this flag. So, unlike other
options, MYSQL_OPT_RECONNECT flag must be set after
the mysql_real_connect.

The comment also says that it is possible to do
something like this for mysql <  5.0.13:
-----
MYSQL *db;
....
db = mysql_real_connect(db, ...)
db->reconnect = 1;
...
-----
but there is no guarantee that such behavior will be
supported in the future.

In light of this - new patch. Also fixes a small
memory leak, which may happen if mysql_real_connect
fails, but mysql_init succeeds.

--- Bojan Smojver <bojan@rexursive.com> wrote:

> Quoting Alex Dubov <oakad@yahoo.com>:
> 
> > libmysqlclient v4 reconnects automatically when
> mysqld
> > closes connection. libmysqlclient v5 won't. I
> thought
> > to implement explicit reconnect for this
> condition,
> > but then found that it can be easily enabled in
> mysql
> 
> In your testing, does 3rd comment on this page hold
> true?
> 
>
http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html
> 
> Peter claims options for reconnect should be called
> after the  
> connection. I'm guessing you're using something
> above 5.0.16, so this  
> may have been fixed, although this page seems to
> support him:
> 
>
http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html
> 
> -- 
> Bojan
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mime
View raw message