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

Method getHistoryByUrl

Plugins/WebBrowser/History/HistoryDatabase.cpp:409–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407}
408
409HistoryItem CHistoryDatabase::getHistoryByUrl(const QString &url)
410{
411 HistoryItem item;
412
413 if(url.isEmpty()) return item;
414 auto urlItem = m_UrlDB.GetItem(url);
415 if(0 >= urlItem.id)
416 return item;
417
418 QSqlQuery query(GetDatabase());
419 query.prepare(
420 "SELECT id, visit_time "
421 "FROM history WHERE url = :url"
422 );
423 query.bindValue(":url", urlItem.id);
424
425 if (query.exec()) {
426 if(query.next()) {
427 item.id = query.value(0).toInt();
428 item.url = urlItem.szUrl;
429 item.title = urlItem.szTitle;
430 item.icon = urlItem.icon;
431 item.visitTime = query.value(1).toDateTime();
432 }
433 } else {
434 QString szErr = "Failed to get history by url:" + query.lastError().text()
435 + "; Sql: " + query.executedQuery()
436 + "; Url: " + url;
437 SetError(szErr);
438 qCritical(log) << GetError();
439 }
440
441 return item;
442}
443
444HistoryItem CHistoryDatabase::getHistoryById(int id)
445{

Callers

nothing calls this directly

Calls 2

GetItemMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected