Changeset 15704


Ignore:
Timestamp:
2008-05-26T16:36:04+12:00 (16 years ago)
Author:
mdewsnip
Message:

(Adding new DB support) Changed a whole lot of "gdbm"s to "database"s or "infodb"s.

File:
1 edited

Legend:

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

    r15703 r15704  
    153153
    154154
    155 # takes a hashref containing the metadata for a gdbmfile entry, and extracts
     155# takes a hashref containing the metadata for an infodb entry, and extracts
    156156# the childrens numbers (from the 'contains' entry).   
    157157# assumes format is ".1;".2;".3
     
    173173   
    174174sub recurse_sections {
    175     my ($doc_obj, $children, $parentoid, $parentsection, $gdbm_recs) = @_;
     175    my ($doc_obj, $children, $parentoid, $parentsection, $database_recs) = @_;
    176176
    177177    return if (!defined $children);
     
    179179    foreach my $child (sort { $a <=> $b} @$children) {
    180180    $doc_obj->create_named_section("$parentsection.$child");
    181     my $doc_db_rec = $gdbm_recs->{"$parentoid.$child"};
     181    my $doc_db_rec = $database_recs->{"$parentoid.$child"};
    182182    my $doc_db_hash = db_rec_to_hash($doc_db_rec);
    183183
     
    192192    {
    193193        recurse_sections($doc_obj, $newchildren, "$parentoid.$child",
    194                  "$parentsection.$child", $gdbm_recs);
     194                 "$parentsection.$child", $database_recs);
    195195    }
    196196    }
     
    212212
    213213
    214 # gets all the metadata from a gdbm file entry, and puts it into a hashref
     214# gets all the metadata from an infodb entry, and puts it into a hashref
    215215sub db_rec_to_hash {
    216216   
     
    235235    my ($fulldbname) = @_;
    236236
    237 #   tie %gdbm_recs, 'GDBM_File', $fulldbname, &GDBM_WRCREAT, 0640;
    238 
    239     my %gdbm_recs;
    240     &unbuildutil::read_gdbm($fulldbname,\%gdbm_recs);
     237    my %database_recs;
     238    &unbuildutil::read_gdbm($fulldbname, \%database_recs);
    241239
    242240
     
    244242    my %top_sections = ();
    245243    my %top_docnums = ();
    246     foreach my $key ( keys %gdbm_recs )
     244    foreach my $key ( keys %database_recs )
    247245    {
    248     my $md_rec = $gdbm_recs{$key};
     246    my $md_rec = $database_recs{$key};
    249247    my $md_hash = db_rec_to_hash($md_rec);
    250248
     
    256254    }
    257255
    258     # for greenstone document objects based on metadata in gdbm file
     256    # for greenstone document objects based on metadata in database file
    259257    my @all_docs = ();
    260258    # we need to make sure the documents were processed in the same order as
     
    269267        add_section_content ($doc_obj, $top, $doc_db_hash);
    270268        my $children = &get_children($doc_db_hash);
    271         recurse_sections($doc_obj, $children, $oid, $top, \%gdbm_recs);
     269        recurse_sections($doc_obj, $children, $oid, $top, \%database_recs);
    272270
    273271    push(@all_docs,$doc_obj);
    274272    }   
    275 
    276 #    untie %gdbm_recs;
    277273
    278274    return \@all_docs;   
Note: See TracChangeset for help on using the changeset viewer.