Changeset 21562 for main/trunk/greenstone2/perllib/ClassifyTreeNode.pm
- Timestamp:
- 2010-01-21T15:22:28+13:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/ClassifyTreeNode.pm
r21561 r21562 37 37 if($text !~ /\w+/ && $force_new) 38 38 { 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); 41 42 } 42 43 # Bless me father for I have sinned … … 121 122 122 123 # 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)); 125 126 # 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); 127 129 128 130 # Finally, change the clid stored in this document … … 488 490 $num_leaf_docs += $1; 489 491 } 490 # Now remove the node from the database . We do this calling set gdbm with491 # 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); 494 496 495 497 # Return the leaf count (so we can adjust the numleafdocs at the root node … … 635 637 #rint STDERR "After: $text\n"; 636 638 # 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); 638 642 } 639 643 # /** setContains() **/ … … 658 662 $text =~ s/<numleafdocs>\d*?\n+/<numleafdocs>$numleafdocs\n/; 659 663 # 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); 661 667 } 662 668 # /** setNumLeafDocs() **/ … … 683 689 $text =~ s/<Title>.*?\n+/<Title>$title\n/; 684 690 # 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); 686 694 } 687 695 # /** setValue() **/
Note:
See TracChangeset
for help on using the changeset viewer.