- Timestamp:
- Sep 29, 2018 6:50:33 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Version.inc.php
r601 r637 416 416 417 417 /** 418 * Delete all versioned history of a DB record. 419 * 420 * @param string $record_table The table containing the record. 421 * @param string $record_key The key column for the record. 422 * @param string $record_val The value of the key column for the record. 423 * 424 * @return void 425 */ 426 public function deleteAll($record_table, $record_key, $record_val) 427 { 428 $app =& App::getInstance(); 429 $db =& DB::getInstance(); 430 431 $this->initDB(); 432 433 // Delete all versions for this record. 434 $qid = $db->query(" 435 DELETE FROM " . $db->escapeString($this->getParam('db_table')) . " 436 WHERE record_table = '" . $db->escapeString($record_table) . "' 437 AND record_key = '" . $db->escapeString($record_key) . "' 438 AND record_val = '" . $db->escapeString($record_val) . "' 439 "); 440 $app->logMsg(sprintf('Deleted all %s rows for %s.%s=%s', mysql_affected_rows($db->getDBH()), $record_table, $record_key, $record_val), LOG_INFO, __FILE__, __LINE__); 441 } 442 443 /** 444 * Delete one version of a DB record. 445 * 446 * @param string $version_id The ID of the version to delete. 447 * 448 * @return void 449 */ 450 public function delete($version_id) 451 { 452 $app =& App::getInstance(); 453 $db =& DB::getInstance(); 454 455 $this->initDB(); 456 457 // Delete one version. 458 $qid = $db->query(" 459 DELETE FROM " . $db->escapeString($this->getParam('db_table')) . " 460 WHERE version_id = '" . $db->escapeString($version_id) . "' 461 "); 462 $app->logMsg(sprintf('Deleted version_id=%s', $version_id), LOG_INFO, __FILE__, __LINE__); 463 } 464 465 /** 418 466 * Get a list of versions of specified record. 419 467 *
Note: See TracChangeset
for help on using the changeset viewer.