From: Rafael Kitover Date: Tue, 13 Apr 2010 07:16:38 +0000 (-0400) Subject: use column_info instead of select to get Oracle column list (RT#42281) X-Git-Tag: 0.07000~66 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4337bddf9f24ee07d447eb30f9d08cf9b8c4896b;p=dbsrgits%2FDBIx-Class-Schema-Loader.git use column_info instead of select to get Oracle column list (RT#42281) --- diff --git a/Changes b/Changes index 8e4c6ef..f1ff591 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - use column_info instead of select to get Oracle column list (RT#42281) - match quotes in MySQL parser in more places (RT#42101) - fix unique detection in DB2 for multiple schemas (RT#39622) - fix column name collisions with methods (RT#49443) diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm index 6a66410..5babfec 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Oracle.pm @@ -16,21 +16,10 @@ our $VERSION = '0.06001'; 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 { @@ -77,6 +66,15 @@ sub _tables_list { 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 { my ($self, $table) = @_; @@ -137,8 +135,8 @@ sub _extra_column_info { 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);