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

Method GetCount

Src/Database/DatabaseTree.cpp:474–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

472}
473
474int CDatabaseNode::GetCount(int parentId)
475{
476 QSqlQuery query(GetDatabase());
477 if(0 == parentId) {
478 query.prepare("SELECT COUNT(*) FROM `" + m_szTableName + "`");
479 } else {
480 query.prepare("SELECT COUNT(*) FROM `" + m_szTableName + "` WHERE `parent_id`=:id");
481 query.bindValue(":id", parentId);
482 }
483 if (query.exec()) {
484 if(query.next())
485 return query.value(0).toInt();
486 } else {
487 SetError("Failed to get count: " + query.lastError().text()
488 + "; parentId: " + QString::number(parentId));
489 qCritical(log) << GetError();
490 }
491 return 0;
492}
493
494bool CDatabaseNode::ExportToJson(QJsonObject& obj)
495{

Callers 3

rowCountMethod · 0.80
canFetchMoreMethod · 0.80
GetNodeCountMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected