[jifty-devel] MySQL: Transparent reconnect

Alexey Grebenschikov dimid at no-more.kiev.ua
Fri Feb 23 21:05:33 EST 2007


Hello Jesse,

On Fri, 2006-09-08 at 13:36 -0400, Jesse Vincent wrote:
> So,
> 
> It makes me a little twitchy to start setting environment variables  
> to get somewhat sketchy side-effects out of them. But I agree that  
> there ought to be a way to get what you want. So, I've just  
> refactored Jifty::DBI to allow you to stuff arbitrary arguments into  
> the database driver connect hash, right next to "database" "user"  
> "password" and "sid".  This will be in the next release of Jifty::DBI  
> (and in svn as soon as I push.
> 
> How's that sound?
> 
> Jesse

We don't avoid that issues because mysql_auto_reconnect is attribute and
doesn't set via DSN. I use mysql 5.0.32-Debian_3_log and Jifty (last
checkout from svn). My investigation shows that we can set the attribute
mysql_auto_reconnect only as follows: 
	$self->dbh->{mysql_auto_reconnect} = 1;

DBH ignores attributes in the DSN. For me i have written a simple patch.
I would like to propose it. May be it will be useful. The patch do next:

- gets all attributes from 
	Jifty->config->framework('Database')->{Attributes}
- sets them up when dbh is arrived.

etc/config.yml:

    Driver: mysql
    Host: localhost
    Attributes:
      mysql_auto_reconnect: 1


Thanks
Alexey

-------------- next part --------------
A non-text attachment was scrubbed...
Name: jifty.handle.patch
Type: text/x-patch
Size: 866 bytes
Desc: not available
Url : http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20070224/a3f9b944/jifty.handle.bin


More information about the jifty-devel mailing list