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 "chrome/browser/history/thumbnail_database.h" | 5 #include "chrome/browser/history/thumbnail_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/sql/statement.h" | 10 #include "app/sql/statement.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 const char* name = is_temporary ? "temp_favicons" : "favicons"; | 197 const char* name = is_temporary ? "temp_favicons" : "favicons"; |
198 if (!db->DoesTableExist(name)) { | 198 if (!db->DoesTableExist(name)) { |
199 std::string sql; | 199 std::string sql; |
200 sql.append("CREATE TABLE "); | 200 sql.append("CREATE TABLE "); |
201 sql.append(name); | 201 sql.append(name); |
202 sql.append("(" | 202 sql.append("(" |
203 "id INTEGER PRIMARY KEY," | 203 "id INTEGER PRIMARY KEY," |
204 "url LONGVARCHAR NOT NULL," | 204 "url LONGVARCHAR NOT NULL," |
205 "last_updated INTEGER DEFAULT 0," | 205 "last_updated INTEGER DEFAULT 0," |
206 "image_data BLOB," | 206 "image_data BLOB," |
207 "icon_type INTEGER DEFAULT 1)"); // Set the default as FAV_ICON | 207 "icon_type INTEGER DEFAULT 1)"); // Set the default as FAVICON |
208 // to be consistent with table | 208 // to be consistent with table |
209 // upgrade in | 209 // upgrade in |
210 // UpgradeToVersion4(). | 210 // UpgradeToVersion4(). |
211 if (!db->Execute(sql.c_str())) | 211 if (!db->Execute(sql.c_str())) |
212 return false; | 212 return false; |
213 } | 213 } |
214 return true; | 214 return true; |
215 } | 215 } |
216 | 216 |
217 void ThumbnailDatabase::InitFavIconsIndex() { | 217 void ThumbnailDatabase::InitFavIconsIndex() { |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 if (!db_.Execute("ALTER TABLE favicons ADD icon_type INTEGER DEFAULT 1")) { | 752 if (!db_.Execute("ALTER TABLE favicons ADD icon_type INTEGER DEFAULT 1")) { |
753 NOTREACHED(); | 753 NOTREACHED(); |
754 return false; | 754 return false; |
755 } | 755 } |
756 meta_table_.SetVersionNumber(4); | 756 meta_table_.SetVersionNumber(4); |
757 meta_table_.SetCompatibleVersionNumber(std::min(4, kCompatibleVersionNumber)); | 757 meta_table_.SetCompatibleVersionNumber(std::min(4, kCompatibleVersionNumber)); |
758 return true; | 758 return true; |
759 } | 759 } |
760 | 760 |
761 } // namespace history | 761 } // namespace history |
OLD | NEW |