1 package # hide from pause/cpan for now, as there's a permissions
2 # issue and it's screwing the rest of the package
3 DBIx::Class::Schema::Loader::DBI::Oracle;
7 use base 'DBIx::Class::Schema::Loader::DBI';
8 use Carp::Clan qw/^DBIx::Class/;
11 our $VERSION = '0.04999_01';
15 DBIx::Class::Schema::Loader::DBI::Oracle - DBIx::Class::Schema::Loader::DBI
16 Oracle Implementation.
21 use base qw/DBIx::Class::Schema::Loader/;
23 __PACKAGE__->loader_options( debug => 1 );
29 See L<DBIx::Class::Schema::Loader::Base>.
31 This module is considered experimental and not well tested yet.
38 $self->next::method(@_);
40 my $dbh = $self->schema->storage->dbh;
41 $self->{db_schema} ||= $dbh->selectrow_array('SELECT USER FROM DUAL', {});
46 my ($self, $table) = @_;
48 my $dbh = $self->schema->storage->dbh;
50 my $sth = $dbh->prepare($self->schema->storage->sql_maker->select($table, undef, \'1 = 0'));
52 return \@{$sth->{NAME_lc}};
58 my $dbh = $self->schema->storage->dbh;
61 for my $table ( $dbh->tables(undef, $self->db_schema, '%', 'TABLE,VIEW') ) { #catalog, schema, table, type
62 my $quoter = $dbh->get_info(29);
63 $table =~ s/$quoter//g;
65 # remove "user." (schema) prefixes
68 next if $table eq 'PLAN_TABLE';
71 if $table =~ /\A(\w+)\z/;
76 sub _table_uniq_info {
77 my ($self, $table) = @_;
79 my $dbh = $self->schema->storage->dbh;
81 my $sth = $dbh->prepare_cached(
83 SELECT constraint_name, ucc.column_name
84 FROM user_constraints JOIN user_cons_columns ucc USING (constraint_name)
85 WHERE ucc.table_name=? AND constraint_type='U'
90 $sth->execute(uc $table);
92 while(my $constr = $sth->fetchrow_arrayref) {
93 my $constr_name = lc $constr->[0];
94 my $constr_def = lc $constr->[1];
95 $constr_name =~ s/\Q$self->{_quoter}\E//;
96 $constr_def =~ s/\Q$self->{_quoter}\E//;
97 push @{$constr_names{$constr_name}}, $constr_def;
100 my @uniqs = map { [ $_ => $constr_names{$_} ] } keys %constr_names;
105 my ($self, $table) = @_;
106 return $self->next::method(uc $table);
110 my ($self, $table) = @_;
112 my $rels = $self->next::method(uc $table);
114 foreach my $rel (@$rels) {
115 $rel->{remote_table} = lc $rel->{remote_table};
121 sub _columns_info_for {
122 my ($self, $table) = @_;
123 return $self->next::method(uc $table);
128 L<DBIx::Class::Schema::Loader>, L<DBIx::Class::Schema::Loader::Base>,
129 L<DBIx::Class::Schema::Loader::DBI>
133 TSUNODA Kazuya C<drk@drk7.jp>