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 #include "chrome/browser/meta_table_helper.h" | 5 #include "chrome/browser/meta_table_helper.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/common/sqlite_utils.h" | 9 #include "chrome/common/sqlite_utils.h" |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 SetCompatibleVersionNumber(compatible_version); | 46 SetCompatibleVersionNumber(compatible_version); |
47 } | 47 } |
48 return true; | 48 return true; |
49 } | 49 } |
50 | 50 |
51 bool MetaTableHelper::SetValue(const std::string& key, | 51 bool MetaTableHelper::SetValue(const std::string& key, |
52 const std::wstring& value) { | 52 const std::wstring& value) { |
53 SQLStatement s; | 53 SQLStatement s; |
54 if (!PrepareSetStatement(&s, key)) | 54 if (!PrepareSetStatement(&s, key)) |
55 return false; | 55 return false; |
56 s.bind_text16(1, value.c_str()); | 56 s.bind_wstring(1, value); |
57 return s.step() == SQLITE_DONE; | 57 return s.step() == SQLITE_DONE; |
58 } | 58 } |
59 | 59 |
60 bool MetaTableHelper::GetValue(const std::string& key, | 60 bool MetaTableHelper::GetValue(const std::string& key, |
61 std::wstring* value) { | 61 std::wstring* value) { |
62 DCHECK(value); | 62 DCHECK(value); |
63 SQLStatement s; | 63 SQLStatement s; |
64 if (!PrepareGetStatement(&s, key)) | 64 if (!PrepareGetStatement(&s, key)) |
65 return false; | 65 return false; |
66 | 66 |
67 s.column_string16(0, value); | 67 s.column_wstring(0, value); |
68 return true; | 68 return true; |
69 } | 69 } |
70 | 70 |
71 bool MetaTableHelper::SetValue(const std::string& key, | 71 bool MetaTableHelper::SetValue(const std::string& key, |
72 int value) { | 72 int value) { |
73 SQLStatement s; | 73 SQLStatement s; |
74 if (!PrepareSetStatement(&s, key)) | 74 if (!PrepareSetStatement(&s, key)) |
75 return false; | 75 return false; |
76 s.bind_int(1, value); | 76 s.bind_int(1, value); |
77 return s.step() == SQLITE_DONE; | 77 return s.step() == SQLITE_DONE; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 sql.append("meta WHERE key = ?"); | 158 sql.append("meta WHERE key = ?"); |
159 if (statement->prepare(db_, sql.c_str()) != SQLITE_OK) { | 159 if (statement->prepare(db_, sql.c_str()) != SQLITE_OK) { |
160 NOTREACHED() << sqlite3_errmsg(db_); | 160 NOTREACHED() << sqlite3_errmsg(db_); |
161 return false; | 161 return false; |
162 } | 162 } |
163 statement->bind_string(0, key); | 163 statement->bind_string(0, key); |
164 if (statement->step() != SQLITE_ROW) | 164 if (statement->step() != SQLITE_ROW) |
165 return false; | 165 return false; |
166 return true; | 166 return true; |
167 } | 167 } |
OLD | NEW |