X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FOracle.pm;h=d93cfe394e0ded2785fc95dc790ad71322278369;hb=9990e58f49603b81e3c1195c0e83595b0333c8df;hp=21e535e90a81057ab9fcd7f2d58955be91a47c14;hpb=46065bcbc86d682dceed2efa601d9635939f6f16;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 21e535e..d93cfe3 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -2,32 +2,24 @@ 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_12'; +our $VERSION = '0.07000'; =head1 NAME DBIx::Class::Schema::Loader::DBI::Oracle - DBIx::Class::Schema::Loader::DBI Oracle Implementation. -=head1 SYNOPSIS - - package My::Schema; - use base qw/DBIx::Class::Schema::Loader/; - - __PACKAGE__->loader_options( debug => 1 ); - - 1; - =head1 DESCRIPTION See L. -This module is considered experimental and not well tested yet. - =cut sub _setup { @@ -46,19 +38,14 @@ sub _setup { } } - -sub _table_columns { +sub _table_as_sql { my ($self, $table) = @_; - my $dbh = $self->schema->storage->dbh; - - my $sth = $dbh->prepare($self->schema->storage->sql_maker->select($table, undef, \'1 = 0')); - $sth->execute; - return \@{$sth->{NAME_lc}}; + return $self->_quote_table_name($table); } sub _tables_list { - my $self = shift; + my ($self, $opts) = @_; my $dbh = $self->schema->storage->dbh; @@ -75,7 +62,17 @@ sub _tables_list { push @tables, $1 if $table =~ /\A(\w+)\z/; } - return @tables; + + return $self->_filter_tables(\@tables, $opts); +} + +sub _table_columns { + my ($self, $table) = @_; + + my $dbh = $self->schema->storage->dbh; + + my $sth = $dbh->column_info(undef, $self->db_schema, uc $table, '%'); + return [ map lc($_->{COLUMN_NAME}), @{ $sth->fetchall_arrayref({ COLUMN_NAME => 1 }) || [] } ]; } sub _table_uniq_info { @@ -129,19 +126,17 @@ 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{ SELECT COUNT(*) FROM all_triggers ut JOIN all_trigger_cols atc USING (trigger_name) WHERE atc.table_name = ? AND atc.column_name = ? - AND column_usage LIKE '%NEW%' AND column_usage LIKE '%OUT%' - AND trigger_type = 'BEFORE EACH ROW' AND triggering_event LIKE '%INSERT%' + AND lower(column_usage) LIKE '%new%' AND lower(column_usage) LIKE '%out%' + AND trigger_type = 'BEFORE EACH ROW' AND lower(triggering_event) LIKE '%insert%' }, {}, 1); @@ -160,7 +155,7 @@ L =head1 AUTHOR -See L. +See L and L. =head1 LICENSE