Ignore:
Timestamp:
2010-12-14T16:16:48+13:00 (13 years ago)
Author:
davidb
Message:

read_infodb_entry now returns a hashmap directly. Code updated to take advantage of this, and in places where the hashmap is not needed, the alternative read_infodb_rawentry is called.

File:
1 edited

Legend:

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

    r23448 r23485  
    214214    }
    215215}
     216
     217sub read_infodb_rawentry
     218{
     219  my $infodb_type = shift(@_);
     220  my $infodb_file_path = shift(@_);
     221  my $infodb_key = shift(@_);
     222
     223   
     224  # !! TEMPORARY: Slow and naive implementation that just reads the entire file and picks out the one value
     225  # !! This will soon be replaced with database-specific versions that will use dbget etc.
     226  my $infodb_map = {};
     227  &read_infodb_file($infodb_type, $infodb_file_path, $infodb_map);
     228 
     229  return $infodb_map->{$infodb_key};
     230}
     231
    216232
    217233sub read_infodb_entry
     
    248264 
    249265 
    250  
    251   # !! TEMPORARY: Slow and naive implementation that just reads the entire file and picks out the one value
    252   # !! This will soon be replaced with database-specific versions that will use dbget etc.
    253   my $infodb_map = {};
    254   &read_infodb_file($infodb_type, $infodb_file_path, $infodb_map);
    255  
    256   my $infodb_rec = &dbutil::convert_infodb_string_to_hash($infodb_map->{$infodb_key});
     266  # rawentry above is currently naive implementation
     267  my $raw_string = read_infodb_rawentry($infodb_type, $infodb_file_path, $infodb_key);
     268  my $infodb_rec = &dbutil::convert_infodb_string_to_hash($raw_string);
    257269 
    258270  return $infodb_rec;
Note: See TracChangeset for help on using the changeset viewer.