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

Method Delete

Src/Database/DatabaseTree.cpp:710–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

708}
709
710bool CDatabaseTree::Delete(int id, bool delKey)
711{
712 // 如果是最后的一个,则从 key 相关表中删除 key
713 if(delKey) {
714 auto leaf = GetLeaf(id);
715 if(leaf.GetKey() > 0) {
716 auto leaves = GetLeavesByKey(leaf.GetKey());
717 if(leaves.count() == 1) {
718 bool ok = OnDeleteKey(leaf.GetKey());
719 if(!ok)
720 return ok;
721 }
722 }
723 }
724 QSqlQuery query(GetDatabase());
725 query.prepare("DELETE FROM `" + m_szTableName + "` WHERE `id` = :id");
726 query.bindValue(":id", id);
727 bool bRet = query.exec();
728 if (!bRet) {
729 SetError("Failed to delete item: " + query.lastError().text()
730 + "; Sql: " + query.executedQuery()
731 + "; table: " + m_szTableName
732 + "; id: " + QString::number(id));
733 qCritical(log) << GetError();
734 }
735 return bRet;
736}
737
738bool CDatabaseTree::Delete(QList<int> items, bool delKey)
739{

Callers 2

removeRowsMethod · 0.80
deleteBookmarkMethod · 0.80

Calls 2

GetKeyMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected