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

Method GetLeaves

Src/Database/DatabaseTree.cpp:852–885  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

850}
851
852QList<TreeItem> CDatabaseTree::GetLeaves(int nodeId)
853{
854 QList<TreeItem> items;
855 QSqlQuery query(GetDatabase());
856 QString szSql;
857 szSql = "SELECT `id`, `name`, `key`, "
858 "`created_time`, `modified_time`, `last_visit_time`, `parent_id` "
859 "FROM `" + m_szTableName + "`";
860 if(0 <= nodeId)
861 szSql += " WHERE `parent_id` = :parent_id";
862 query.prepare(szSql);
863 query.bindValue(":parent_id", nodeId);
864 bool bRet = query.exec();
865 if (!bRet) {
866 SetError("Failed to get leaves: " + query.lastError().text()
867 + "; Sql: " + query.executedQuery()
868 + "; parentId: " + QString::number(nodeId));
869 qCritical(log) << GetError();
870 return items;
871 }
872 while(query.next()) {
873 TreeItem item(TreeItem::Leaf);
874 item.SetId(query.value(0).toInt());
875 item.SetName(query.value(1).toString());
876 item.SetKey(query.value(2).toInt());
877 item.SetCreateTime(query.value(3).toDateTime());
878 item.SetModifyTime(query.value(4).toDateTime());
879 item.SetLastVisitTime(query.value(5).toDateTime());
880 item.SetParentId(query.value(6).toInt());
881
882 items.append(item);
883 }
884 return items;
885}
886
887QList<TreeItem> CDatabaseTree::GetLeavesByKey(int key)
888{

Callers 1

getAllBookmarksMethod · 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