summaryrefslogtreecommitdiffstats
path: root/mappingtreemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mappingtreemodel.cpp')
-rw-r--r--mappingtreemodel.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/mappingtreemodel.cpp b/mappingtreemodel.cpp
index c32574a..1babac1 100644
--- a/mappingtreemodel.cpp
+++ b/mappingtreemodel.cpp
@@ -44,7 +44,7 @@ MappingTreeModel::MappingTreeModel(QStringList &headers, QObject *parent) : SmTr
mUpdateParentQ = new QSqlQuery(mDb);
mUpdateParentQ->prepare("UPDATE mappings_parents SET iparent_id = :pid WHERE imapping_id = :id");
mDeleteMappingParentQ = new QSqlQuery(mDb);
- mDeleteMappingParentQ->prepare("DELETE FROM mappings_parents WHERE imapping_id = :id");
+ mDeleteMappingParentQ->prepare("DELETE FROM mappings_parents2 WHERE imappings_parents_id = :id");
mMappingsForFileIdQ = new QSqlQuery(mDb);
mMappingsForFileIdQ->prepare("SELECT DISTINCT(imapping_id) FROM pics_mappings WHERE ipics_id = :pid");
mMappingsQ = new QSqlQuery(mDb);
@@ -326,11 +326,12 @@ bool MappingTreeModel::deleteChild(const QModelIndex &idx){
if(item->childCount() > 0){
return false;
}
- mDeleteChildQ->bindValue(":id", item->data(Id));
- if(mDeleteChildQ->exec()){
+ mDeleteMappingParentQ->bindValue(":id", item->data(MapParentId));
+ if(mDeleteMappingParentQ->exec()){
removeRows(idx.row(), 1, idx.parent());
return true;
}
+ mLastError = mDeleteMappingParentQ->lastError();
return false;
}