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/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "sql/sql_export.h" | 17 #include "sql/sql_export.h" |
18 | 18 |
19 class FilePath; | 19 class FilePath; |
20 struct sqlite3; | 20 struct sqlite3; |
21 struct sqlite3_stmt; | 21 struct sqlite3_stmt; |
22 | 22 |
23 namespace sql { | 23 namespace sql { |
24 | 24 |
25 class Statement; | 25 class Statement; |
26 | 26 |
27 // Possible return values from ColumnType in a statement. These should match | |
28 // the values in sqlite3.h. | |
29 enum ColType { | |
30 COLUMN_TYPE_INTEGER = 1, | |
31 COLUMN_TYPE_FLOAT = 2, | |
32 COLUMN_TYPE_TEXT = 3, | |
33 COLUMN_TYPE_BLOB = 4, | |
34 COLUMN_TYPE_NULL = 5, | |
35 }; | |
Scott Hess - ex-Googler
2012/10/02 03:58:47
AFAICT, this is not used in this file? Either tha
| |
36 | |
27 // Uniquely identifies a statement. There are two modes of operation: | 37 // Uniquely identifies a statement. There are two modes of operation: |
28 // | 38 // |
29 // - In the most common mode, you will use the source file and line number to | 39 // - In the most common mode, you will use the source file and line number to |
30 // identify your statement. This is a convienient way to get uniqueness for | 40 // identify your statement. This is a convienient way to get uniqueness for |
31 // a statement that is only used in one place. Use the SQL_FROM_HERE macro | 41 // a statement that is only used in one place. Use the SQL_FROM_HERE macro |
32 // to generate a StatementID. | 42 // to generate a StatementID. |
33 // | 43 // |
34 // - In the "custom" mode you may use the statement from different places or | 44 // - In the "custom" mode you may use the statement from different places or |
35 // need to manage it yourself for whatever reason. In this case, you should | 45 // need to manage it yourself for whatever reason. In this case, you should |
36 // make up your own unique name and pass it to the StatementID. This name | 46 // make up your own unique name and pass it to the StatementID. This name |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 | 292 |
283 // Returns true if the given table exists. | 293 // Returns true if the given table exists. |
284 bool DoesTableExist(const char* table_name) const; | 294 bool DoesTableExist(const char* table_name) const; |
285 | 295 |
286 // Returns true if the given index exists. | 296 // Returns true if the given index exists. |
287 bool DoesIndexExist(const char* index_name) const; | 297 bool DoesIndexExist(const char* index_name) const; |
288 | 298 |
289 // Returns true if a column with the given name exists in the given table. | 299 // Returns true if a column with the given name exists in the given table. |
290 bool DoesColumnExist(const char* table_name, const char* column_name) const; | 300 bool DoesColumnExist(const char* table_name, const char* column_name) const; |
291 | 301 |
302 // Returns the type/affinity of the given column in the given table. | |
303 const std::string GetColumnType(const char* table_name, | |
304 int column_index) const; | |
305 | |
292 // Returns sqlite's internal ID for the last inserted row. Valid only | 306 // Returns sqlite's internal ID for the last inserted row. Valid only |
293 // immediately after an insert. | 307 // immediately after an insert. |
294 int64 GetLastInsertRowId() const; | 308 int64 GetLastInsertRowId() const; |
295 | 309 |
296 // Returns sqlite's count of the number of rows modified by the last | 310 // Returns sqlite's count of the number of rows modified by the last |
297 // statement executed. Will be 0 if no statement has executed or the database | 311 // statement executed. Will be 0 if no statement has executed or the database |
298 // is closed. | 312 // is closed. |
299 int GetLastChangeCount() const; | 313 int GetLastChangeCount() const; |
300 | 314 |
301 // Errors -------------------------------------------------------------------- | 315 // Errors -------------------------------------------------------------------- |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 // This object handles errors resulting from all forms of executing sqlite | 460 // This object handles errors resulting from all forms of executing sqlite |
447 // commands or statements. It can be null which means default handling. | 461 // commands or statements. It can be null which means default handling. |
448 scoped_refptr<ErrorDelegate> error_delegate_; | 462 scoped_refptr<ErrorDelegate> error_delegate_; |
449 | 463 |
450 DISALLOW_COPY_AND_ASSIGN(Connection); | 464 DISALLOW_COPY_AND_ASSIGN(Connection); |
451 }; | 465 }; |
452 | 466 |
453 } // namespace sql | 467 } // namespace sql |
454 | 468 |
455 #endif // SQL_CONNECTION_H_ | 469 #endif // SQL_CONNECTION_H_ |
OLD | NEW |