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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 Connection::Connection() | 117 Connection::Connection() |
118 : db_(NULL), | 118 : db_(NULL), |
119 page_size_(0), | 119 page_size_(0), |
120 cache_size_(0), | 120 cache_size_(0), |
121 exclusive_locking_(false), | 121 exclusive_locking_(false), |
122 transaction_nesting_(0), | 122 transaction_nesting_(0), |
123 needs_rollback_(false), | 123 needs_rollback_(false), |
124 in_memory_(false), | 124 in_memory_(false), |
125 poisoned_(false), | 125 poisoned_(false) {} |
126 error_delegate_(NULL) { | |
127 } | |
128 | 126 |
129 Connection::~Connection() { | 127 Connection::~Connection() { |
130 Close(); | 128 Close(); |
131 } | 129 } |
132 | 130 |
133 bool Connection::Open(const base::FilePath& path) { | 131 bool Connection::Open(const base::FilePath& path) { |
134 if (!histogram_tag_.empty()) { | 132 if (!histogram_tag_.empty()) { |
135 int64 size_64 = 0; | 133 int64 size_64 = 0; |
136 if (file_util::GetFileSize(path, &size_64)) { | 134 if (file_util::GetFileSize(path, &size_64)) { |
137 size_t sample = static_cast<size_t>(size_64 / 1024); | 135 size_t sample = static_cast<size_t>(size_64 / 1024); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 } | 801 } |
804 | 802 |
805 // Best effort to put things back as they were before. | 803 // Best effort to put things back as they were before. |
806 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; | 804 const char kNoWritableSchema[] = "PRAGMA writable_schema = OFF"; |
807 ignore_result(Execute(kNoWritableSchema)); | 805 ignore_result(Execute(kNoWritableSchema)); |
808 | 806 |
809 return ret; | 807 return ret; |
810 } | 808 } |
811 | 809 |
812 } // namespace sql | 810 } // namespace sql |
OLD | NEW |