[Jifty-commit] r2922 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Mar 7 14:06:37 EST 2007
Author: jesse
Date: Wed Mar 7 14:06:37 2007
New Revision: 2922
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Handle.pm
Log:
r53213 at pinglin: jesse | 2007-03-07 14:06:27 -0500
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
From: Alexey Grebenschikov <dimid at no-more.kiev.ua>
Modified: jifty/trunk/lib/Jifty/Handle.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handle.pm (original)
+++ jifty/trunk/lib/Jifty/Handle.pm Wed Mar 7 14:06:37 2007
@@ -86,12 +86,18 @@
my %lc_db_config;
# Skip the non-dsn keys, but not anything else
- for (grep {!/^checkschema|version|recordbaseclass$/i} keys %db_config) {
+ for (grep {!/^checkschema|version|recordbaseclass|attributes$/i} keys %db_config) {
$lc_db_config{lc($_)} = $db_config{$_};
}
$self->SUPER::connect( %lc_db_config , %args);
$self->{db_config} = { %lc_db_config , %args };
$self->dbh->{LongReadLen} = Jifty->config->framework('MaxAttachmentSize') || '10000000';
+
+ # setup attributes
+ my $attributes = Jifty->config->framework('Database')->{Attributes} || {};
+ for (keys %$attributes) {
+ $self->dbh->{lc($_)} = $attributes->{$_};
+ }
}
More information about the Jifty-commit
mailing list