OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <limits> | 5 #include <limits> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "chrome/browser/history/download_database.h" | 8 #include "chrome/browser/history/download_database.h" |
9 | 9 |
10 #include "chrome/browser/download/download_manager.h" | 10 #include "chrome/browser/download/download_manager.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 "SET received_bytes=?, state=? WHERE id=?"); | 86 "SET received_bytes=?, state=? WHERE id=?"); |
87 if (!statement.is_valid()) | 87 if (!statement.is_valid()) |
88 return false; | 88 return false; |
89 | 89 |
90 statement->bind_int64(0, received_bytes); | 90 statement->bind_int64(0, received_bytes); |
91 statement->bind_int(1, state); | 91 statement->bind_int(1, state); |
92 statement->bind_int64(2, db_handle); | 92 statement->bind_int64(2, db_handle); |
93 return statement->step() == SQLITE_DONE; | 93 return statement->step() == SQLITE_DONE; |
94 } | 94 } |
95 | 95 |
| 96 bool DownloadDatabase::UpdateDownloadPath(const std::wstring& path, |
| 97 DownloadID db_handle) { |
| 98 DCHECK(db_handle > 0); |
| 99 SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(), |
| 100 "UPDATE downloads " |
| 101 "SET full_path=? WHERE id=?"); |
| 102 if (!statement.is_valid()) |
| 103 return false; |
| 104 |
| 105 statement->bind_wstring(0, path); |
| 106 statement->bind_int64(1, db_handle); |
| 107 return statement->step() == SQLITE_DONE; |
| 108 } |
| 109 |
96 int64 DownloadDatabase::CreateDownload(const DownloadCreateInfo& info) { | 110 int64 DownloadDatabase::CreateDownload(const DownloadCreateInfo& info) { |
97 SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(), | 111 SQLITE_UNIQUE_STATEMENT(statement, GetStatementCache(), |
98 "INSERT INTO downloads " | 112 "INSERT INTO downloads " |
99 "(full_path, url, start_time, received_bytes, total_bytes, state) " | 113 "(full_path, url, start_time, received_bytes, total_bytes, state) " |
100 "VALUES (?, ?, ?, ?, ?, ?)"); | 114 "VALUES (?, ?, ?, ?, ?, ?)"); |
101 if (!statement.is_valid()) | 115 if (!statement.is_valid()) |
102 return 0; | 116 return 0; |
103 | 117 |
104 statement->bind_wstring(0, info.path); | 118 statement->bind_wstring(0, info.path); |
105 statement->bind_wstring(1, info.url); | 119 statement->bind_wstring(1, info.url); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 text.append(L"%"); | 169 text.append(L"%"); |
156 statement->bind_wstring(0, text); | 170 statement->bind_wstring(0, text); |
157 statement->bind_wstring(1, text); | 171 statement->bind_wstring(1, text); |
158 | 172 |
159 while (statement->step() == SQLITE_ROW) | 173 while (statement->step() == SQLITE_ROW) |
160 results->push_back(statement->column_int64(0)); | 174 results->push_back(statement->column_int64(0)); |
161 } | 175 } |
162 | 176 |
163 } // namespace history | 177 } // namespace history |
164 | 178 |
OLD | NEW |