Ignore:
Timestamp:
2010-07-22T18:55:18+12:00 (14 years ago)
Author:
ak19
Message:
  1. Dr Bainbridge fixed the database perl modules to all have the method read_info_keys (which reads the keys from the database into a map), so that dbutil.pm can have the same as a generic method. 2. buildConfigxml.pm only writes out the defaultIndex if it is set (to prevent an Uninitialised Variable warning message from Perl).
Location:
main/trunk/greenstone2/perllib/dbutil
Files:
3 edited

Legend:

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

    r22076 r22485  
    114114}
    115115
     116
     117sub read_infodb_keys
     118{
     119  my $infodb_file_path = shift(@_);
     120  my $infodb_map = shift(@_);
     121
     122  my $cmd = "gzip --decompress \"$infodb_file_path\"";
     123
     124  open (PIPEIN, "$cmd |")
     125  || die "Error: Couldn't open pipe from gzip: $!\n  $cmd\n";
     126
     127  my $infodb_line = "";
     128  my $infodb_key = "";
     129  while (defined ($infodb_line = <PIPEIN>))
     130  {
     131    if ($infodb_line =~ /^\[([^\]]+)\]$/)
     132    {
     133      $infodb_key = $1;
     134    }
     135    elsif ($infodb_line =~ /^-{70}$/)
     136    {
     137      $infodb_map->{$infodb_key} = 1;
     138      $infodb_key = "";
     139    }
     140  }
     141
     142  close (PIPEIN);
     143}
     144
    116145   
    117146sub write_infodb_entry
  • main/trunk/greenstone2/perllib/dbutil/mssql.pm

    r21856 r22485  
    141141
    142142  print STDERR "******* mssql::read_infodb_file() TO BE IMPLEMENTED!\n";
     143  print STDERR "******* See sqlite.pm for comparable implementation that has been coded up!\n";
     144}
     145
     146sub read_infodb_keys
     147{
     148  my $infodb_file_path = shift(@_);
     149  my $infodb_map = shift(@_);
     150
     151  print STDERR "******* mssql::read_infodb_keys() TO BE IMPLEMENTED!\n";
    143152  print STDERR "******* See sqlite.pm for comparable implementation that has been coded up!\n";
    144153}
  • main/trunk/greenstone2/perllib/dbutil/sqlite.pm

    r22076 r22485  
    141141  }
    142142
     143}
     144
     145
     146sub read_infodb_keys
     147{
     148  my $infodb_file_path = shift(@_);
     149  my $infodb_map = shift(@_);
     150
     151
     152  my $keys_str = read_infodb_cmd($infodb_file_path,"SELECT key FROM data;");
     153
     154  my @keys = split(/\n/,$keys_str);
     155
     156  foreach my $key (@keys)
     157  {
     158      $infodb_map->{$key} = 1;
     159  }
    143160}
    144161
Note: See TracChangeset for help on using the changeset viewer.