DBD-mysql
DBD-mysql copied to clipboard
Trigger Callback on auto_reconnect [rt.cpan.org #79825]
trafficstars
Migrated from rt.cpan.org#79825 (status was 'open')
Requestors:
From [email protected] on 2012-09-24 06:04:45:
Applications run into timezone problems when using mysql_auto_reconnect
with mySQL "SET time_zone":
http://www.pal-blog.de/entwicklung/mysql/2012/mysql-mysql_auto_reconnect-
timezone-issues.html
A Callback trigger (either a new one or the DBI connect Callback) would
be great to re-set options like the time_zone.
From [email protected] on 2012-10-31 23:21:23:
On Mon Sep 24 02:04:45 2012, SEWI wrote:
> Applications run into timezone problems when using
mysql_auto_reconnect
> with mySQL "SET time_zone":
> http://www.pal-blog.de/entwicklung/mysql/2012/mysql-
mysql_auto_reconnect-
> timezone-issues.html
>
> A Callback trigger (either a new one or the DBI connect Callback)
would
> be great to re-set options like the time_zone.
add this (available since DBD::mysql 4.013) to your connect() options
hash and it'll automagically get executed whenever libmysqlclient
connects (or autoreconnects) under the covers of DBD::mysql:
{ ...
mysql_init_command => 'SET time_zone="Europe/Helsinki"',
mysql_auto_reconnect => 1,
... }
From [email protected] on 2016-08-21 20:02:18:
Am Mi 31. Okt 2012, 19:21:23, chrishammond schrieb:
> add this (available since DBD::mysql 4.013) to your connect() options
> hash and it'll automagically get executed whenever libmysqlclient
> connects (or autoreconnects) under the covers of DBD::mysql:
>
> { ...
> mysql_init_command => 'SET time_zone="Europe/Helsinki"',
> mysql_auto_reconnect => 1,
> ... }
>
Doesn't help. The init_command fixes the time_zone problem, but there are many other session variables, etc. which can't be set in a single command. That's why init_command is no solution to the problem. A callback would be able to full restore the state of the connection, init_command doesn't.