Ignore:
Timestamp:
2008-05-26T14:00:14+12:00 (16 years ago)
Author:
mdewsnip
Message:

(Adding new DB support) Fixed previous change to work with multiple values assigned to one element.

File:
1 edited

Legend:

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

    r15696 r15697  
    394394    my $dtype = $doc_obj->get_metadata_element ($section, "doctype");
    395395    if (!defined $dtype || $dtype !~ /\w/) {
    396         $section_infodb{"doctype"} = "doc";
     396        $section_infodb{"doctype"} = [ "doc" ];
    397397    }
    398398
     
    406406        # doc_obj derived directly from file
    407407        if ($doc_obj->get_text_length($section) > 0) {
    408         $section_infodb{"hastxt"} = "1";
     408        $section_infodb{"hastxt"} = [ "1" ];
    409409        } else {
    410         $section_infodb{"hastxt"} = "0";
     410        $section_infodb{"hastxt"} = [ "0" ];
    411411        }
    412412    }
     
    433433        # special case for URL metadata
    434434        if ($field =~ /^URL$/i) {
    435             $self->write_infodb_entry($value, { 'section'  => $section_OID });
     435            $self->write_infodb_entry($value, { 'section' => [ $section_OID ] });
    436436        }
    437437
    438438        if (!defined $self->{'dontdb'}->{$field}) {
    439             $section_infodb{$field} = $value;
     439            push(@{$section_infodb{$field}}, $value);
    440440
    441441            if ($section eq "")
     
    453453        foreach my $prefix (keys %$doc_mdprefix_fields)
    454454        {
    455         $section_infodb{"metadataset"} = $prefix;
     455        push(@{$section_infodb{"metadataset"}}, $prefix);
    456456
    457457        foreach my $field (keys %{$doc_mdprefix_fields->{$prefix}})
     
    459459            my $val = $doc_mdprefix_fields->{$prefix}->{$field};
    460460
    461             $section_infodb{"metadatalist-$prefix"} = $field;
    462             $section_infodb{"metadatafreq-$prefix-$field"} = $val;
     461            push(@{$section_infodb{"metadatalist-$prefix"}}, $field);
     462            push(@{$section_infodb{"metadatafreq-$prefix-$field"}}, $val);
    463463        }
    464464        }
     
    472472        # output archivedir if at top level
    473473        if ($section eq $doc_obj->get_top_section()) {
    474         $section_infodb{"archivedir"} = $archivedir;
     474        $section_infodb{"archivedir"} = [ $archivedir ];
    475475        }
    476476    }
     
    478478    # output document display type
    479479    if ($first) {
    480         $section_infodb{"thistype"} = $thistype;
     480        $section_infodb{"thistype"} = [ $thistype ];
    481481    }
    482482
     
    484484        # doc num is num_docs not num_sections
    485485        # output the matching document number
    486         $section_infodb{"docnum"} = $self->{'num_docs'};
     486        $section_infodb{"docnum"} = [ $self->{'num_docs'} ];
    487487    }
    488488    else {
     
    490490        my $children = $doc_obj->get_children ($section);
    491491        if (scalar(@$children) > 0) {
    492         $section_infodb{"childtype"} = $childtype;
     492        $section_infodb{"childtype"} = [ $childtype ];
    493493        my $contains = "";
    494494        foreach my $child (@$children)
     
    503503            }
    504504        }
    505         $section_infodb{"contains"} = $contains;
     505        $section_infodb{"contains"} = [ $contains ];
    506506        }
    507507        # output the matching doc number
    508         $section_infodb{"docnum"} = $self->{'num_sections'};
     508        $section_infodb{"docnum"} = [ $self->{'num_sections'} ];
    509509    }
    510510   
     
    513513    # output a database entry for the document number
    514514    if ($self->{'db_level'} eq "document") {
    515         $self->write_infodb_entry($self->{'num_docs'}, { 'section'  => $doc_OID });
     515        $self->write_infodb_entry($self->{'num_docs'}, { 'section' => [ $doc_OID ] });
    516516    }
    517517    else {
    518         $self->write_infodb_entry($self->{'num_sections'}, { 'section'  => $section_OID });
     518        $self->write_infodb_entry($self->{'num_sections'}, { 'section' => [ $section_OID ] });
    519519    }
    520520
     
    545545    foreach my $infodb_value_key (keys(%$infodb_map))
    546546    {
    547     print $handle "<$infodb_value_key>" . $infodb_map->{$infodb_value_key} . "\n";
     547    foreach my $infodb_value (@{$infodb_map->{$infodb_value_key}})
     548    {
     549        print $handle "<$infodb_value_key>" . $infodb_value . "\n";
     550    }
    548551    }
    549552    print $handle '-' x 70, "\n";
Note: See TracChangeset for help on using the changeset viewer.