| 245 | | print $infodb_handle "DELETE FROM data WHERE key='" . &sqlite_safe($infodb_key) . "';\n"; |
|---|
| 246 | | print $infodb_handle "INSERT INTO data (key, value) VALUES ('" . &sqlite_safe($infodb_key) . "', '" . &sqlite_safe($infodb_entry_value) . "');\n"; |
|---|
| | 246 | my $safe_infodb_key = &sqlite_safe($infodb_key); |
|---|
| | 247 | print $infodb_handle "DELETE FROM data WHERE key='" . $safe_infodb_key . "';\n"; |
|---|
| | 248 | print $infodb_handle "INSERT INTO data (key, value) VALUES ('" . $safe_infodb_key . "', '" . &sqlite_safe($infodb_entry_value) . "');\n"; |
|---|
| | 249 | |
|---|
| | 250 | # If this infodb entry is for a document, add all the interesting document metadata to the |
|---|
| | 251 | # "document_metadata" table (for use by the dynamic classifiers) |
|---|
| | 252 | if ($infodb_key !~ /\./ && $infodb_entry_value =~ /\<doctype\>doc\n/) |
|---|
| | 253 | { |
|---|
| | 254 | print $infodb_handle "DELETE FROM document_metadata WHERE docOID='" . $safe_infodb_key . "';\n"; |
|---|
| | 255 | |
|---|
| | 256 | foreach my $infodb_value_key (keys(%$infodb_map)) |
|---|
| | 257 | { |
|---|
| | 258 | # We're not interested in most of the automatically added document metadata |
|---|
| | 259 | next if ($infodb_value_key eq "archivedir" || |
|---|
| | 260 | $infodb_value_key eq "assocfilepath" || |
|---|
| | 261 | $infodb_value_key eq "childtype" || |
|---|
| | 262 | $infodb_value_key eq "contains" || |
|---|
| | 263 | $infodb_value_key eq "docnum" || |
|---|
| | 264 | $infodb_value_key eq "doctype" || |
|---|
| | 265 | $infodb_value_key eq "Encoding" || |
|---|
| | 266 | $infodb_value_key eq "FileSize" || |
|---|
| | 267 | $infodb_value_key eq "hascover" || |
|---|
| | 268 | $infodb_value_key eq "hastxt" || |
|---|
| | 269 | $infodb_value_key eq "lastmodified" || |
|---|
| | 270 | $infodb_value_key eq "metadataset" || |
|---|
| | 271 | $infodb_value_key eq "thistype" || |
|---|
| | 272 | $infodb_value_key =~ /^metadatafreq\-/ || |
|---|
| | 273 | $infodb_value_key =~ /^metadatalist\-/); |
|---|
| | 274 | |
|---|
| | 275 | foreach my $infodb_value (@{$infodb_map->{$infodb_value_key}}) |
|---|
| | 276 | { |
|---|
| | 277 | print $infodb_handle "INSERT INTO document_metadata (docOID, element, value) VALUES ('" . $safe_infodb_key . "', '" . &sqlite_safe($infodb_value_key) . "', '" . &sqlite_safe($infodb_value) . "');\n"; |
|---|
| | 278 | } |
|---|
| | 279 | } |
|---|
| | 280 | } |
|---|