Commit 98addf9e authored by Marco De Marco's avatar Marco De Marco
Browse files

Precision loss on insert

parent a8580174
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
#include <ctime>

#include <boost/date_time.hpp>
#include <boost/lexical_cast.hpp>

#include <soci/mysql/soci-mysql.h>

@@ -159,6 +160,9 @@ std::string DBManager::composeInsertQuery(std::string schema, std::string table,
{
    DEBUG_STREAM << "DBManager::composeInsertQuery()" << endl;


	//TODO: check if all lexical cast are necessary

    std::stringstream keysStream;
    std::stringstream valuesStream;
    std::stringstream keyValuesStream;
@@ -181,7 +185,7 @@ std::string DBManager::composeInsertQuery(std::string schema, std::string table,
    for(int i = 0; i<row.double_list_size(); ++i)
    {
        keysStream << row.double_list(i).key() << ",";
        valuesStream << row.double_list(i).value() << ",";
        valuesStream << boost::lexical_cast<std::string>(row.double_list(i).value()) << ",";
        keyValuesStream << row.double_list(i).key()
            << "=" << row.double_list(i).value() << ",";
    }
@@ -190,7 +194,7 @@ std::string DBManager::composeInsertQuery(std::string schema, std::string table,
    for(int i = 0; i<row.integer_list_size(); ++i)
    {
        keysStream << row.integer_list(i).key() << ",";
        valuesStream << row.integer_list(i).value() << ",";
        valuesStream << boost::lexical_cast<std::string>(row.integer_list(i).value()) << ",";
        keyValuesStream << row.integer_list(i).key()
            << "=" << row.integer_list(i).value() << ",";
    }
@@ -199,7 +203,7 @@ std::string DBManager::composeInsertQuery(std::string schema, std::string table,
    for(int i = 0; i<row.long_long_list_size(); ++i)
    {
        keysStream << row.long_long_list(i).key() << ",";
        valuesStream << row.long_long_list(i).value() << ",";
        valuesStream << boost::lexical_cast<std::string>(row.long_long_list(i).value()) << ",";
        keyValuesStream << row.long_long_list(i).key()
            << "=" << row.long_long_list(i).value() << ",";
    }
@@ -217,7 +221,7 @@ std::string DBManager::composeInsertQuery(std::string schema, std::string table,
    for(int i = 0; i<row.unsinged_long_list_size(); ++i)
    {
        keysStream << row.unsinged_long_list(i).key() << ",";
        valuesStream << row.unsinged_long_list(i).value() << ",";
        valuesStream << boost::lexical_cast<std::string>(row.unsinged_long_list(i).value()) << ",";
        keyValuesStream << row.unsinged_long_list(i).key()
            << "=" << row.unsinged_long_list(i).value() << ",";
    }