database_test_peer.cc 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "sql/test/database_test_peer.h"
  5. #include "base/files/file_path.h"
  6. #include "sql/database.h"
  7. #include "sql/internal_api_token.h"
  8. #include "sql/recovery.h"
  9. #include "third_party/sqlite/sqlite3.h"
  10. namespace sql {
  11. // static
  12. bool DatabaseTestPeer::AttachDatabase(Database* db,
  13. const base::FilePath& other_db_path,
  14. const char* attachment_point) {
  15. return db->AttachDatabase(other_db_path, attachment_point,
  16. InternalApiToken());
  17. }
  18. // static
  19. bool DatabaseTestPeer::DetachDatabase(Database* db,
  20. const char* attachment_point) {
  21. return db->DetachDatabase(attachment_point, InternalApiToken());
  22. }
  23. // static
  24. bool DatabaseTestPeer::EnableRecoveryExtension(Database* db) {
  25. return Recovery::EnableRecoveryExtension(db, InternalApiToken()) == SQLITE_OK;
  26. }
  27. } // namespace sql