Changeset 30341 for gs2-extensions

Show
Ignore:
Timestamp:
03.12.2015 16:31:21 (4 years ago)
Author:
jmt12
Message:

Ability to notice delete entries in 70 hyphen format when retrieving keys - added for GDBMTXTGZ

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/tdb/trunk/perllib/DBDrivers/70HyphenFormat.pm

    r30332 r30341  
    172172    my $self = shift(@_); 
    173173    my $mode = shift(@_); 
    174     my $executable = shift(@_); 
     174    my $executable_and_default_args = shift(@_); 
    175175    my $infodb_file_path = shift(@_); 
     176    my ($executable, $default_args) = $executable_and_default_args =~ /^([a-z0-9]+)\s*(.*)$/; 
    176177    my $exe = &FileUtils::filenameConcatenate($self->{'executable_path'}, $executable . &util::get_os_exe()); 
    177178    if (!-e $exe) { 
    178     # See if it's on path 
     179    # Hope it's on path 
    179180    $exe = $executable . &util::get_os_exe(); 
    180     if (!-e $exe) { 
    181         print STDERR "Error: Unable to find " . $exe . "\n"; 
    182         return undef; 
    183     } 
    184181    } 
    185182    my $infodb_file_handle = undef; 
    186     my $cmd = '"' . $exe . '"'; 
     183    my $cmd = '"' . $exe . '" ' . $default_args; 
    187184    foreach my $open_arg (@_) { 
    188185    $cmd .= ' ' . $open_arg; 
     
    282279    else { 
    283280    while (defined ($infodb_line = <$infodb_file_handle>)) { 
    284         if ($infodb_line =~ /^\[([^\]]+)\][\r\n]*$/) { 
    285         $infodb_map->{$1} = 1; 
     281        if ($infodb_line =~ /^\[([^\]]+)\](-)?[\r\n]*$/) { 
     282        my $key = $1; 
     283        my $delete_flag = $2; 
     284        if (defined $delete_flag) { 
     285            delete $infodb_map->{$key} 
     286        } 
     287        else { 
     288            $infodb_map->{$key} = 1; 
     289        } 
    286290        } 
    287291    }