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 #include "chrome/browser/history/android/android_urls_database.h" | 5 #include "chrome/browser/history/android/android_urls_database.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace history { | 9 namespace history { |
10 | 10 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 return false; | 137 return false; |
138 } | 138 } |
139 | 139 |
140 return true; | 140 return true; |
141 } | 141 } |
142 | 142 |
143 bool AndroidURLsDatabase::ClearAndroidURLRows() { | 143 bool AndroidURLsDatabase::ClearAndroidURLRows() { |
144 return GetDB().Execute("DELETE FROM android_urls"); | 144 return GetDB().Execute("DELETE FROM android_urls"); |
145 } | 145 } |
146 | 146 |
| 147 bool AndroidURLsDatabase::MigrateToVersion22() { |
| 148 if (!GetDB().DoesTableExist("android_urls")) |
| 149 return true; |
| 150 |
| 151 if (!GetDB().Execute("ALTER TABLE android_urls RENAME TO android_urls_tmp")) |
| 152 return false; |
| 153 |
| 154 if (!CreateAndroidURLsTable()) |
| 155 return false; |
| 156 |
| 157 if (!GetDB().Execute( |
| 158 "INSERT INTO android_urls (id, raw_url, url_id) " |
| 159 "SELECT id, raw_url, url_id FROM android_urls_tmp")) |
| 160 return false; |
| 161 |
| 162 if (!GetDB().Execute("DROP TABLE android_urls_tmp")) |
| 163 return false; |
| 164 |
| 165 return true; |
| 166 } |
| 167 |
147 } // namespace history | 168 } // namespace history |
OLD | NEW |