| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/download_database.h" | 5 #include "chrome/browser/history/download_database.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 dbg_statement.BindInt64( | 227 dbg_statement.BindInt64( |
| 228 1, | 228 1, |
| 229 end_time ? end_time : std::numeric_limits<int64>::max()); | 229 end_time ? end_time : std::numeric_limits<int64>::max()); |
| 230 dbg_statement.BindInt(2, DownloadItem::COMPLETE); | 230 dbg_statement.BindInt(2, DownloadItem::COMPLETE); |
| 231 dbg_statement.BindInt(3, DownloadItem::CANCELLED); | 231 dbg_statement.BindInt(3, DownloadItem::CANCELLED); |
| 232 dbg_statement.BindInt(4, DownloadItem::INTERRUPTED); | 232 dbg_statement.BindInt(4, DownloadItem::INTERRUPTED); |
| 233 while (dbg_statement.Step()) { | 233 while (dbg_statement.Step()) { |
| 234 int64 id_to_delete = dbg_statement.ColumnInt64(0); | 234 int64 id_to_delete = dbg_statement.ColumnInt64(0); |
| 235 returned_ids_.erase(id_to_delete); | 235 returned_ids_.erase(id_to_delete); |
| 236 } | 236 } |
| 237 CHECK(dbg_statement.Succeeded()); |
| 237 } | 238 } |
| 238 | 239 |
| 239 // This does not use an index. We currently aren't likely to have enough | 240 // This does not use an index. We currently aren't likely to have enough |
| 240 // downloads where an index by time will give us a lot of benefit. | 241 // downloads where an index by time will give us a lot of benefit. |
| 241 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, | 242 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, |
| 242 "DELETE FROM downloads WHERE start_time >= ? AND start_time < ? " | 243 "DELETE FROM downloads WHERE start_time >= ? AND start_time < ? " |
| 243 "AND (State = ? OR State = ? OR State = ?)")); | 244 "AND (State = ? OR State = ? OR State = ?)")); |
| 244 if (!statement) | 245 if (!statement) |
| 245 return; | 246 return; |
| 246 | 247 |
| 247 statement.BindInt64(0, start_time); | 248 statement.BindInt64(0, start_time); |
| 248 statement.BindInt64( | 249 statement.BindInt64( |
| 249 1, | 250 1, |
| 250 end_time ? end_time : std::numeric_limits<int64>::max()); | 251 end_time ? end_time : std::numeric_limits<int64>::max()); |
| 251 statement.BindInt(2, DownloadItem::COMPLETE); | 252 statement.BindInt(2, DownloadItem::COMPLETE); |
| 252 statement.BindInt(3, DownloadItem::CANCELLED); | 253 statement.BindInt(3, DownloadItem::CANCELLED); |
| 253 statement.BindInt(4, DownloadItem::INTERRUPTED); | 254 statement.BindInt(4, DownloadItem::INTERRUPTED); |
| 254 statement.Run(); | 255 statement.Run(); |
| 255 } | 256 } |
| 256 | 257 |
| 257 } // namespace history | 258 } // namespace history |
| OLD | NEW |