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

Method GetLeaf

Src/Database/DatabaseTree.cpp:818–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

816}
817
818TreeItem CDatabaseTree::GetLeaf(int id)
819{
820 TreeItem item(TreeItem::Leaf);
821
822 QSqlQuery query(GetDatabase());
823 query.prepare(
824 "SELECT `name`, `key`, `created_time`, `modified_time`, `last_visit_time`, `parent_id` "
825 " FROM `" + m_szTableName + "` "
826 " WHERE `id` = :id");
827 query.bindValue(":id", id);
828 bool bRet = query.exec();
829 if (!bRet) {
830 QString szErr
831 = "Failed to get leaf: " + query.lastError().text()
832 + "; Sql: " + query.executedQuery()
833 + "; id: " + QString::number(id);
834 SetError(szErr);
835 qCritical(log) << GetError();
836 return item;
837 }
838
839 if(query.next()) {
840 item.SetId(id);
841 item.SetName(query.value(0).toString());
842 item.SetKey(query.value(1).toInt());
843 item.SetCreateTime(query.value(2).toDateTime());
844 item.SetModifyTime(query.value(3).toDateTime());
845 item.SetLastVisitTime(query.value(4).toDateTime());
846 item.SetParentId(query.value(5).toInt());
847 }
848
849 return item;
850}
851
852QList<TreeItem> CDatabaseTree::GetLeaves(int nodeId)
853{

Callers 1

getBookmarkMethod · 0.80

Calls 7

SetIdMethod · 0.80
SetKeyMethod · 0.80
SetModifyTimeMethod · 0.80
SetLastVisitTimeMethod · 0.80
SetParentIdMethod · 0.80
SetNameMethod · 0.45
SetCreateTimeMethod · 0.45

Tested by

no test coverage detected