diff --git a/GeoModelDBManager/src/GMDBManager.cpp b/GeoModelDBManager/src/GMDBManager.cpp index 7c32d38e4a7db54d60b3a005c24fb632d0b1adc1..dc1ecc1033c7b383776db27be37c3d6bfae0e802 100644 --- a/GeoModelDBManager/src/GMDBManager.cpp +++ b/GeoModelDBManager/src/GMDBManager.cpp @@ -417,7 +417,7 @@ bool GMDBManager::addListOfRecords(const std::string geoType, const std::vector< //return addListOfRecordsToTableOld(tableName, records); // old SQLite versions } else - std::cout << "Info: no records to save for geoType '" << geoType << "'. Skipping..."; + std::cout << "Info: no records to save for geoType '" << geoType << "'. Skipping..." << std::endl; return true; } @@ -484,12 +484,15 @@ bool GMDBManager::addListOfRecords(const std::string geoType, const std::vector< // queryStr = QString("INSERT INTO Materials (id, name) VALUES (1,'Air'), (2,'Silicon'), (368,'ShieldSteel');"); // bool GMDBManager::addListOfRecordsToTable(const std::string tableName, const std::vector<std::vector<std::string>> records) +//bool addListOfRecordsToTable(const std::string tableName, const std::vector<std::vector<std::string>> records) { // get table columns and format them for query QString tableColString = "(" + QString::fromStdString(joinVectorStrings(m_tableNames.at(tableName), ", ")) + ")"; + qWarning() << "tableColString:" << tableColString; + unsigned int nRecords = records.size(); - std::cout << "number of " << tableName << "records to insert into the DB:" << nRecords; + std::cout << "number of " << tableName << " records to insert into the DB:" << nRecords << std::endl; // preparing the SQL query QString queryStr("INSERT INTO %1 %2 VALUES "); @@ -531,6 +534,23 @@ bool GMDBManager::addListOfRecordsToTable(const std::string tableName, const std } +//bool GMDBManager::addListOfRecordsToTable(const std::string tableName, const std::vector<std::vector<std::string>> records) +//{ +// // get table columns and format them for query +// std::string tableColString = "(" + joinVectorStrings(m_tableNames.at(tableName), ", ") + ")"; +// +// std::cout << "tableColString:" << tableColString << std::endl; +// +// unsigned int nRecords = records.size(); +// std::cout << "number of " << tableName << " records to insert into the DB:" << nRecords << std::endl; +// +// // preparing the SQL query +// QString queryStr("INSERT INTO %1 %2 VALUES "); +// queryStr = queryStr.arg(QString::fromStdString(tableName)); // insert table name +// queryStr = queryStr.arg(tableColString); // insert table columns +// +//} + // ***Note*** // old syntax, for SQLite in SLC6