Index: chrome/browser/history/download_database.cc |
diff --git a/chrome/browser/history/download_database.cc b/chrome/browser/history/download_database.cc |
index f101e395f2169176bf891cdc9eefe6d0509d8848..16faac84e84f6cdeaac2f9b946a50c9d370b4d3f 100644 |
--- a/chrome/browser/history/download_database.cc |
+++ b/chrome/browser/history/download_database.cc |
@@ -146,10 +146,21 @@ bool DownloadDatabase::CleanUpInProgressEntries() { |
} |
int64 DownloadDatabase::CreateDownload(const DownloadCreateInfo& info) { |
- sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, |
- "INSERT INTO downloads " |
- "(full_path, url, start_time, received_bytes, total_bytes, state) " |
- "VALUES (?, ?, ?, ?, ?, ?)")); |
+ // If the database contains the 'last_modified' field, then set it to blank. |
+ bool has_last_mod = GetDB().DoesColumnExist("downloads", "last_modified"); |
+ sql::Statement statement; |
+ if (has_last_mod) { |
+ statement.Assign(GetDB().GetCachedStatement(SQL_FROM_HERE, |
+ "INSERT INTO downloads " |
+ "(full_path, url, start_time, received_bytes, total_bytes, state, " |
+ "last_modified) " |
+ "VALUES (?, ?, ?, ?, ?, ?, ?)")); |
+ } else { |
+ statement.Assign(GetDB().GetCachedStatement(SQL_FROM_HERE, |
+ "INSERT INTO downloads " |
+ "(full_path, url, start_time, received_bytes, total_bytes, state) " |
+ "VALUES (?, ?, ?, ?, ?, ?)")); |
+ } |
if (!statement) |
return 0; |
@@ -159,6 +170,8 @@ int64 DownloadDatabase::CreateDownload(const DownloadCreateInfo& info) { |
statement.BindInt64(3, info.received_bytes); |
statement.BindInt64(4, info.total_bytes); |
statement.BindInt(5, info.state); |
+ if (has_last_mod) |
+ statement.BindString(6, ""); |
if (statement.Run()) |
return GetDB().GetLastInsertRowId(); |