| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/password_manager/core/browser/affiliation_database.h" | 5 #include "components/password_manager/core/browser/affiliation_database.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "sql/connection.h" | 9 #include "sql/connection.h" |
| 10 #include "sql/error_delegate_util.h" | 10 #include "sql/error_delegate_util.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 DeleteAffiliationsForFacet(uri); | 207 DeleteAffiliationsForFacet(uri); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 | 210 |
| 211 if (!Store(affiliation)) | 211 if (!Store(affiliation)) |
| 212 NOTREACHED(); | 212 NOTREACHED(); |
| 213 | 213 |
| 214 transaction.Commit(); | 214 transaction.Commit(); |
| 215 } | 215 } |
| 216 | 216 |
| 217 // static |
| 218 void AffiliationDatabase::Delete(const base::FilePath& path) { |
| 219 bool success = sql::Connection::Delete(path); |
| 220 DCHECK(success); |
| 221 } |
| 222 |
| 217 bool AffiliationDatabase::CreateTablesAndIndicesIfNeeded() { | 223 bool AffiliationDatabase::CreateTablesAndIndicesIfNeeded() { |
| 218 if (!sql_connection_->Execute( | 224 if (!sql_connection_->Execute( |
| 219 "CREATE TABLE IF NOT EXISTS eq_classes(" | 225 "CREATE TABLE IF NOT EXISTS eq_classes(" |
| 220 "id INTEGER PRIMARY KEY," | 226 "id INTEGER PRIMARY KEY," |
| 221 "last_update_time INTEGER)")) { | 227 "last_update_time INTEGER)")) { |
| 222 return false; | 228 return false; |
| 223 } | 229 } |
| 224 | 230 |
| 225 if (!sql_connection_->Execute( | 231 if (!sql_connection_->Execute( |
| 226 "CREATE TABLE IF NOT EXISTS eq_class_members(" | 232 "CREATE TABLE IF NOT EXISTS eq_class_members(" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 249 sql_connection_->RazeAndClose(); | 255 sql_connection_->RazeAndClose(); |
| 250 return; | 256 return; |
| 251 } | 257 } |
| 252 | 258 |
| 253 // The default handling is to assert on debug and to ignore on release. | 259 // The default handling is to assert on debug and to ignore on release. |
| 254 if (!sql::Connection::ShouldIgnoreSqliteError(error)) | 260 if (!sql::Connection::ShouldIgnoreSqliteError(error)) |
| 255 DLOG(FATAL) << sql_connection_->GetErrorMessage(); | 261 DLOG(FATAL) << sql_connection_->GetErrorMessage(); |
| 256 } | 262 } |
| 257 | 263 |
| 258 } // namespace password_manager | 264 } // namespace password_manager |
| OLD | NEW |