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 #include "app/sql/meta_table.h" | 5 #include "app/sql/meta_table.h" |
6 | 6 |
7 #include "app/sql/connection.h" | 7 #include "app/sql/connection.h" |
8 #include "app/sql/statement.h" | 8 #include "app/sql/statement.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // Note: there is no index over the meta table. We currently only have a | 39 // Note: there is no index over the meta table. We currently only have a |
40 // couple of keys, so it doesn't matter. If we start storing more stuff in | 40 // couple of keys, so it doesn't matter. If we start storing more stuff in |
41 // there, we should create an index. | 41 // there, we should create an index. |
42 SetVersionNumber(version); | 42 SetVersionNumber(version); |
43 SetCompatibleVersionNumber(compatible_version); | 43 SetCompatibleVersionNumber(compatible_version); |
44 } | 44 } |
45 return true; | 45 return true; |
46 } | 46 } |
47 | 47 |
| 48 void MetaTable::Reset() { |
| 49 db_ = NULL; |
| 50 } |
| 51 |
48 bool MetaTable::SetValue(const char* key, const std::string& value) { | 52 bool MetaTable::SetValue(const char* key, const std::string& value) { |
49 Statement s; | 53 Statement s; |
50 if (!PrepareSetStatement(&s, key)) | 54 if (!PrepareSetStatement(&s, key)) |
51 return false; | 55 return false; |
52 s.BindString(1, value); | 56 s.BindString(1, value); |
53 return s.Run(); | 57 return s.Run(); |
54 } | 58 } |
55 | 59 |
56 bool MetaTable::GetValue(const char* key, std::string* value) { | 60 bool MetaTable::GetValue(const char* key, std::string* value) { |
57 Statement s; | 61 Statement s; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 NOTREACHED() << db_->GetErrorMessage(); | 143 NOTREACHED() << db_->GetErrorMessage(); |
140 return false; | 144 return false; |
141 } | 145 } |
142 statement->BindCString(0, key); | 146 statement->BindCString(0, key); |
143 if (!statement->Step()) | 147 if (!statement->Step()) |
144 return false; | 148 return false; |
145 return true; | 149 return true; |
146 } | 150 } |
147 | 151 |
148 } // namespace sql | 152 } // namespace sql |
149 | |
OLD | NEW |