| 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> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
| 17 #include "base/time.h" | 17 #include "base/time.h" |
| 18 #include "sql/sql_export.h" | 18 #include "sql/sql_export.h" |
| 19 | 19 |
| 20 class FilePath; | |
| 21 struct sqlite3; | 20 struct sqlite3; |
| 22 struct sqlite3_stmt; | 21 struct sqlite3_stmt; |
| 23 | 22 |
| 23 namespace base { |
| 24 class FilePath; |
| 25 } |
| 26 |
| 24 namespace sql { | 27 namespace sql { |
| 25 | 28 |
| 26 class Statement; | 29 class Statement; |
| 27 | 30 |
| 28 // Uniquely identifies a statement. There are two modes of operation: | 31 // Uniquely identifies a statement. There are two modes of operation: |
| 29 // | 32 // |
| 30 // - In the most common mode, you will use the source file and line number to | 33 // - In the most common mode, you will use the source file and line number to |
| 31 // identify your statement. This is a convienient way to get uniqueness for | 34 // identify your statement. This is a convienient way to get uniqueness for |
| 32 // a statement that is only used in one place. Use the SQL_FROM_HERE macro | 35 // a statement that is only used in one place. Use the SQL_FROM_HERE macro |
| 33 // to generate a StatementID. | 36 // to generate a StatementID. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 // enum histogram "Sqlite.Error". Setting this additionally logs | 150 // enum histogram "Sqlite.Error". Setting this additionally logs |
| 148 // errors to the histogram |name|. | 151 // errors to the histogram |name|. |
| 149 void set_error_histogram_name(const std::string& name) { | 152 void set_error_histogram_name(const std::string& name) { |
| 150 error_histogram_name_ = name; | 153 error_histogram_name_ = name; |
| 151 } | 154 } |
| 152 | 155 |
| 153 // Initialization ------------------------------------------------------------ | 156 // Initialization ------------------------------------------------------------ |
| 154 | 157 |
| 155 // Initializes the SQL connection for the given file, returning true if the | 158 // Initializes the SQL connection for the given file, returning true if the |
| 156 // file could be opened. You can call this or OpenInMemory. | 159 // file could be opened. You can call this or OpenInMemory. |
| 157 bool Open(const FilePath& path) WARN_UNUSED_RESULT; | 160 bool Open(const base::FilePath& path) WARN_UNUSED_RESULT; |
| 158 | 161 |
| 159 // Initializes the SQL connection for a temporary in-memory database. There | 162 // Initializes the SQL connection for a temporary in-memory database. There |
| 160 // will be no associated file on disk, and the initial database will be | 163 // will be no associated file on disk, and the initial database will be |
| 161 // empty. You can call this or Open. | 164 // empty. You can call this or Open. |
| 162 bool OpenInMemory() WARN_UNUSED_RESULT; | 165 bool OpenInMemory() WARN_UNUSED_RESULT; |
| 163 | 166 |
| 164 // Returns trie if the database has been successfully opened. | 167 // Returns trie if the database has been successfully opened. |
| 165 bool is_open() const { return !!db_; } | 168 bool is_open() const { return !!db_; } |
| 166 | 169 |
| 167 // Closes the database. This is automatically performed on destruction for | 170 // Closes the database. This is automatically performed on destruction for |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 470 |
| 468 // Auxiliary error-code histogram. | 471 // Auxiliary error-code histogram. |
| 469 std::string error_histogram_name_; | 472 std::string error_histogram_name_; |
| 470 | 473 |
| 471 DISALLOW_COPY_AND_ASSIGN(Connection); | 474 DISALLOW_COPY_AND_ASSIGN(Connection); |
| 472 }; | 475 }; |
| 473 | 476 |
| 474 } // namespace sql | 477 } // namespace sql |
| 475 | 478 |
| 476 #endif // SQL_CONNECTION_H_ | 479 #endif // SQL_CONNECTION_H_ |
| OLD | NEW |