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 #ifndef SQL_CONNECTION_H_ | 5 #ifndef SQL_CONNECTION_H_ |
6 #define SQL_CONNECTION_H_ | 6 #define SQL_CONNECTION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // Allow test-support code to set/reset error ignorer. | 353 // Allow test-support code to set/reset error ignorer. |
354 friend class ScopedErrorIgnorer; | 354 friend class ScopedErrorIgnorer; |
355 | 355 |
356 // Statement accesses StatementRef which we don't want to expose to everybody | 356 // Statement accesses StatementRef which we don't want to expose to everybody |
357 // (they should go through Statement). | 357 // (they should go through Statement). |
358 friend class Statement; | 358 friend class Statement; |
359 | 359 |
360 // Internal initialize function used by both Init and InitInMemory. The file | 360 // Internal initialize function used by both Init and InitInMemory. The file |
361 // name is always 8 bits since we want to use the 8-bit version of | 361 // name is always 8 bits since we want to use the 8-bit version of |
362 // sqlite3_open. The string can also be sqlite's special ":memory:" string. | 362 // sqlite3_open. The string can also be sqlite's special ":memory:" string. |
363 bool OpenInternal(const std::string& file_name); | 363 // |
| 364 // |retry_flag| controls retrying the open if the error callback |
| 365 // addressed errors using RazeAndClose(). |
| 366 enum Retry { |
| 367 NO_RETRY = 0, |
| 368 RETRY_ON_POISON |
| 369 }; |
| 370 bool OpenInternal(const std::string& file_name, Retry retry_flag); |
364 | 371 |
365 // Internal close function used by Close() and RazeAndClose(). | 372 // Internal close function used by Close() and RazeAndClose(). |
366 // |forced| indicates that orderly-shutdown checks should not apply. | 373 // |forced| indicates that orderly-shutdown checks should not apply. |
367 void CloseInternal(bool forced); | 374 void CloseInternal(bool forced); |
368 | 375 |
369 // Check whether the current thread is allowed to make IO calls, but only | 376 // Check whether the current thread is allowed to make IO calls, but only |
370 // if database wasn't open in memory. Function is inlined to be a no-op in | 377 // if database wasn't open in memory. Function is inlined to be a no-op in |
371 // official build. | 378 // official build. |
372 void AssertIOAllowed() { | 379 void AssertIOAllowed() { |
373 if (!in_memory_) | 380 if (!in_memory_) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 523 |
517 // Tag for auxiliary histograms. | 524 // Tag for auxiliary histograms. |
518 std::string histogram_tag_; | 525 std::string histogram_tag_; |
519 | 526 |
520 DISALLOW_COPY_AND_ASSIGN(Connection); | 527 DISALLOW_COPY_AND_ASSIGN(Connection); |
521 }; | 528 }; |
522 | 529 |
523 } // namespace sql | 530 } // namespace sql |
524 | 531 |
525 #endif // SQL_CONNECTION_H_ | 532 #endif // SQL_CONNECTION_H_ |
OLD | NEW |