Changeset 23399 for main/trunk/greenstone2/perllib/dbutil/gdbm.pm
- Timestamp:
- 2010-12-07T16:55:10+13:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/dbutil/gdbm.pm
r23102 r23399 158 158 159 159 160 sub set_infodb_entry 161 { 162 my $infodb_file_path = shift(@_); 163 my $infodb_key = shift(@_); 164 my $infodb_map = shift(@_); 165 166 # Protect metadtaa values that go inside quotes for gdbmset 167 foreach my $k (keys %$infodb_map) { 168 my @escaped_v = (); 169 foreach my $v (@{$infodb_map->{$k}}) { 170 if ($k eq "contains") { 171 # protect quotes in ".2;".3 etc 172 $v =~ s/\"/\\\"/g; 173 push(@escaped_v, $v); 174 } 175 else { 176 my $ev = &ghtml::unescape_html($v); 177 $ev =~ s/\"/\\\"/g; 178 push(@escaped_v, $ev); 179 } 180 } 181 $infodb_map->{$k} = \@escaped_v; 182 } 183 184 # Generate the record string 185 my $serialized_infodb_map = &dbutil::convert_infodb_hash_to_string($infodb_map); 186 ## print STDERR "**** ser dr\n$serialized_infodb_map\n\n\n"; 187 188 # Store it into GDBM 189 my $cmd = "gdbmset \"$infodb_file_path\" \"$infodb_key\" \"$serialized_infodb_map\""; 190 my $status = system($cmd); 191 192 return $status; 193 194 } 195 196 160 197 sub delete_infodb_entry 161 198 {
Note:
See TracChangeset
for help on using the changeset viewer.