| 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_SQLITE_COMPILED_STATEMENT_ | 5 #ifndef CHROME_COMMON_SQLITE_COMPILED_STATEMENT_ |
| 6 #define CHROME_COMMON_SQLITE_COMPILED_STATEMENT_ | 6 #define CHROME_COMMON_SQLITE_COMPILED_STATEMENT_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/common/sqlite_utils.h" | 11 #include "base/basictypes.h" |
| 12 | 12 |
| 13 #include "third_party/sqlite/preprocessed/sqlite3.h" | 13 struct sqlite3; |
| 14 class SQLStatement; |
| 14 | 15 |
| 15 // Stores a list of precompiled sql statements for a database. Each statement | 16 // Stores a list of precompiled sql statements for a database. Each statement |
| 16 // is given a unique name by the caller. | 17 // is given a unique name by the caller. |
| 17 // | 18 // |
| 18 // Note: see comments on descructor. | 19 // Note: see comments on descructor. |
| 19 class SqliteStatementCache { | 20 class SqliteStatementCache { |
| 20 public: | 21 public: |
| 21 // You must call set_db before anything else if you use this constructor. | 22 // You must call set_db before anything else if you use this constructor. |
| 22 SqliteStatementCache() : db_(NULL) { | 23 SqliteStatementCache() : db_(NULL) { |
| 23 } | 24 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // SQLITE_UNIQUE_STATEMENT(var_name, cache, "SELECT * FROM foo"); | 126 // SQLITE_UNIQUE_STATEMENT(var_name, cache, "SELECT * FROM foo"); |
| 126 // if (!var_name.is_valid()) | 127 // if (!var_name.is_valid()) |
| 127 // return oops; | 128 // return oops; |
| 128 // var_name->bind_XXX( | 129 // var_name->bind_XXX( |
| 129 // var_name->step(); | 130 // var_name->step(); |
| 130 // ... | 131 // ... |
| 131 #define SQLITE_UNIQUE_STATEMENT(var_name, cache, sql) \ | 132 #define SQLITE_UNIQUE_STATEMENT(var_name, cache, sql) \ |
| 132 SqliteCompiledStatement var_name(__FILE__, __LINE__, cache, sql) | 133 SqliteCompiledStatement var_name(__FILE__, __LINE__, cache, sql) |
| 133 | 134 |
| 134 #endif // CHROME_COMMON_SQLITE_COMPILED_STATEMENT_ | 135 #endif // CHROME_COMMON_SQLITE_COMPILED_STATEMENT_ |
| OLD | NEW |