Truncate.php 548 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Drupal\Core\Database\Driver\pgsql;
  3. use Drupal\Core\Database\Query\Truncate as QueryTruncate;
  4. /**
  5. * PostgreSQL implementation of \Drupal\Core\Database\Query\Truncate.
  6. */
  7. class Truncate extends QueryTruncate {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function execute() {
  12. $this->connection->addSavepoint();
  13. try {
  14. $result = parent::execute();
  15. }
  16. catch (\Exception $e) {
  17. $this->connection->rollbackSavepoint();
  18. throw $e;
  19. }
  20. $this->connection->releaseSavepoint();
  21. return $result;
  22. }
  23. }