summaryrefslogtreecommitdiffstats
path: root/mappingtreemodel.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2012-11-16 18:01:21 +0100
committerArno <am@disconnect.de>2012-11-16 18:01:21 +0100
commitb40073331fcd756de4211fac113a6f9755dfa629 (patch)
tree309ffb496a242ab9017f60ccc3d17a95a3223558 /mappingtreemodel.cpp
parentba9c314b4ba68b2da1d6c59accbcb9cf1aa5f897 (diff)
downloadSheMov-b40073331fcd756de4211fac113a6f9755dfa629.tar.gz
SheMov-b40073331fcd756de4211fac113a6f9755dfa629.tar.bz2
SheMov-b40073331fcd756de4211fac113a6f9755dfa629.zip
Rename table mappings to more fitting mapping_description
Well, many errors are a result of the very confusing naming scheme. We have tables: * mappings, more correctly mapping_descriptions * mapping_parents2, mapping_parents will be eliminated * mapping_types, maybe right, not sure. This commit renames mappings (_the_ mapping table) to mapping_descriptions. Hope I didn't miss anything. No functional change, BTW.
Diffstat (limited to 'mappingtreemodel.cpp')
-rw-r--r--mappingtreemodel.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/mappingtreemodel.cpp b/mappingtreemodel.cpp
index 80085c3..fd5fbe3 100644
--- a/mappingtreemodel.cpp
+++ b/mappingtreemodel.cpp
@@ -20,27 +20,27 @@ MappingTreeModel::MappingTreeModel(QStringList &headers, QObject *parent) : SmTr
getMappingTypes();
//prepare Queries
- mSParentsQ = "SELECT mappings_parents2.imappings_parents_id, mappings_parents2.imapping_id, mappings.tmapping_name, mappings.tscreated, mappings_parents2.iparent_id FROM mappings_parents2, mappings WHERE mappings_parents2.iparent_id = :pid AND mappings.imapping_type = :type AND mappings_parents2.imapping_id = mappings.imapping_id ORDER BY mappings.tmapping_name";
+ mSParentsQ = "SELECT mappings_parents2.imappings_parents_id, mappings_parents2.imapping_id, mapping_description.tdescription_name, mapping_description.tscreated, mappings_parents2.iparent_id FROM mappings_parents2, mapping_description WHERE mappings_parents2.iparent_id = :pid AND mapping_description.idescription_type = :type AND mappings_parents2.imapping_id = mapping_description.idescription_id ORDER BY mapping_description.tdescription_name";
mUpdateTypeQ = new QSqlQuery(mDb);
mUpdateTypeQ->prepare("UPDATE mappings_type SET tmappings_type_name = :value WHERE imappings_type_id = :id");
mUpdateChildQ = new QSqlQuery(mDb);
- mUpdateChildQ->prepare("UPDATE mappings SET tmapping_name = :value WHERE imapping_id = :id");
+ mUpdateChildQ->prepare("UPDATE mapping_description SET tdescription_name = :value WHERE idescription_id = :id");
mAddMappingTypeQ = new QSqlQuery(mDb);
mAddMappingTypeQ->prepare("INSERT INTO mappings_type (tmappings_type_name) VALUES(:value)");
mDeleteMappingTypeQ = new QSqlQuery(mDb);
mDeleteMappingTypeQ->prepare("DELETE FROM mappings_type WHERE imappings_type_id = :id");
- mAddChildQ = new QSqlQuery(mDb);
- mAddChildQ->prepare("INSERT INTO mappings (tmapping_name, imapping_type) VALUES(:name, :type)");
- mSelectChildQ = new QSqlQuery(mDb);
- mSelectChildQ->prepare("SELECT imapping_id, tmapping_name, tscreated FROM mappings WHERE tmapping_name = :name AND imapping_type = :type");
+ mAddDescriptionQ = new QSqlQuery(mDb);
+ mAddDescriptionQ->prepare("INSERT INTO mapping_description (tdescription_name, idescription_type) VALUES(:name, :type)");
+ mSelectDescriptionQ = new QSqlQuery(mDb);
+ mSelectDescriptionQ->prepare("SELECT idescription_id, tdescription_name, tscreated FROM mapping_description WHERE tdescription_name = :name AND idescription_type = :type");
mAddParentQ = new QSqlQuery(mDb);
mAddParentQ->prepare("INSERT INTO mappings_parents2 (imapping_id, iparent_id) VALUES(:id, :parentid)");
mUpdateParentQ = new QSqlQuery(mDb);
mUpdateParentQ->prepare("UPDATE mappings_parents2 SET iparent_id = :id where imappings_parents_id = :sid");
mDeleteMappingParentQ = new QSqlQuery(mDb);
mDeleteMappingParentQ->prepare("DELETE FROM mappings_parents2 WHERE imappings_parents_id = :id");
- mMappingsQ = new QSqlQuery(mDb);
- mMappingsQ->prepare("SELECT tmapping_name, imapping_id FROM mappings WHERE imapping_type = :type");
+ mDescriptionQ = new QSqlQuery(mDb);
+ mDescriptionQ->prepare("SELECT tdescription_name, idescription_id FROM mapping_description WHERE idescription_type = :type");
}
MappingTreeModel::~MappingTreeModel(){
@@ -49,11 +49,11 @@ MappingTreeModel::~MappingTreeModel(){
delete mUpdateChildQ;
delete mAddMappingTypeQ;
delete mDeleteMappingTypeQ;
- delete mAddChildQ;
- delete mSelectChildQ;
+ delete mAddDescriptionQ;
+ delete mSelectDescriptionQ;
delete mAddParentQ;
delete mUpdateParentQ;
- delete mMappingsQ;
+ delete mDescriptionQ;
mDb = QSqlDatabase();
}
@@ -355,26 +355,26 @@ void MappingTreeModel::setType(int type){
}
void MappingTreeModel::getMappings(){
- mMappingsQ->bindValue(":type", mType);
- if(mMappingsQ->exec()){
+ mDescriptionQ->bindValue(":type", mType);
+ if(mDescriptionQ->exec()){
mMappings.clear();
- while(mMappingsQ->next()){
- mMappings.insert(mMappingsQ->value(0).toString(), mMappingsQ->value(1).toInt());
+ while(mDescriptionQ->next()){
+ mMappings.insert(mDescriptionQ->value(0).toString(), mDescriptionQ->value(1).toInt());
}
}
}
int MappingTreeModel::addChild(const QString &name, int type){
- mAddChildQ->bindValue(":name", name);
- mAddChildQ->bindValue(":type", type);
- if(mAddChildQ->exec()){
- mSelectChildQ->bindValue(":name", name);
- mSelectChildQ->bindValue(":type", type);
+ mAddDescriptionQ->bindValue(":name", name);
+ mAddDescriptionQ->bindValue(":type", type);
+ if(mAddDescriptionQ->exec()){
+ mSelectDescriptionQ->bindValue(":name", name);
+ mSelectDescriptionQ->bindValue(":type", type);
int c = 0;
- mSelectChildQ->exec();
- while(mSelectChildQ->next()){
+ mSelectDescriptionQ->exec();
+ while(mSelectDescriptionQ->next()){
++c;
- mMappings.insert(mSelectChildQ->value(1).toString(), mSelectChildQ->value(0).toInt());
+ mMappings.insert(mSelectDescriptionQ->value(1).toString(), mSelectDescriptionQ->value(0).toInt());
}
if(c > 1){
qWarning("addChild yielded more than 1 result!");