X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FOracle.pm;h=6a664104fdc87588adf8e3d1fc343af109312679;hb=5afd3e723f5c9644e67f9b623b069f870e94fdc9;hp=52d5c4f45a041f00b0362359486990446d3de5f5;hpb=c7bf4194447f499ab28dd4c0b944faf874367968;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index 52d5c4f..6a66410 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -2,11 +2,14 @@ package DBIx::Class::Schema::Loader::DBI::Oracle; use strict; use warnings; -use base 'DBIx::Class::Schema::Loader::DBI'; +use base qw/ + DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault + DBIx::Class::Schema::Loader::DBI +/; use Carp::Clan qw/^DBIx::Class/; use Class::C3; -our $VERSION = '0.04999_05'; +our $VERSION = '0.06001'; =head1 NAME @@ -36,22 +39,24 @@ 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', {}); -sub _table_columns { - my ($self, $table) = @_; + $self->{db_schema} ||= $current_schema; - my $dbh = $self->schema->storage->dbh; + if (lc($self->db_schema) ne lc($current_schema)) { + $dbh->do('ALTER SESSION SET current_schema=' . $self->db_schema); + } +} - my $sth = $dbh->prepare($self->schema->storage->sql_maker->select($table, undef, \'1 = 0')); - $sth->execute; - return \@{$sth->{NAME_lc}}; +sub _table_as_sql { + my ($self, $table) = @_; + + return $self->_quote_table_name($table); } sub _tables_list { - my $self = shift; + my ($self, $opts) = @_; my $dbh = $self->schema->storage->dbh; @@ -68,7 +73,8 @@ sub _tables_list { push @tables, $1 if $table =~ /\A(\w+)\z/; } - return @tables; + + return $self->_filter_tables(\@tables, $opts); } sub _table_uniq_info { @@ -80,12 +86,12 @@ sub _table_uniq_info { q{ SELECT constraint_name, acc.column_name FROM all_constraints JOIN all_cons_columns acc USING (constraint_name) - WHERE acc.table_name=? AND constraint_type='U' + WHERE acc.table_name=? and acc.owner = ? AND constraint_type='U' ORDER BY acc.position }, {}, 1); - $sth->execute(uc $table); + $sth->execute(uc $table,$self->{db_schema} ); my %constr_names; while(my $constr = $sth->fetchrow_arrayref) { my $constr_name = lc $constr->[0]; @@ -122,11 +128,9 @@ sub _columns_info_for { } sub _extra_column_info { - my ($self, $info) = @_; + my ($self, $table, $column, $info, $dbi_info) = @_; my %extra_info; - my ($table, $column) = @$info{qw/TABLE_NAME COLUMN_NAME/}; - my $dbh = $self->schema->storage->dbh; my $sth = $dbh->prepare_cached( q{ @@ -153,9 +157,12 @@ L =head1 AUTHOR -TSUNODA Kazuya C +See L and L. + +=head1 LICENSE -Dagfinn Ilmari Mannsåker C +This library is free software; you can redistribute it and/or modify it under +the same terms as Perl itself. =cut