From: Matt S Trout Date: Wed, 26 Sep 2007 02:45:35 +0000 (+0000) Subject: couple tweaks towards result_source usage in Handle.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e25075d2f6462df2f8295680cc1510b03d4eb31f;p=dbsrgits%2FDBIx-Class-Historic.git couple tweaks towards result_source usage in Handle.pm --- diff --git a/lib/DBIx/Class/JDBICompat/Record.pm b/lib/DBIx/Class/JDBICompat/Record.pm index ed8a2c4..364af49 100755 --- a/lib/DBIx/Class/JDBICompat/Record.pm +++ b/lib/DBIx/Class/JDBICompat/Record.pm @@ -125,7 +125,7 @@ Returns this row's primary key. =cut sub id { - my $pkey = $_[0]->_primary_key(); + my $pkey = ($_[0]->RESULT_SOURCE->primary_columns)[0]; my $ret = $_[0]->{'values'}->{$pkey}; return $ret; } @@ -203,7 +203,13 @@ sub _init_columns { my @pri = @{$self->_primary_keys}; - $source->add_columns(@pri); + $source->add_columns(map { + ($_ => { + data_type => 'integer', + is_nullable => 0, + is_auto_increment => 1 + }) + } @pri); $source->set_primary_key(@pri); foreach my $column_name ( @pri ) {