Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/RT/Authen/ExternalAuth/DBI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,30 @@ sub _GetBoundDBIObj {
$dsn = "dbi:$dbi_driver:database=$db_database;host=$db_server;port=$db_port";
}

if (RT->Config->Get('DatabaseExtraDSN')) {
my %extra = RT->Config->Get('DatabaseExtraDSN');
$dsn .= ";$_=$extra{$_}"
for sort keys %extra;
}

my $db_type = RT->Config->Get('DatabaseType');
if ( $db_type eq 'Oracle' ) {
$ENV{'NLS_LANG'} = "AMERICAN_AMERICA.AL32UTF8";
$ENV{'NLS_NCHAR'} = "AL32UTF8";
}

# Now let's get connected
my $dbh = DBI->connect($dsn, $db_user, $db_pass,{RaiseError => 1, AutoCommit => 0 })
or die $DBI::errstr;

if ( $db_type eq 'mysql' ) {
$dbh->do("SET NAMES 'utf8'");
}

if ( $db_type eq 'Pg' ) {
$dbh->do("SET bytea_output = 'escape'");
}

# If we didn't die, return the DBI object handle
# and hope it's treated sensibly and correctly
# destroyed by the calling code
Expand Down