MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / getAllHistory

Method getAllHistory

Plugins/WebBrowser/History/HistoryDatabase.cpp:281–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281QList<HistoryItem> CHistoryDatabase::getAllHistory(int limit, int offset)
282{
283 QList<HistoryItem> historyList;
284
285 QSqlQuery query(GetDatabase());
286 if(0 > limit) {
287 query.prepare(
288 "SELECT id, url, visit_time "
289 "FROM history "
290 "ORDER BY visit_time DESC "
291 );
292 } else {
293 query.prepare(
294 "SELECT id, url, visit_time "
295 "FROM history "
296 "ORDER BY visit_time DESC "
297 "LIMIT :limit OFFSET :offset"
298 );
299 query.bindValue(":limit", limit);
300 query.bindValue(":offset", offset);
301 }
302 if (query.exec()) {
303 while (query.next()) {
304 HistoryItem item;
305 item.id = query.value(0).toInt();
306 CDatabaseUrl::UrlItem urlItem = m_UrlDB.GetItem(query.value(1).toInt());
307 item.url = urlItem.szUrl;
308 item.title = urlItem.szTitle;
309 item.visitTime = query.value(2).toDateTime();
310 item.icon = urlItem.icon;
311 historyList.append(item);
312 }
313 } else {
314 QString szErr = "Failed to get all history:" + query.lastError().text()
315 + "; Sql: " + query.executedQuery();
316 SetError(szErr);
317 qCritical(log) << GetError();
318 }
319
320 return historyList;
321}
322
323QList<HistoryItem> CHistoryDatabase::getHistoryByDate(const QDate &date)
324{

Callers 1

refreshMethod · 0.80

Calls 1

GetItemMethod · 0.80

Tested by

no test coverage detected