Skip to content

Commit

Permalink
auto_increment のカラムに値が指定されて insert された場合は fetch_last_id しない
Browse files Browse the repository at this point in the history
  • Loading branch information
fujiwara committed Jul 3, 2009
1 parent 43ecb1e commit 1e3e296
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Data/Model/Driver.pm
Expand Up @@ -58,7 +58,9 @@ sub _set_auto_increment {
for my $column (@keys) {
if (exists $schema->column_options($column)->{auto_increment} &&
$schema->column_options($column)->{auto_increment}) {
$columns->{$column} = $code->();
$columns->{$column}
= defined $columns->{$column} ? $columns->{$column}
: $code->();
$count++;
}
}
Expand Down
7 changes: 7 additions & 0 deletions t/020_mock/dbi-pg-binary.t
@@ -0,0 +1,7 @@
use t::Utils::Pg;
use t::Utils config => +{
type => 'Binary',
driver => 'DBI',
dsn => 'dbi:Pg:dbname=test',
};
run;

0 comments on commit 1e3e296

Please sign in to comment.