import rt 3.6.4
[freeside.git] / rt / lib / RT / Handle.pm
index 8d4563b..7ba5ee8 100644 (file)
@@ -1,8 +1,8 @@
-# {{{ BEGIN BPS TAGGED BLOCK
+# BEGIN BPS TAGGED BLOCK {{{
 # 
 # COPYRIGHT:
 #  
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC 
 #                                          <jesse@bestpractical.com>
 # 
 # (Except where explicitly superseded by other copyright notices)
@@ -22,7 +22,9 @@
 # 
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/copyleft/gpl.html.
 # 
 # 
 # CONTRIBUTION SUBMISSION POLICY:
@@ -42,7 +44,7 @@
 # works based on those contributions, and sublicense and distribute
 # those contributions and any derivatives thereof.
 # 
-# }}} END BPS TAGGED BLOCK
+# END BPS TAGGED BLOCK }}}
 =head1 NAME
 
   RT::Handle - RT's database handle
@@ -89,7 +91,9 @@ sub Connect {
     my $self = shift;
 
     if ($RT::DatabaseType eq 'Oracle') {
-        $ENV{'NLS_LANG'} = ".UTF8";
+        $ENV{'NLS_LANG'} = "AMERICAN_AMERICA.AL32UTF8";
+        $ENV{'NLS_NCHAR'} = "AL32UTF8";
+        
     }
 
     $self->SUPER::Connect(
@@ -101,19 +105,23 @@ sub Connect {
    
 }
 
-=item BuildDSN
+=head2 BuildDSN
 
 Build the DSN for the RT database. doesn't take any parameters, draws all that
 from the config file.
 
 =cut
 
+use File::Spec;
 
 sub BuildDSN {
     my $self = shift;
 # Unless the database port is a positive integer, we really don't want to pass it.
 $RT::DatabasePort = undef unless (defined $RT::DatabasePort && $RT::DatabasePort =~ /^(\d+)$/);
 $RT::DatabaseHost = undef unless (defined $RT::DatabaseHost && $RT::DatabaseHost ne '');
+$RT::DatabaseName = File::Spec->catfile($RT::VarPath, $RT::DatabaseName)
+    if ($RT::DatabaseType eq 'SQLite') and
+       not File::Spec->file_name_is_absolute($RT::DatabaseName);
 
 
     $self->SUPER::BuildDSN(Host => $RT::DatabaseHost,