Created
March 10, 2011 07:33
-
-
Save rbo/863707 to your computer and use it in GitHub Desktop.
Part of DBIx::Class::Storage::DBI->insert()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list of primary keys we try to fetch from the database | |
# both not-exsists and scalarrefs are considered | |
my %fetch_pks; | |
for ($source->primary_columns) { | |
$fetch_pks{$_} = scalar keys %fetch_pks # so we can preserve order for prettyness | |
if ! exists $to_insert->{$_} or ref $to_insert->{$_} eq 'SCALAR'; | |
} | |
my ($sqla_opts, @ir_container); | |
if ($self->_use_insert_returning) { | |
# retain order as declared in the resultsource | |
for (sort { $fetch_pks{$a} <=> $fetch_pks{$b} } keys %fetch_pks ) { | |
push @{$sqla_opts->{returning}}, $_; | |
$sqla_opts->{returning_container} = \@ir_container | |
if $self->_use_insert_returning_bound; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment