| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 CHROME_COMMON_SQLITEUTILS_H_ | 5 #ifndef CHROME_COMMON_SQLITEUTILS_H_ |
| 6 #define CHROME_COMMON_SQLITEUTILS_H_ | 6 #define CHROME_COMMON_SQLITEUTILS_H_ |
| 7 | 7 |
| 8 #include <string> |
| 8 #include <vector> | 9 #include <vector> |
| 9 | 10 |
| 10 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 11 | 12 |
| 12 #include "third_party/sqlite/sqlite3.h" | 13 #include "third_party/sqlite/sqlite3.h" |
| 13 | 14 |
| 14 // forward declarations of classes defined here | 15 // forward declarations of classes defined here |
| 15 class SQLTransaction; | 16 class SQLTransaction; |
| 16 class SQLNestedTransaction; | 17 class SQLNestedTransaction; |
| 17 class SQLNestedTransactionSite; | 18 class SQLNestedTransactionSite; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 58 } |
| 58 | 59 |
| 59 bool HasBegun() { | 60 bool HasBegun() { |
| 60 return began_; | 61 return began_; |
| 61 } | 62 } |
| 62 | 63 |
| 63 protected: | 64 protected: |
| 64 virtual int BeginCommand(const char* command); | 65 virtual int BeginCommand(const char* command); |
| 65 virtual int EndCommand(const char* command); | 66 virtual int EndCommand(const char* command); |
| 66 | 67 |
| 68 sqlite3* db_; |
| 67 bool began_; | 69 bool began_; |
| 68 sqlite3* db_; | |
| 69 DISALLOW_COPY_AND_ASSIGN(SQLTransaction); | 70 DISALLOW_COPY_AND_ASSIGN(SQLTransaction); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 | 73 |
| 73 //------------------------------------------------------------------------------ | 74 //------------------------------------------------------------------------------ |
| 74 // A class for use with SQLNestedTransaction. | 75 // A class for use with SQLNestedTransaction. |
| 75 //------------------------------------------------------------------------------ | 76 //------------------------------------------------------------------------------ |
| 76 class SQLNestedTransactionSite { | 77 class SQLNestedTransactionSite { |
| 77 protected: | 78 protected: |
| 78 SQLNestedTransactionSite() : db_(NULL), top_transaction_(NULL) {} | 79 SQLNestedTransactionSite() : db_(NULL), top_transaction_(NULL) {} |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 const char* column_type) { | 340 const char* column_type) { |
| 340 return DoesSqliteColumnExist(db, NULL, table_name, column_name, column_type); | 341 return DoesSqliteColumnExist(db, NULL, table_name, column_name, column_type); |
| 341 } | 342 } |
| 342 | 343 |
| 343 // Test whether a table has one or more rows. Returns true if the table | 344 // Test whether a table has one or more rows. Returns true if the table |
| 344 // has one or more rows and false if the table is empty or doesn't exist. | 345 // has one or more rows and false if the table is empty or doesn't exist. |
| 345 bool DoesSqliteTableHaveRow(sqlite3* db, const char* table_name); | 346 bool DoesSqliteTableHaveRow(sqlite3* db, const char* table_name); |
| 346 | 347 |
| 347 #endif // CHROME_COMMON_SQLITEUTILS_H_ | 348 #endif // CHROME_COMMON_SQLITEUTILS_H_ |
| 348 | 349 |
| OLD | NEW |