OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sql/connection.h" | 5 #include "sql/connection.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 // junk to prevent other processes from opening it successfully (like | 438 // junk to prevent other processes from opening it successfully (like |
439 // Gears "SQLite poison 3" trick). | 439 // Gears "SQLite poison 3" trick). |
440 // | 440 // |
441 // static | 441 // static |
442 bool Connection::Delete(const base::FilePath& path) { | 442 bool Connection::Delete(const base::FilePath& path) { |
443 base::ThreadRestrictions::AssertIOAllowed(); | 443 base::ThreadRestrictions::AssertIOAllowed(); |
444 | 444 |
445 base::FilePath journal_path(path.value() + FILE_PATH_LITERAL("-journal")); | 445 base::FilePath journal_path(path.value() + FILE_PATH_LITERAL("-journal")); |
446 base::FilePath wal_path(path.value() + FILE_PATH_LITERAL("-wal")); | 446 base::FilePath wal_path(path.value() + FILE_PATH_LITERAL("-wal")); |
447 | 447 |
448 base::Delete(journal_path, false); | 448 base::DeleteFile(journal_path, false); |
449 base::Delete(wal_path, false); | 449 base::DeleteFile(wal_path, false); |
450 base::Delete(path, false); | 450 base::DeleteFile(path, false); |
451 | 451 |
452 return !base::PathExists(journal_path) && | 452 return !base::PathExists(journal_path) && |
453 !base::PathExists(wal_path) && | 453 !base::PathExists(wal_path) && |
454 !base::PathExists(path); | 454 !base::PathExists(path); |
455 } | 455 } |
456 | 456 |
457 bool Connection::BeginTransaction() { | 457 bool Connection::BeginTransaction() { |
458 if (needs_rollback_) { | 458 if (needs_rollback_) { |
459 DCHECK_GT(transaction_nesting_, 0); | 459 DCHECK_GT(transaction_nesting_, 0); |
460 | 460 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 } | 902 } |
903 | 903 |
904 // Best effort to put things back as they were before. | 904 // Best effort to put things back as they were before. |
905 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; | 905 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; |
906 ignore_result(Execute(kNoWritableSchema)); | 906 ignore_result(Execute(kNoWritableSchema)); |
907 | 907 |
908 return ret; | 908 return ret; |
909 } | 909 } |
910 | 910 |
911 } // namespace sql | 911 } // namespace sql |
OLD | NEW |