Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Side by Side Diff: chrome/browser/sync/util/query_helpers.h

Issue 340055: String cleanup in sync code (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/util/path_helpers_win.cc ('k') | chrome/browser/sync/util/query_helpers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_path.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/string16.h"
16 #include "build/build_config.h" 18 #include "build/build_config.h"
17 #include "chrome/browser/sync/util/sync_types.h" 19 #include "chrome/browser/sync/util/sync_types.h"
18 #include "third_party/sqlite/preprocessed/sqlite3.h" 20 #include "third_party/sqlite/preprocessed/sqlite3.h"
19 21
20 enum SqliteNullType { 22 enum SqliteNullType {
21 SQLITE_NULL_VALUE 23 SQLITE_NULL_VALUE
22 }; 24 };
23 25
24 int SqliteOpen(PathString filename, sqlite3** ppDb); 26 int SqliteOpen(const FilePath& filename, sqlite3** ppDb);
25 27
26 sqlite3_stmt* PrepareQuery(sqlite3* dbhandle, const char* query); 28 sqlite3_stmt* PrepareQuery(sqlite3* dbhandle, const char* query);
27 #if !PATHSTRING_IS_STD_STRING
28 sqlite3_stmt* BindArg(sqlite3_stmt*, const PathString&, int index);
29 sqlite3_stmt* BindArg(sqlite3_stmt*, const PathChar*, int index);
30 #endif
31 sqlite3_stmt* BindArg(sqlite3_stmt*, const std::string&, int index); 29 sqlite3_stmt* BindArg(sqlite3_stmt*, const std::string&, int index);
32 sqlite3_stmt* BindArg(sqlite3_stmt*, const char*, int index); 30 sqlite3_stmt* BindArg(sqlite3_stmt*, const char*, int index);
33 sqlite3_stmt* BindArg(sqlite3_stmt*, int32, int index); 31 sqlite3_stmt* BindArg(sqlite3_stmt*, int32, int index);
34 sqlite3_stmt* BindArg(sqlite3_stmt*, int64, int index); 32 sqlite3_stmt* BindArg(sqlite3_stmt*, int64, int index);
35 sqlite3_stmt* BindArg(sqlite3_stmt*, double, int index); 33 sqlite3_stmt* BindArg(sqlite3_stmt*, double, int index);
36 sqlite3_stmt* BindArg(sqlite3_stmt*, bool, int index); 34 sqlite3_stmt* BindArg(sqlite3_stmt*, bool, int index);
37 sqlite3_stmt* BindArg(sqlite3_stmt*, const std::vector<uint8>&, int index); 35 sqlite3_stmt* BindArg(sqlite3_stmt*, const std::vector<uint8>&, int index);
38 sqlite3_stmt* BindArg(sqlite3_stmt*, SqliteNullType, int index); 36 sqlite3_stmt* BindArg(sqlite3_stmt*, SqliteNullType, int index);
39 37
40 #if !PATHSTRING_IS_STD_STRING 38 void GetColumn(sqlite3_stmt*, int index, string16* value);
41 void GetColumn(sqlite3_stmt*, int index, PathString* value);
42 #endif
43 void GetColumn(sqlite3_stmt*, int index, std::string* value); 39 void GetColumn(sqlite3_stmt*, int index, std::string* value);
44 void GetColumn(sqlite3_stmt*, int index, int32* value); 40 void GetColumn(sqlite3_stmt*, int index, int32* value);
45 void GetColumn(sqlite3_stmt*, int index, int64* value); 41 void GetColumn(sqlite3_stmt*, int index, int64* value);
46 void GetColumn(sqlite3_stmt*, int index, double* value); 42 void GetColumn(sqlite3_stmt*, int index, double* value);
47 void GetColumn(sqlite3_stmt*, int index, bool* value); 43 void GetColumn(sqlite3_stmt*, int index, bool* value);
48 void GetColumn(sqlite3_stmt*, int index, std::vector<uint8>* value); 44 void GetColumn(sqlite3_stmt*, int index, std::vector<uint8>* value);
49 45
50 bool DoesTableExist(sqlite3* dbhandle, const std::string& tablename); 46 bool DoesTableExist(sqlite3* dbhandle, const std::string& tablename);
51 47
52 // Prepares a query with a WHERE clause that filters the values by the items 48 // Prepares a query with a WHERE clause that filters the values by the items
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 680
685 DISALLOW_COPY_AND_ASSIGN(ScopedStatementResetter); 681 DISALLOW_COPY_AND_ASSIGN(ScopedStatementResetter);
686 }; 682 };
687 683
688 // Useful for encoding any sequence of bytes into a string that can be used in 684 // Useful for encoding any sequence of bytes into a string that can be used in
689 // a table name. Kind of like hex encoding, except that A is zero and P is 15. 685 // a table name. Kind of like hex encoding, except that A is zero and P is 15.
690 std::string APEncode(const std::string& in); 686 std::string APEncode(const std::string& in);
691 std::string APDecode(const std::string& in); 687 std::string APDecode(const std::string& in);
692 688
693 #endif // CHROME_BROWSER_SYNC_UTIL_QUERY_HELPERS_H_ 689 #endif // CHROME_BROWSER_SYNC_UTIL_QUERY_HELPERS_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/util/path_helpers_win.cc ('k') | chrome/browser/sync/util/query_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698