| 799 | } |
| 800 | |
| 801 | bool CDatabaseTree::Move(int id, int newParent) |
| 802 | { |
| 803 | QSqlQuery query(GetDatabase()); |
| 804 | query.prepare( |
| 805 | "UPDATE `" + m_szTableName + "` SET " |
| 806 | "`parent_id` = :parent_id WHERE `id` = :id"); |
| 807 | query.bindValue(":parent_id", newParent); |
| 808 | query.bindValue(":id", id); |
| 809 | bool bRet = query.exec(); |
| 810 | if (!bRet) { |
| 811 | SetError("Failed to add tree item: " + query.lastError().text() |
| 812 | + "; Sql: " + query.executedQuery()); |
| 813 | qCritical(log) << GetError(); |
| 814 | } |
| 815 | return bRet; |
| 816 | } |
| 817 | |
| 818 | TreeItem CDatabaseTree::GetLeaf(int id) |
| 819 | { |