Ignore:
Timestamp:
2013-04-15T18:49:36+12:00 (11 years ago)
Author:
ak19
Message:

A couple of the index_meta functions used gdbm methods instead of calling the more generic db operations via dbutil. Fixed to go through dbutil instead and tested.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/metadataaction.pm

    r27176 r27180  
    167167    my $gsdlhome  = $self->{'gsdlhome'};
    168168    my $infodbtype = $self->{'infodbtype'};
    169    
     169   
    170170    # live metadata gets/saves value scoped (prefixed) by the current usename
    171171    # so (for now) let's not bother to enforce authentication
     
    28172817    $doc_rec->{$metaname} = $filtered_metadata;
    28182818
     2819    ## The following code assumes gdbm
    28192820    # Turn the record back to string
    2820     my $serialized_doc_rec = &dbutil::convert_infodb_hash_to_string($doc_rec);
    2821 
     2821    #my $serialized_doc_rec = &dbutil::convert_infodb_hash_to_string($doc_rec);
    28222822    # Store it back to the database
    2823     my $cmd = "gdbmset \"$infodb_file_path\" \"$docid\" \"$serialized_doc_rec\"";
    2824     my $status = system($cmd);
     2823    #my $cmd = "gdbmset \"$infodb_file_path\" \"$docid\" \"$serialized_doc_rec\"";
     2824    #my $status = system($cmd);
     2825
     2826    ## Use the dbutil set_entry method instead of assuming the database is gdbm
     2827    my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path, $docid, $doc_rec);
     2828
    28252829    if ($status != 0) {
    28262830    my $mess = "Failed to set metadata key: $docid\n";
    28272831   
    28282832    $mess .= "PATH: $ENV{'PATH'}\n";
    2829     $mess .= "cmd = $cmd\n";
     2833    #$mess .= "cmd = $cmd\n";
    28302834    $mess .= "Exit status: $status\n";
    28312835    $mess .= "System Error Message: $!\n";
     
    30193023    }
    30203024
     3025    ## The following code assumes gdbm
    30213026    # Generate the record string
    3022     my $serialized_doc_rec = &dbutil::convert_infodb_hash_to_string($doc_rec);
    3023 
     3027    #my $serialized_doc_rec = &dbutil::convert_infodb_hash_to_string($doc_rec);
    30243028    # Store it into GDBM
    3025     my $cmd = "gdbmset \"$infodb_file_path\" \"$docid\" \"$serialized_doc_rec\"";
    3026     my $status = system($cmd);
     3029    #my $cmd = "gdbmset \"$infodb_file_path\" \"$docid\" \"$serialized_doc_rec\"";
     3030    #my $status = system($cmd);
     3031
     3032    ## Use the dbutil set_entry method instead of assuming the database is gdbm
     3033    my $status = &dbutil::set_infodb_entry($infodbtype, $infodb_file_path, $docid, $doc_rec);
     3034
    30273035    if ($status != 0) {
    30283036        # Catch error if gdbmget failed
     
    30303038   
    30313039    $mess .= "PATH: $ENV{'PATH'}\n";
    3032     $mess .= "cmd = $cmd\n";
     3040    #$mess .= "cmd = $cmd\n";
    30333041    $mess .= "Exit status: $status\n";
    30343042    $mess .= "System Error Message: $!\n";
Note: See TracChangeset for help on using the changeset viewer.