From: Dagfinn Ilmari Mannsåker Date: Wed, 12 Mar 2008 12:59:30 +0000 (+0000) Subject: Add is_auto_increment detecton for DB2 X-Git-Tag: 0.04999_04~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=772cfe65c2d30db9f21da7ed2a08ac34ca76246e;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Add is_auto_increment detecton for DB2 --- diff --git a/Changes b/Changes index d7b708d..90a3ca9 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for Perl extension DBIx::Class::Schema::Loader +Not yet released + - Add is_auto_increment detecton for DB2 + 0.04999_03 Wed Mar 12, 2008 - Fix DB2 support diff --git a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm index 3909efd..b14abdb 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/DB2.pm @@ -86,6 +86,29 @@ sub _columns_info_for { return $self->next::method(uc $table); } +sub _extra_column_info { + my ($self, $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 syscat.columns + WHERE tabschema = ? AND tabname = ? AND colname = ? + AND identity = 'Y' AND generated != '' + }, + {}, 1); + $sth->execute($self->db_schema, $table, $column); + if ($sth->fetchrow_array) { + $extra_info{is_auto_increment} = 1; + } + + return \%extra_info; +} + =head1 SEE ALSO L, L, diff --git a/t/13db2_common.t b/t/13db2_common.t index e616f21..b52fa68 100644 --- a/t/13db2_common.t +++ b/t/13db2_common.t @@ -13,7 +13,6 @@ my $tester = dbixcsl_common_tests->new( user => $user, password => $password, db_schema => uc $user, - no_auto_increment => 1 ); if( !$dsn || !$user ) {