Changeset 22010


Ignore:
Timestamp:
2010-05-03T12:06:46+12:00 (11 years ago)
Author:
davidb
Message:

GDBM reader/writer conflict resulted from swithcing from the (now deleted) GDBMUtils.pm to the more generic dbutil.pm class. Not able to keep write filehandle open through 'for-each' statement whilst (inside this loop) also reading entries from the same database. Solution for now has been to more tightly wrap the open and close write-handles around the pionts where they are needed. In GDBMUtil the write operation was done by calling the command-line utility 'gdbmset', hence no write file-handle had to be left open. Something to consider for later is whether or not the dbmutil.pm API should be extended to support this form of setting (or deleting, or editing).

File:
1 edited

Legend:

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

    r21620 r22010  
    295295    my $arcinfo_doc_filename = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-doc", $archivedir);
    296296    my $arcinfo_src_filename = &dbutil::get_infodb_file_path($infodbtype, "archiveinf-src", $archivedir);
    297     my $doc_infodb_file_handle = &dbutil::open_infodb_write_handle($infodbtype, $arcinfo_doc_filename, "append");
    298     my $src_infodb_file_handle = &dbutil::open_infodb_write_handle($infodbtype, $arcinfo_src_filename, "append");
     297
    299298
    300299    # record files marked for deletion in arcinfo
     
    309308
    310309    # delete the src record
     310    my $src_infodb_file_handle = &dbutil::open_infodb_write_handle($infodbtype, $arcinfo_src_filename, "append");
    311311    &dbutil::delete_infodb_entry($infodbtype, $src_infodb_file_handle, $file);
    312    
     312    &dbutil::close_infodb_write_handle($infodbtype, $src_infodb_file_handle);
     313
     314
    313315    foreach my $oid (@$oids) {
    314316
     
    339341
    340342        my $val_rec = &dbutil::convert_infodb_string_to_hash($val);
     343        my $doc_infodb_file_handle = &dbutil::open_infodb_write_handle($infodbtype, $arcinfo_doc_filename, "append");
     344
    341345        &dbutil::write_infodb_entry($infodbtype, $doc_infodb_file_handle, $oid, $val_rec);
    342         }
    343     }
    344     }
    345 
    346     &dbutil::close_infodb_write_handle($infodbtype, $doc_infodb_file_handle);
    347     &dbutil::close_infodb_write_handle($infodbtype, $src_infodb_file_handle);
     346        &dbutil::close_infodb_write_handle($infodbtype, $doc_infodb_file_handle);
     347        }
     348    }
     349    }
     350
     351
    348352}
    349353
Note: See TracChangeset for help on using the changeset viewer.