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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 bool Connection::Delete(const base::FilePath& path) { | 395 bool Connection::Delete(const base::FilePath& path) { |
396 base::ThreadRestrictions::AssertIOAllowed(); | 396 base::ThreadRestrictions::AssertIOAllowed(); |
397 | 397 |
398 base::FilePath journal_path(path.value() + FILE_PATH_LITERAL("-journal")); | 398 base::FilePath journal_path(path.value() + FILE_PATH_LITERAL("-journal")); |
399 base::FilePath wal_path(path.value() + FILE_PATH_LITERAL("-wal")); | 399 base::FilePath wal_path(path.value() + FILE_PATH_LITERAL("-wal")); |
400 | 400 |
401 base::Delete(journal_path, false); | 401 base::Delete(journal_path, false); |
402 base::Delete(wal_path, false); | 402 base::Delete(wal_path, false); |
403 base::Delete(path, false); | 403 base::Delete(path, false); |
404 | 404 |
405 return !file_util::PathExists(journal_path) && | 405 return !base::PathExists(journal_path) && |
406 !file_util::PathExists(wal_path) && | 406 !base::PathExists(wal_path) && |
407 !file_util::PathExists(path); | 407 !base::PathExists(path); |
408 } | 408 } |
409 | 409 |
410 bool Connection::BeginTransaction() { | 410 bool Connection::BeginTransaction() { |
411 if (needs_rollback_) { | 411 if (needs_rollback_) { |
412 DCHECK_GT(transaction_nesting_, 0); | 412 DCHECK_GT(transaction_nesting_, 0); |
413 | 413 |
414 // When we're going to rollback, fail on this begin and don't actually | 414 // When we're going to rollback, fail on this begin and don't actually |
415 // mark us as entering the nested transaction. | 415 // mark us as entering the nested transaction. |
416 return false; | 416 return false; |
417 } | 417 } |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 } | 851 } |
852 | 852 |
853 // Best effort to put things back as they were before. | 853 // Best effort to put things back as they were before. |
854 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; | 854 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; |
855 ignore_result(Execute(kNoWritableSchema)); | 855 ignore_result(Execute(kNoWritableSchema)); |
856 | 856 |
857 return ret; | 857 return ret; |
858 } | 858 } |
859 | 859 |
860 } // namespace sql | 860 } // namespace sql |
OLD | NEW |