Changeset 21857

Show
Ignore:
Timestamp:
31.03.2010 23:10:19 (10 years ago)
Author:
davidb
Message:

Removal of GDBM specific code in favour of write_infodb_rawentry() which is database backend agnostic

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/arcinfo.pm

    r21585 r21857  
    205205    my ($filename) = @_; 
    206206 
     207    my $infodbtype = $self->{'infodbtype'}; 
     208 
    207209    # Not the most efficient operation, but will do for now 
    208210 
    209211    # read it in 
    210212    my $infodb_map = {}; 
    211     &dbutil::read_infodb_file($self->{'infodbtype'}, $filename, $infodb_map); 
     213    &dbutil::read_infodb_file($infodbtype, $filename, $infodb_map); 
    212214 
    213215    # change index-status values 
     
    227229 
    228230    # write out again 
    229     my $infodb_handle = &dbutil::open_infodb_write_handle($self->{'infodbtype'}, $filename); 
     231    my $infodb_handle = &dbutil::open_infodb_write_handle($infodbtype, $filename); 
    230232    foreach my $oid ( keys %$infodb_map ) { 
    231     # consider making the following a method in dbutil 
    232     # e.g. write_infodb_rawentry($infodb_handle,$oid,$vals); 
    233  
    234     # no need to escape, as $infodb_map->{$oid} hasn't been unescaped 
    235         # GDBM SPECIFIC! 
    236     print $infodb_handle "[$oid]\n"; 
    237     print $infodb_handle $infodb_map->{$oid}; 
    238     print $infodb_handle '-' x 70, "\n"; 
    239     } 
    240     &dbutil::close_infodb_write_handle($self->{'infodbtype'}, $infodb_handle); 
     233    my $vals = $infodb_map->{$oid}; 
     234    &dbutil::write_infodb_rawentry($infodbtype,$infodb_handle,$oid,$vals); 
     235    } 
     236    &dbutil::close_infodb_write_handle($infodbtype, $infodb_handle); 
    241237 
    242238}