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

Method getHistoryById

Plugins/WebBrowser/History/HistoryDatabase.cpp:444–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442}
443
444HistoryItem CHistoryDatabase::getHistoryById(int id)
445{
446 HistoryItem item;
447
448 QSqlQuery query(GetDatabase());
449 query.prepare(
450 "SELECT id, url, visit_time "
451 "FROM history WHERE id = :id"
452 );
453 query.bindValue(":id", id);
454
455 if (query.exec()) {
456 if(query.next()) {
457 item.id = query.value(0).toInt();
458 int urlId = query.value(1).toInt();
459 auto urlItem = m_UrlDB.GetItem(urlId);
460 item.url = urlItem.szUrl;
461 item.title = urlItem.szTitle;
462 item.icon = urlItem.icon;
463 item.visitTime = query.value(2).toDateTime();
464 }
465 } else {
466 QString szErr = "Failed to get history by id:" + query.lastError().text()
467 + "; Sql: " + query.executedQuery()
468 + "; id: " + QString::number(id);
469 SetError(szErr);
470 qCritical(log) << GetError();
471 }
472
473 return item;
474}
475
476int CHistoryDatabase::getHistoryCount()
477{

Callers

nothing calls this directly

Calls 1

GetItemMethod · 0.80

Tested by

no test coverage detected