diff --git a/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h b/GeoModelIO/GeoModelDBManager/GeoModelDBManager/GMDBManager.h index 4206242248006461e35ceaa33ae49aad6a73cab9..404eab0f6ab6cce06240cd0f1e8099e7cc9cb9fb 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 8baf752dd2fbed8719daa8854e100de8c5e57a68..499d25fb3b57a6b1cb46428af1769a0e383dfbe7 100644 --- a/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp +++ b/GeoModelIO/GeoModelDBManager/src/GMDBManager.cpp @@ -660,7 +660,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", @@ -1582,12 +1582,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 a3f0301c274a8086b1aa449fd98777c6106a0843..042a8539d161568d70dfbf914032c848625af040 100644 --- a/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp +++ b/GeoModelIO/GeoModelWrite/src/WriteGeoModel.cpp @@ -2587,20 +2587,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; }