[Rt-commit] r14584 - rt/3.8/trunk/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Mon Jul 28 20:30:14 EDT 2008
Author: ruz
Date: Mon Jul 28 20:30:12 2008
New Revision: 14584
Modified:
rt/3.8/trunk/lib/RT/Handle.pm
Log:
* execute SET NAMES on mysql 4.1 and newer
Modified: rt/3.8/trunk/lib/RT/Handle.pm
==============================================================================
--- rt/3.8/trunk/lib/RT/Handle.pm (original)
+++ rt/3.8/trunk/lib/RT/Handle.pm Mon Jul 28 20:30:12 2008
@@ -102,15 +102,22 @@
sub Connect {
my $self = shift;
- if ( RT->Config->Get('DatabaseType') eq 'Oracle' ) {
+ my $db_type = RT->Config->Get('DatabaseType');
+ if ( $db_type eq 'Oracle' ) {
$ENV{'NLS_LANG'} = "AMERICAN_AMERICA.AL32UTF8";
$ENV{'NLS_NCHAR'} = "AL32UTF8";
}
$self->SUPER::Connect(
- User => RT->Config->Get('DatabaseUser'),
+ User => RT->Config->Get('DatabaseUser'),
Password => RT->Config->Get('DatabasePassword'),
- );
+ );
+
+ if ( $db_type eq 'mysql' ) {
+ my $version = $self->DatabaseVersion;
+ ($version) = $version =~ /^(\d+\.\d+)/;
+ $self->dbh->do("SET NAMES 'utf8'") if $version >= 4.1;
+ }
$self->dbh->{'LongReadLen'} = RT->Config->Get('MaxAttachmentSize');
}
More information about the Rt-commit
mailing list