Chromium Code Reviews| 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 <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1726 | 1726 |
| 1727 // http://www.sqlite.org/pragma.html#pragma_journal_mode | 1727 // http://www.sqlite.org/pragma.html#pragma_journal_mode |
| 1728 // DELETE (default) - delete -journal file to commit. | 1728 // DELETE (default) - delete -journal file to commit. |
| 1729 // TRUNCATE - truncate -journal file to commit. | 1729 // TRUNCATE - truncate -journal file to commit. |
| 1730 // PERSIST - zero out header of -journal file to commit. | 1730 // PERSIST - zero out header of -journal file to commit. |
| 1731 // TRUNCATE should be faster than DELETE because it won't need directory | 1731 // TRUNCATE should be faster than DELETE because it won't need directory |
| 1732 // changes for each transaction. PERSIST may break the spirit of using | 1732 // changes for each transaction. PERSIST may break the spirit of using |
| 1733 // secure_delete. | 1733 // secure_delete. |
| 1734 ignore_result(Execute("PRAGMA journal_mode = TRUNCATE")); | 1734 ignore_result(Execute("PRAGMA journal_mode = TRUNCATE")); |
| 1735 | 1735 |
| 1736 bool was_poisoned = poisoned_; | |
| 1737 if (was_poisoned) { | |
| 1738 Close(); | |
| 1739 if (retry_flag == RETRY_ON_POISON) | |
| 1740 return OpenInternal(file_name, NO_RETRY); | |
| 1741 return false; | |
| 1742 } | |
| 1743 | |
|
Scott Hess - ex-Googler
2016/08/18 21:51:38
I'd prefer the version I posted to you under separ
afakhry
2016/08/19 18:01:57
Agreed. I'll wait until you land yours and rebase
| |
| 1736 const base::TimeDelta kBusyTimeout = | 1744 const base::TimeDelta kBusyTimeout = |
| 1737 base::TimeDelta::FromSeconds(kBusyTimeoutSeconds); | 1745 base::TimeDelta::FromSeconds(kBusyTimeoutSeconds); |
| 1738 | 1746 |
| 1739 if (page_size_ != 0) { | 1747 if (page_size_ != 0) { |
| 1740 // Enforce SQLite restrictions on |page_size_|. | 1748 // Enforce SQLite restrictions on |page_size_|. |
| 1741 DCHECK(!(page_size_ & (page_size_ - 1))) | 1749 DCHECK(!(page_size_ & (page_size_ - 1))) |
| 1742 << " page_size_ " << page_size_ << " is not a power of two."; | 1750 << " page_size_ " << page_size_ << " is not a power of two."; |
| 1743 const int kSqliteMaxPageSize = 32768; // from sqliteLimit.h | 1751 const int kSqliteMaxPageSize = 32768; // from sqliteLimit.h |
| 1744 DCHECK_LE(page_size_, kSqliteMaxPageSize); | 1752 DCHECK_LE(page_size_, kSqliteMaxPageSize); |
| 1745 const std::string sql = | 1753 const std::string sql = |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1974 ignore_result(Execute(kNoWritableSchema)); | 1982 ignore_result(Execute(kNoWritableSchema)); |
| 1975 | 1983 |
| 1976 return ret; | 1984 return ret; |
| 1977 } | 1985 } |
| 1978 | 1986 |
| 1979 base::TimeTicks TimeSource::Now() { | 1987 base::TimeTicks TimeSource::Now() { |
| 1980 return base::TimeTicks::Now(); | 1988 return base::TimeTicks::Now(); |
| 1981 } | 1989 } |
| 1982 | 1990 |
| 1983 } // namespace sql | 1991 } // namespace sql |
| OLD | NEW |