Commit b959d66c authored by Marco De Marco's avatar Marco De Marco
Browse files

Temporary workaround to on duplicate key update error

parent 933aa694
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -250,10 +250,22 @@ std::string DBManager::composeInsertQuery(std::string schema, std::string table,
    if(keyValues.at(keyValues.size()-1)==',')
        keyValues.erase(keyValues.size()-1);

    /*
     * 2015/03/17 error: maybe an erroneus return value from mysql in function (retrieveLastTimestamp)
     * triggered an update of all metadata tables simultaneously. Still under investigation.
     * Skip storage_path and file_path to null will not wait file to be downloaded after a metadata update.
     * This is temporary workaraound and exclude admin console to work properly.
     *
    stringstream query;
    query << "INSERT INTO " << schema << "." << table
        << " (" << keys << ") VALUES (" << values << ") "
        << " ON DUPLICATE KEY UPDATE storage_path=NULL, file_path=NULL, " << keyValues;
    */

    stringstream query;
    query << "INSERT INTO " << schema << "." << table
    << " (" << keys << ") VALUES (" << values << ") "
    << " ON DUPLICATE KEY UPDATE " << keyValues;

    #ifdef VERBOSE_DEBUG
        INFO_STREAM << "DBManager::composeInsertQuery() " << query.str() << endl;