SPOPS/Import/DBI/Update.pm

filter: Statementstmt 100% 6 / 6 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 8 / 8 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« SPOPS/Import/DBI/GenericOperation.pm ↑ Summary SPOPS/Import/Object.pm »
1 package SPOPS::Import::DBI::Update;
2  
3 # $Id: Update.pm,v 1.1 2004/06/01 14:46:09 lachoy Exp $
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use base qw( SPOPS::Import::DBI::GenericOperation );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 use SPOPS::SQLInterface;
8  
9 $SPOPS::Import::DBI::Update::VERSION = sprintf("%d.%02d", q$Revision: 1.1 $ =~ /(\d+)\.(\d+)/);
10  
11 my @FIELDS = qw( field field_value );
12 SPOPS::Import::DBI::Update->mk_accessors( @FIELDS );
13  
14 sub data { return [] }
15  
16 sub _run_operation {
17 my ( $self, $update_args ) = @_;
18 $update_args->{field} = $self->field;
19 $update_args->{value} ||= [];
20 my $field_values = $self->field_value || [];
21 $update_args->{value} = [ @{ $field_values },
22 @{ $update_args->{value} } ];
23 my $rv = SPOPS::SQLInterface->db_update( $update_args );
24 return ( $rv eq '0E0' ) ? 0 : $rv;
25 }
26  
27 sub set_update_data {
28 my ( $self, $update_info ) = @_;
29 my @fields = ();
30 my @values = ();
31 while ( my ( $field, $value ) = each %{ $update_info } ) {
32 push @fields, $field;
33 push @values, $value;
34 }
35 $self->field( \@fields );
36 $self->field_value( \@values );
37 }
38  
39 1;
40  
41 __END__
« SPOPS/Import/DBI/GenericOperation.pm ↑ Summary SPOPS/Import/Object.pm »