Changeset 18467 for gsdl/trunk
- Timestamp:
- 2009-02-06T18:16:32+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/dbutil.pm
r18441 r18467 168 168 169 169 170 sub delete_infodb_entry 171 { 172 my $infodb_type = shift(@_); 173 my $infodb_handle = shift(@_); 174 my $infodb_key = shift(@_); 175 176 if ($infodb_type eq "sqlite") 177 { 178 return &delete_infodb_entry_sqlite($infodb_handle, $infodb_key); 179 } 180 elsif ($infodb_type eq "gdbm-txtgz") 181 { 182 return &delete_infodb_entry_gdbm_txtgz($infodb_handle, $infodb_key); 183 } 184 elsif ($infodb_type eq "mssql") 185 { 186 return &delete_infodb_entry_mssql($infodb_handle, $infodb_key); 187 } 188 189 # Use GDBM if the infodb type is empty or not one of the values above 190 return &delete_infodb_entry_gdbm($infodb_handle, $infodb_key); 191 } 192 193 170 194 171 195 # ----------------------------------------------------------------------------- … … 276 300 277 301 302 sub delete_infodb_entry_gdbm_txtgz 303 { 304 305 my $infodb_handle = shift(@_); 306 my $infodb_key = shift(@_); 307 308 309 # A minus at the end of a key (after the ]) signifies 'delete' 310 print $infodb_handle "[$infodb_key]-\n"; 311 312 # The 70 minus signs are also needed, to help make the parsing by db2txt simple 313 print $infodb_handle '-' x 70, "\n"; 314 } 315 316 278 317 279 318 # ----------------------------------------------------------------------------- … … 369 408 # With infodb_handle already set up, works the same as _gdbm_txtgz version 370 409 write_infodb_entry_gdbm_txtgz(@_); 410 } 411 412 sub delete_infodb_entry_gdbm 413 { 414 # With infodb_handle already set up, works the same as _gdbm_txtgz version 415 delete_infodb_entry_gdbm_txtgz(@_); 371 416 } 372 417 … … 486 531 } 487 532 } 533 534 535 536 sub delete_infodb_entry_sqlite 537 { 538 my $infodb_handle = shift(@_); 539 my $infodb_key = shift(@_); 540 541 # Delete the key from the "data" table 542 543 my $safe_infodb_key = &sqlite_safe($infodb_key); 544 545 print $infodb_handle "DELETE FROM data WHERE key='" . $safe_infodb_key . "';\n"; 546 547 # If this infodb entry is for a document, delete the 548 # "document_metadata" table entry also (for use by the dynamic classifiers) 549 if ($infodb_key !~ /\./) 550 { 551 # Possible for there not to be a docOID matching this infodb_key 552 # (entries are only made when <doctype> == doc 553 # Attempt to delete it, and don't complain if one isn't found 554 555 print $infodb_handle "DELETE FROM document_metadata WHERE docOID='" . $safe_infodb_key . "';\n"; 556 557 } 558 } 559 560 561 562 488 563 489 564 … … 667 742 } 668 743 744 sub delete_infodb_entry_mssql 745 { 746 my $infodb_handle = shift(@_); 747 my $infodb_key = shift(@_); 748 749 # Delete the key from the "data" table 750 751 752 # Prepare the query 753 my $safe_infodb_key = &mssql_safe($infodb_key); 754 my $query = "DELETE FROM " . $mssql_data_table_name . " WHERE one_key=N'" . $safe_infodb_key . "'"; 755 dbquery($infodb_handle, $query); 756 757 # If this infodb entry is for a document, add all the interesting document metadata to the 758 # "document_metadata" table (for use by the dynamic classifiers) 759 if ($infodb_key !~ /\./) 760 { 761 # Possible for there not to be a docOID matching this infodb_key 762 # (entries are only made when <doctype> == doc 763 # Attempt to delete it, and don't complain if one isn't found 764 765 dbquery($infodb_handle, "DELETE FROM " . $mssql_document_metadata_table_name . " WHERE docOID=N'" . $safe_infodb_key . "'"); 766 767 } 768 } 769 770 669 771 670 772 sub mssql_safe
Note:
See TracChangeset
for help on using the changeset viewer.