Changeset 21561


Ignore:
Timestamp:
01/21/10 15:03:35 (11 years ago)
Author:
mdewsnip
Message:

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

Location:
main/trunk/greenstone2/perllib
Files:
3 edited

Legend:

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

    r17087 r21561  
    120120    # Unfortunately I have to check that there is text to retrieve before I
    121121    # create a new node.
    122     if(&GDBMUtils::gdbmCachedCollectionGet($self->getCollection(), $clid) =~ /\w+/)
     122
     123    my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $self->getCollection(), "index", "text");
     124    my $infodb_file_path = &dbutil::get_infodb_file_path("gdbm", $self->getCollection(), $index_text_directory_path);
     125    if (&dbutil::read_infodb_entry("gdbm", $infodb_file_path, $clid) =~ /\w+/)
    123126      {
    124127        # Since the CLID can directly reference the correct entry in the GDBM we
  • main/trunk/greenstone2/perllib/ClassifyTreeNode.pm

    r17087 r21561  
    2929    my $collection = $model->getCollection();
    3030
     31    my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "index", "text");
     32    $self->{'infodb_file_path'} = &dbutil::get_infodb_file_path("gdbm", $collection, $index_text_directory_path);
     33
    3134    # Check if this node already exists in the database, and if not insert it
    3235    # now
    33     my $text = &GDBMUtils::gdbmCachedCollectionGet($collection, $clid);
     36    my $text = &dbutil::read_infodb_entry("gdbm", $self->{'infodb_file_path'}, $clid);
    3437    if($text !~ /\w+/ && $force_new)
    3538      {
     
    235238
    236239    # Now determine if this node exists.
    237     if(&GDBMUtils::gdbmCachedCollectionGet($collection, $next_clid) =~ /\w+/)
     240    if (&dbutil::read_infodb_entry("gdbm", $self->{'infodb_file_path'}, $next_clid) =~ /\w+/)
    238241      {
    239242        # And if so, create it.
     
    625628
    626629    # Load the text of this node
    627     my $text = &GDBMUtils::gdbmCachedCollectionGet($collection, $clid);
     630    my $text = &dbutil::read_infodb_entry("gdbm", $self->{'infodb_file_path'}, $clid);
    628631
    629632    # Replace the contains
     
    651654
    652655    # Load the text of this node
    653     my $text = &GDBMUtils::gdbmCachedCollectionGet($collection, $clid);
     656    my $text = &dbutil::read_infodb_entry("gdbm", $self->{'infodb_file_path'}, $clid);
    654657    # Replace the numleafdocs
    655658    $text =~ s/<numleafdocs>\d*?\n+/<numleafdocs>$numleafdocs\n/;
     
    676679
    677680    # Load the text of this node
    678     my $text = &GDBMUtils::gdbmCachedCollectionGet($collection, $clid);
     681    my $text = &dbutil::read_infodb_entry("gdbm", $self->{'infodb_file_path'}, $clid);
    679682    # Replace the title
    680683    $text =~ s/<Title>.*?\n+/<Title>$title\n/;
     
    697700    my $clid = $self->{'clid'};
    698701
    699     my $text = &GDBMUtils::gdbmCachedCollectionGet($collection, $clid);
     702    my $text = &dbutil::read_infodb_entry("gdbm", $self->{'infodb_file_path'}, $clid);
    700703    return $text;
    701704  }
  • main/trunk/greenstone2/perllib/IncrementalDocument.pm

    r17087 r21561  
    149149    # Load the raw text for the document object from GDBM
    150150    my $collection = $self->{'collection'};
    151     my $text = &GDBMUtils::gdbmCachedCollectionGet($collection, $self->{'oid'});
     151    my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "index", "text");
     152    my $infodb_file_path = &dbutil::get_infodb_file_path("gdbm", $collection, $index_text_directory_path);
     153    my $text = &dbutil::read_infodb_entry("gdbm", $infodb_file_path, $self->{'oid'});
    152154    # For each line in the raw text, extract the key (enclosed in angle
    153155    # brackets) and the value
     
    193195    if($doc_num >= 0)
    194196      {
    195         my $text = &GDBMUtils::gdbmCachedCollectionGet($collection, $doc_num);
     197    my $index_text_directory_path = &util::filename_cat($ENV{'GSDLHOME'}, "collect", $collection, "index", "text");
     198    my $infodb_file_path = &dbutil::get_infodb_file_path("gdbm", $collection, $index_text_directory_path);
     199    my $text = &dbutil::read_infodb_entry("gdbm", $infodb_file_path, $doc_num);
     200
    196201        # If there is no reverse lookup, then add one now
    197202        if($text !~ /<section>/)
Note: See TracChangeset for help on using the changeset viewer.