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 #ifndef SQL_TRANSACTION_H_ | 5 #ifndef SQL_TRANSACTION_H_ |
6 #define SQL_TRANSACTION_H_ | 6 #define SQL_TRANSACTION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "sql/sql_export.h" |
10 | 11 |
11 namespace sql { | 12 namespace sql { |
12 | 13 |
13 class Connection; | 14 class Connection; |
14 | 15 |
15 class Transaction { | 16 class SQL_EXPORT Transaction { |
16 public: | 17 public: |
17 // Creates the scoped transaction object. You MUST call Begin() to begin the | 18 // Creates the scoped transaction object. You MUST call Begin() to begin the |
18 // transaction. If you have begun a transaction and not committed it, the | 19 // transaction. If you have begun a transaction and not committed it, the |
19 // constructor will roll back the transaction. If you want to commit, you | 20 // constructor will roll back the transaction. If you want to commit, you |
20 // need to manually call Commit before this goes out of scope. | 21 // need to manually call Commit before this goes out of scope. |
21 explicit Transaction(Connection* connection); | 22 explicit Transaction(Connection* connection); |
22 ~Transaction(); | 23 ~Transaction(); |
23 | 24 |
24 // Returns true when there is a transaction that has been successfully begun. | 25 // Returns true when there is a transaction that has been successfully begun. |
25 bool is_open() const { return is_open_; } | 26 bool is_open() const { return is_open_; } |
(...skipping 22 matching lines...) Expand all Loading... |
48 // True when the transaction is open, false when it's already been committed | 49 // True when the transaction is open, false when it's already been committed |
49 // or rolled back. | 50 // or rolled back. |
50 bool is_open_; | 51 bool is_open_; |
51 | 52 |
52 DISALLOW_COPY_AND_ASSIGN(Transaction); | 53 DISALLOW_COPY_AND_ASSIGN(Transaction); |
53 }; | 54 }; |
54 | 55 |
55 } // namespace sql | 56 } // namespace sql |
56 | 57 |
57 #endif // SQL_TRANSACTION_H_ | 58 #endif // SQL_TRANSACTION_H_ |
OLD | NEW |