Changeset 15748
- Timestamp:
- 2008-05-28T14:29:31+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/dbutil.pm
r15747 r15748 213 213 214 214 print $infodb_file_handle "CREATE TABLE data (key TEXT, value TEXT, PRIMARY KEY(key));\n"; 215 print $infodb_file_handle "CREATE TABLE document_metadata (id INTEGER PRIMARY KEY, docOID TEXT, element TEXT, value TEXT);\n"; 215 216 216 217 return $infodb_file_handle; … … 243 244 } 244 245 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 } 247 281 } 248 282
Note:
See TracChangeset
for help on using the changeset viewer.