Ignore:
Timestamp:
2018-11-05T19:24:47+13:00 (5 years ago)
Author:
ak19
Message:
  1. Caching the prepared SQL insert statements inside the gssql class rather than in the GS SQL Plugout. 2. docprint.pm provides an escape_textref function besides the existing escape_text function, to deal with large text (e.g. fulltxt). The old escape_text function has been rewritten to internally use the escape_textref function.
File:
1 edited

Legend:

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

    r32536 r32573  
    108108}
    109109
     110# pass by ref version: gets a ref to a string and returns ref to the modified string
     111# so use this for large strings (fulltext)
     112sub escape_textref {
     113    my ($textref) = @_;
     114    # special characters in the xml encoding
     115    $$textref =~ s/&&/& &/g;
     116    $$textref =~ s/&/&/g; # this has to be first...
     117    $$textref =~ s/</&lt;/g;
     118    $$textref =~ s/>/&gt;/g;
     119    $$textref =~ s/\"/&quot;/g;
     120
     121    return $textref;
     122}
     123
     124# pass by value - the behaviour of the escape_text method used so far is to pass copies of strings
    110125sub escape_text {
    111126    my ($text) = @_;
    112     # special characters in the xml encoding
    113     $text =~ s/&&/& &/g;
    114     $text =~ s/&/&amp;/g; # this has to be first...
    115     $text =~ s/</&lt;/g;
    116     $text =~ s/>/&gt;/g;
    117     $text =~ s/\"/&quot;/g;
    118 
    119     return $text;
     127    my $textref = &escape_textref(\$text);
     128    return $$textref;
    120129}
    121130
Note: See TracChangeset for help on using the changeset viewer.