Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 369 if (!ExecuteWithTimeout(sql.c_str(), kBusyTimeout)) | 369 if (!ExecuteWithTimeout(sql.c_str(), kBusyTimeout)) |
| 370 NOTREACHED() << "Could not set page size: " << GetErrorMessage(); | 370 NOTREACHED() << "Could not set page size: " << GetErrorMessage(); |
| 371 } | 371 } |
| 372 | 372 |
| 373 if (cache_size_ != 0) { | 373 if (cache_size_ != 0) { |
| 374 const std::string sql = StringPrintf("PRAGMA cache_size=%d", cache_size_); | 374 const std::string sql = StringPrintf("PRAGMA cache_size=%d", cache_size_); |
| 375 if (!ExecuteWithTimeout(sql.c_str(), kBusyTimeout)) | 375 if (!ExecuteWithTimeout(sql.c_str(), kBusyTimeout)) |
| 376 NOTREACHED() << "Could not set cache size: " << GetErrorMessage(); | 376 NOTREACHED() << "Could not set cache size: " << GetErrorMessage(); |
| 377 } | 377 } |
| 378 | 378 |
| 379 if (!ExecuteWithTimeout("PRAGMA secure_delete=ON", kBusyTimeout)) { | |
| 380 NOTREACHED() << "Could not enable secure_delete: " << GetErrorMessage(); | |
|
Scott Hess - ex-Googler
2011/08/09 20:33:37
NOTREACHED() means you'll never get to the Close()
Paweł Hajdan Jr.
2011/08/09 23:05:00
I used NOTREACHED() because code above uses it. Ho
Scott Hess - ex-Googler
2011/08/09 23:13:44
Doh! You're right, for some reason I was thinking
| |
| 381 Close(); | |
| 382 return false; | |
| 383 } | |
| 384 | |
| 379 return true; | 385 return true; |
| 380 } | 386 } |
| 381 | 387 |
| 382 void Connection::DoRollback() { | 388 void Connection::DoRollback() { |
| 383 Statement rollback(GetCachedStatement(SQL_FROM_HERE, "ROLLBACK")); | 389 Statement rollback(GetCachedStatement(SQL_FROM_HERE, "ROLLBACK")); |
| 384 if (rollback) | 390 if (rollback) |
| 385 rollback.Run(); | 391 rollback.Run(); |
| 386 } | 392 } |
| 387 | 393 |
| 388 void Connection::StatementRefCreated(StatementRef* ref) { | 394 void Connection::StatementRefCreated(StatementRef* ref) { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 411 | 417 |
| 412 int Connection::OnSqliteError(int err, sql::Statement *stmt) { | 418 int Connection::OnSqliteError(int err, sql::Statement *stmt) { |
| 413 if (error_delegate_.get()) | 419 if (error_delegate_.get()) |
| 414 return error_delegate_->OnError(err, this, stmt); | 420 return error_delegate_->OnError(err, this, stmt); |
| 415 // The default handling is to assert on debug and to ignore on release. | 421 // The default handling is to assert on debug and to ignore on release. |
| 416 NOTREACHED() << GetErrorMessage(); | 422 NOTREACHED() << GetErrorMessage(); |
| 417 return err; | 423 return err; |
| 418 } | 424 } |
| 419 | 425 |
| 420 } // namespace sql | 426 } // namespace sql |
| OLD | NEW |