diff options
author | Arno <am@disconnect.de> | 2012-11-16 18:32:24 +0100 |
---|---|---|
committer | Arno <am@disconnect.de> | 2012-11-16 18:33:32 +0100 |
commit | 6140cff1df2ccd7bd991f4b6ab5f174b8b9298d3 (patch) | |
tree | 02a3205747e8369631d9b2dc3a1595ff61d253e1 /mappingtreemodel.cpp | |
parent | 23e26321c6e98617c5188cf28fe8fd1a590d38a3 (diff) | |
download | SheMov-6140cff1df2ccd7bd991f4b6ab5f174b8b9298d3.tar.gz SheMov-6140cff1df2ccd7bd991f4b6ab5f174b8b9298d3.tar.bz2 SheMov-6140cff1df2ccd7bd991f4b6ab5f174b8b9298d3.zip |
More renaming: mappings_parents
Rename:
* drop table mappings_parents
* rename mappings_parents2 to mapping_parents
* drop the s after mapping on column names
* rename FK imapping_id to idescription_id
* rename ParentId(Role) to MappingParentId(Role)
Well, it still works (tm) :)
Diffstat (limited to 'mappingtreemodel.cpp')
-rw-r--r-- | mappingtreemodel.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mappingtreemodel.cpp b/mappingtreemodel.cpp index b42bad3..ddfd5e2 100644 --- a/mappingtreemodel.cpp +++ b/mappingtreemodel.cpp @@ -20,7 +20,7 @@ MappingTreeModel::MappingTreeModel(QStringList &headers, QObject *parent) : SmTr getMappingTypes(); //prepare Queries - 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"; + mSParentsQ = "SELECT mapping_parents.imapping_parents_id, mapping_parents.idescription_id, mapping_description.tdescription_name, mapping_description.tscreated, mapping_parents.iparent_id FROM mapping_parents, mapping_description WHERE mapping_parents.iparent_id = :pid AND mapping_description.idescription_type = :type AND mapping_parents.idescription_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); @@ -34,11 +34,11 @@ MappingTreeModel::MappingTreeModel(QStringList &headers, QObject *parent) : SmTr 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)"); + mAddParentQ->prepare("INSERT INTO mapping_parents (idescription_id, iparent_id) VALUES(:id, :parentid)"); mUpdateParentQ = new QSqlQuery(mDb); - mUpdateParentQ->prepare("UPDATE mappings_parents2 SET iparent_id = :id where imappings_parents_id = :sid"); + mUpdateParentQ->prepare("UPDATE mapping_parents SET iparent_id = :id where imapping_parents_id = :sid"); mDeleteMappingParentQ = new QSqlQuery(mDb); - mDeleteMappingParentQ->prepare("DELETE FROM mappings_parents2 WHERE imappings_parents_id = :id"); + mDeleteMappingParentQ->prepare("DELETE FROM mapping_parents WHERE imapping_parents_id = :id"); mDescriptionQ = new QSqlQuery(mDb); mDescriptionQ->prepare("SELECT tdescription_name, idescription_id FROM mapping_description WHERE idescription_type = :type"); } @@ -123,8 +123,8 @@ QVariant MappingTreeModel::data(const QModelIndex &index, int role) const{ if(role == DescIdRole){ return item->data(DescId); } - if(role == ParentIdRole){ - return item->data(ParentId); + if(role == MappingParentIdRole){ + return item->data(MappingParentId); } return SmTreeModel::data(index, role); } @@ -310,7 +310,7 @@ MappingData MappingTreeModel::mappingDataFromIndex(QModelIndex &idx) const{ return retval; } retval.mappingId = idx.data(MappingTreeModel::MappingIdRole).toInt(); - retval.parentId = idx.data(MappingTreeModel::ParentIdRole).toInt(); + retval.parentId = idx.data(MappingTreeModel::MappingParentIdRole).toInt(); retval.myId = idx.data(MappingTreeModel::DescIdRole).toInt(); retval.name = idx.data(MappingTreeModel::NameRole).toString(); retval.path << path(idx); |