Changeset 19773


Ignore:
Timestamp:
2009-06-09T14:33:22+12:00 (15 years ago)
Author:
davidb
Message:

optional parameter to open GDBM database that allows for records to be appended

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/dbutil.pm

    r18658 r19773  
    323323{
    324324  my $infodb_file_path = shift(@_);
     325  my $opt_append = shift(@_);
    325326
    326327  my $txt2db_exe = &util::filename_cat($ENV{'GSDLHOME'},"bin",$ENV{'GSDLOS'}, "txt2db" . &util::get_os_exe());
    327328  my $infodb_file_handle = undef;
    328   if (!-e "$txt2db_exe" || !open($infodb_file_handle, "| \"$txt2db_exe\" \"$infodb_file_path\""))
     329  my $cmd = "\"$txt2db_exe\"";
     330  if ((defined $opt_append) && ($opt_append eq "append")) {
     331      $cmd .= " -append";
     332  }
     333  $cmd .= " \"$infodb_file_path\"";
     334
     335  if (!-e "$txt2db_exe" || !open($infodb_file_handle, "| $cmd"))
    329336  {
    330337    return undef;
     
    333340  return $infodb_file_handle;
    334341}
     342
    335343
    336344
Note: See TracChangeset for help on using the changeset viewer.