Ignore:
Timestamp:
2010-01-21T15:22:28+13:00 (14 years ago)
Author:
mdewsnip
Message:

Changed calls to GDBMUtils::gdbmCachedCollectionSet() to dbutil::write_infodb_entry(). Part of removing GDBMUtils.pm and making the code less GDBM-specific.

File:
1 edited

Legend:

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

    r21561 r21562  
    3737    if($text !~ /\w+/ && $force_new)
    3838      {
    39         &GDBMUtils::gdbmCachedCollectionSet($collection, $clid,
    40                             "<doctype>classify\n<hastxt>0\n<childtype>VList\n<Title>\n<numleafdocs>0\n<contains>\n");
     39    my $infodb_file_handle = &dbutil::open_infodb_write_handle("gdbm", $self->{'infodb_file_path'}, "append");
     40    &dbutil::write_infodb_entry("gdbm", $infodb_file_handle, $clid, &dbutil::convert_infodb_string_to_hash("<doctype>classify\n<hastxt>0\n<childtype>VList\n<Title>\n<numleafdocs>0\n<contains>\n"));
     41    &dbutil::close_infodb_write_handle("gdbm", $infodb_file_handle);
    4142      }
    4243    # Bless me father for I have sinned
     
    121122
    122123    # Create a new document with the correct CLID
    123     &GDBMUtils::gdbmCachedCollectionSet($collection, $new_clid, $text);
    124 
     124    my $infodb_file_handle = &dbutil::open_infodb_write_handle("gdbm", $self->{'infodb_file_path'}, "append");
     125    &dbutil::write_infodb_entry("gdbm", $infodb_file_handle, $new_clid, &dbutil::convert_infodb_string_to_hash($text));
    125126    # Remove the old document
    126     &GDBMUtils::gdbmCachedCollectionSet($collection, $self->{'clid'});
     127    &dbutil::delete_infodb_entry("gdbm", $infodb_file_handle, $self->{'clid'});
     128    &dbutil::close_infodb_write_handle("gdbm", $infodb_file_handle);
    127129
    128130    # Finally, change the clid stored in this document
     
    488490        $num_leaf_docs += $1;
    489491      }
    490     # Now remove the node from the database. We do this calling set gdbm with
    491     # no value argument.
    492     my $collection = $self->{'model'}->getCollection();
    493     &GDBMUtils::gdbmCachedCollectionSet($collection, $self->{'clid'});
     492    # Now remove the node from the database
     493    my $infodb_file_handle = &dbutil::open_infodb_write_handle("gdbm", $self->{'infodb_file_path'}, "append");
     494    &dbutil::delete_infodb_entry("gdbm", $infodb_file_handle, $self->{'clid'});
     495    &dbutil::close_infodb_write_handle("gdbm", $infodb_file_handle);
    494496
    495497    # Return the leaf count (so we can adjust the numleafdocs at the root node
     
    635637    #rint STDERR "After:  $text\n";
    636638    # Store the changed text
    637     &GDBMUtils::gdbmCachedCollectionSet($collection, $clid, $text);
     639    my $infodb_file_handle = &dbutil::open_infodb_write_handle("gdbm", $self->{'infodb_file_path'}, "append");
     640    &dbutil::write_infodb_entry("gdbm", $infodb_file_handle, $clid, &dbutil::convert_infodb_string_to_hash($text));
     641    &dbutil::close_infodb_write_handle("gdbm", $infodb_file_handle);
    638642  }
    639643# /** setContains() **/
     
    658662    $text =~ s/<numleafdocs>\d*?\n+/<numleafdocs>$numleafdocs\n/;
    659663    # Store the changed text
    660     &GDBMUtils::gdbmCachedCollectionSet($collection, $clid, $text);
     664    my $infodb_file_handle = &dbutil::open_infodb_write_handle("gdbm", $self->{'infodb_file_path'}, "append");
     665    &dbutil::write_infodb_entry("gdbm", $infodb_file_handle, $clid, &dbutil::convert_infodb_string_to_hash($text));
     666    &dbutil::close_infodb_write_handle("gdbm", $infodb_file_handle);
    661667  }
    662668# /** setNumLeafDocs() **/
     
    683689    $text =~ s/<Title>.*?\n+/<Title>$title\n/;
    684690    # Store the changed text
    685     &GDBMUtils::gdbmCachedCollectionSet($collection, $clid, $text);
     691    my $infodb_file_handle = &dbutil::open_infodb_write_handle("gdbm", $self->{'infodb_file_path'}, "append");
     692    &dbutil::write_infodb_entry("gdbm", $infodb_file_handle, $clid, &dbutil::convert_infodb_string_to_hash($text));
     693    &dbutil::close_infodb_write_handle("gdbm", $infodb_file_handle);
    686694  }
    687695# /** setValue() **/
Note: See TracChangeset for help on using the changeset viewer.