From: Rafael Kitover Date: Tue, 1 Dec 2009 01:43:04 +0000 (+0000) Subject: better handling of db_schema for Oracle, based on (RT#35732) X-Git-Tag: 0.04999_13~24 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=46065bcbc86d682dceed2efa601d9635939f6f16;p=dbsrgits%2FDBIx-Class-Schema-Loader.git better handling of db_schema for Oracle, based on (RT#35732) --- diff --git a/Changes b/Changes index bda06a0..41e4510 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - better handling of db_schema for Oracle, based on (RT#35732) + 0.04999_12 2009-11-30 23:36:14 - fix MySQL rel introspection with on_connect_call => 'set_strict_mode' (RT#52087) diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index 59a0dee..21e535e 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -36,7 +36,14 @@ sub _setup { $self->next::method(@_); my $dbh = $self->schema->storage->dbh; - $self->{db_schema} ||= $dbh->selectrow_array('SELECT USER FROM DUAL', {}); + + my ($current_schema) = $dbh->selectrow_array('SELECT USER FROM DUAL', {}); + + $self->{db_schema} ||= $current_schema; + + if (lc($self->db_schema) ne lc($current_schema)) { + $dbh->do('ALTER SESSION SET current_schema=' . $self->db_schema); + } }