my ($self, $source, $to_insert) = @_;
my $ident = $source->from;
- my $bind_attributes;
- foreach my $column ($source->columns) {
-
- my $data_type = $source->column_info($column)->{data_type} || '';
- $bind_attributes->{$column} = $self->bind_attribute_by_data_type($data_type)
- if $data_type;
- }
-
+ my $bind_attributes = $self->source_bind_attributes($source);
+
$self->throw_exception(
"Couldn't insert ".join(', ',
map "$_ => $to_insert->{$_}", keys %$to_insert
#};
## Get the bind_attributes, if any exist
-
- my $bind_attributes;
- foreach my $column ($source->columns) {
-
- my $data_type = $source->column_info($column)->{data_type} || '';
- $bind_attributes->{$column} = $self->bind_attribute_by_data_type($data_type)
- if $data_type;
- }
-
+ my $bind_attributes = $self->source_bind_attributes($source);
+
## Bind the values and execute
-
$rv = eval {
my $placeholder_index = 1;
};
-#print STDERR Dumper($tuple_status);
-#print STDERR "RV: $rv\n";
-
if ($@ || !defined $rv) {
my $errors = '';
foreach my $tuple (@$tuple_status)
sub update {
my $self = shift @_;
my $source = shift @_;
-
- my $bind_attributes;
- foreach my $column ($source->columns) {
-
- my $data_type = $source->column_info($column)->{data_type} || '';
- $bind_attributes->{$column} = $self->bind_attribute_by_data_type($data_type)
- if $data_type;
- }
-
+ my $bind_attributes = $self->source_bind_attributes($source);
my $ident = $source->from;
+
return $self->_execute('update' => [], $ident, $bind_attributes, @_);
}
return $self->_execute(@args);
}
+sub source_bind_attributes {
+ my ($self, $source) = @_;
+
+ my $bind_attributes;
+ foreach my $column ($source->columns) {
+
+ my $data_type = $source->column_info($column)->{data_type} || '';
+ $bind_attributes->{$column} = $self->bind_attribute_by_data_type($data_type)
+ if $data_type;
+ }
+
+ return $bind_attributes;
+}
+
=head2 select
=over 4