diff --git a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h index 8f8e72e15e5b1fafebb7d43d6aaa0b30fe5c8f7f..1c33537c08a0df247f2dd075ca644c032fe21ce0 100644 --- a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h +++ b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h @@ -227,8 +227,7 @@ class GMDBManager { const DBRowEntry records); - bool addListOfChildrenPositions( - const std::vector<std::vector<std::string>> &records); + bool addListOfChildrenPositions(const DBRowsList &records); /** * @brief Save the list of 'published' GeoAlignableTransform nodes to the diff --git a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp index 98b725ad9acd9f229d8acca7d98910612d051f25..84fca75852d805f8e0569c45dfcfacc91284bd6c 100644 --- a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp +++ b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp @@ -659,7 +659,7 @@ std::deque<double> GMDBManager::getTableFromTableName_DequeDouble(std::string ta //} bool GMDBManager::addListOfChildrenPositions( - const std::vector<std::vector<std::string>>& records) { + const DBRowsList& records) { if (records.size() > 0) { // NOTE: Choose the right function for your version of SQLite!! return addListOfRecordsToTable("ChildrenPositions", @@ -1581,12 +1581,11 @@ bool GMDBManager::createTables() { tab.push_back("childCopyNumber"); storeTableColumnNames(tab); queryStr = fmt::format( - "create table {0}({1} integer primary key, {2} integer, {3} " - "integer " - "not null REFERENCES GeoNodesTypes(id), {4} integer, {5} integer, " - "{6} " - "integer not null REFERENCES GeoNodesTypes(id), {7} integer not " - "null, " + "create table {0}({1} integer primary key, {2} integer, " + "{3} integer not null REFERENCES GeoNodesTypes(id), " + "{4} integer, {5} integer, " + "{6} integer not null REFERENCES GeoNodesTypes(id), " + "{7} integer not null, " "{8} integer not null)", tab[0], tab[1], tab[2], tab[3], tab[4], tab[5], tab[6], tab[7], tab[8]); rc = execQuery(queryStr); diff --git a/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h b/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h index 686cbd86bc1650669d46c7d0f8c4d10b2e7134c3..28f09ab3e343c5aefb25b80bf6e5d4d216e25eed 100644 --- a/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h +++ b/GeoModelIO/GeoModelWrite/GeoModelWrite/WriteGeoModel.h @@ -405,7 +405,9 @@ class WriteGeoModel : public GeoNodeAction { // std::vector<std::string> m_rootVolume; std::pair<std::string, unsigned> m_rootVolume; - std::vector<std::vector<std::string>> m_childrenPositions; + // std::vector<std::vector<std::string>> m_childrenPositions; + DBRowsList m_childrenPositions; + std::vector<std::vector<std::string>> m_publishedAlignableTransforms_String; std::vector<std::vector<std::string>> m_publishedFullPhysVols_String; diff --git a/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp b/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp index 0006e5c8c248b7430bc6bf99bb66c50695b4f4bd..7593786dbd3a4b92f6d5ff34952ea473724cc803 100644 --- a/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp +++ b/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp @@ -2588,20 +2588,25 @@ void WriteGeoModel::addChildPosition(const unsigned int& parentId, const unsigned int& parentCopyN, const unsigned int& childPos, const std::string& childType, - const unsigned int& childCopyN) { - std::vector<std::vector<std::string>>* container = &m_childrenPositions; + const unsigned int& childCopyN) +{ + // std::vector<std::vector<std::string>>* container = &m_childrenPositions; + DBRowsList* container = &m_childrenPositions; + const unsigned int parentTableID = getIdFromNodeType(parentType); const unsigned int childTableID = getIdFromNodeType(childType); - std::vector<std::string> values; + // std::vector<std::string> values; + DBRowEntry values; + // values << parentId.toString() << parentTableID << // QString::number(parentCopyN) << QString::number(childPos) << // childTableID << childId.toString() << QString::number(childCopyN); values.insert(values.begin(), - {std::to_string(parentId), std::to_string(parentTableID), - std::to_string(parentCopyN), std::to_string(childPos), - std::to_string(childTableID), std::to_string(childId), - std::to_string(childCopyN)}); // INT + {parentId, parentTableID, + parentCopyN, childPos, + childTableID, childId, + childCopyN}); addRecord(container, values); return; }