| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Typesafe composition of SQL query strings. | 5 // Typesafe composition of SQL query strings. |
| 6 | 6 |
| 7 #ifndef CHROME_BROWSER_SYNC_UTIL_QUERY_HELPERS_H_ | 7 #ifndef CHROME_BROWSER_SYNC_UTIL_QUERY_HELPERS_H_ |
| 8 #define CHROME_BROWSER_SYNC_UTIL_QUERY_HELPERS_H_ | 8 #define CHROME_BROWSER_SYNC_UTIL_QUERY_HELPERS_H_ |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/browser/sync/util/sync_types.h" | 17 #include "chrome/browser/sync/util/sync_types.h" |
| 18 #include "third_party/sqlite/preprocessed/sqlite3.h" | 18 #include "third_party/sqlite/preprocessed/sqlite3.h" |
| 19 | 19 |
| 20 // Sometimes threads contend on the DB lock itself, especially when one thread | |
| 21 // is calling SaveChanges. In the worst case scenario, the user can put his | |
| 22 // laptop to sleep during db contention, and wake up the laptop days later, so | |
| 23 // infinity seems like the best choice here. | |
| 24 const int kDirectoryBackingStoreBusyTimeoutMs = std::numeric_limits<int>::max(); | |
| 25 | |
| 26 enum SqliteNullType { | 20 enum SqliteNullType { |
| 27 SQLITE_NULL_VALUE | 21 SQLITE_NULL_VALUE |
| 28 }; | 22 }; |
| 29 | 23 |
| 30 int SqliteOpen(PathString filename, sqlite3** ppDb); | 24 int SqliteOpen(PathString filename, sqlite3** ppDb); |
| 31 | 25 |
| 32 sqlite3_stmt* PrepareQuery(sqlite3* dbhandle, const char* query); | 26 sqlite3_stmt* PrepareQuery(sqlite3* dbhandle, const char* query); |
| 33 #if !PATHSTRING_IS_STD_STRING | 27 #if !PATHSTRING_IS_STD_STRING |
| 34 sqlite3_stmt* BindArg(sqlite3_stmt*, const PathString&, int index); | 28 sqlite3_stmt* BindArg(sqlite3_stmt*, const PathString&, int index); |
| 35 sqlite3_stmt* BindArg(sqlite3_stmt*, const PathChar*, int index); | 29 sqlite3_stmt* BindArg(sqlite3_stmt*, const PathChar*, int index); |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 | 684 |
| 691 DISALLOW_COPY_AND_ASSIGN(ScopedStatementResetter); | 685 DISALLOW_COPY_AND_ASSIGN(ScopedStatementResetter); |
| 692 }; | 686 }; |
| 693 | 687 |
| 694 // Useful for encoding any sequence of bytes into a string that can be used in | 688 // Useful for encoding any sequence of bytes into a string that can be used in |
| 695 // a table name. Kind of like hex encoding, except that A is zero and P is 15. | 689 // a table name. Kind of like hex encoding, except that A is zero and P is 15. |
| 696 std::string APEncode(const std::string& in); | 690 std::string APEncode(const std::string& in); |
| 697 std::string APDecode(const std::string& in); | 691 std::string APDecode(const std::string& in); |
| 698 | 692 |
| 699 #endif // CHROME_BROWSER_SYNC_UTIL_QUERY_HELPERS_H_ | 693 #endif // CHROME_BROWSER_SYNC_UTIL_QUERY_HELPERS_H_ |
| OLD | NEW |