58 std::stringstream valueToQuery;
59 valueToQuery <<
"\"" << value <<
"\"";
60 it->second = valueToQuery.str();
64 std::cerr <<
"This field does not exist!!!" << std::endl;
73 std::stringstream ListValues;
78 ListValues << iter->second <<
", ";
80 size_t n = ListValues.str().length() - 2;
81 return ListValues.str().substr(0, n);
89 std::stringstream ListColumnNames;
95 ListColumnNames << iter->first <<
", ";
97 size_t n = ListColumnNames.str().length() - 2;
98 return ListColumnNames.str().substr(0, n);
105 std::stringstream StringQuery;
111 StringQuery << iter->first;
112 StringQuery <<
" = ";
113 StringQuery << iter->second;
116 size_t n = StringQuery.str().length() - 2;
117 return StringQuery.str().substr(0, n);
125 std::vector< std::string > VectorColumnNames;
130 VectorColumnNames.push_back(iter->first);
132 return VectorColumnNames;
176 std::string oMapValue =
"noValue";
186 oMapValue = iter->second;
193 std::string CharacterToCompare = oMapValue.substr(0, 1);
196 if ( CharacterToCompare ==
"\"" )
199 oMapValue = oMapValue.substr(1, oMapValue.size() - 2);
210 vtkMySQLDatabase *iDatabaseConnector)
212 std::vector< std::string > ResultQuery =
217 if ( ResultQuery.empty() )
222 if ( this->
m_MapRow.size() != ResultQuery.size() )
224 std::cout <<
"pb the map and the query results are not the same size";
225 std::cout <<
"Debug: In " << __FILE__ <<
", line " << __LINE__;
226 std::cout << std::endl;
230 std::vector< std::string >::iterator iterResultQuery =
235 while ( iterMap != this->
MapEnd() )
237 iterMap->second = *iterResultQuery;
264 const std::string& iNameOfField, std::vector< FieldWithValue > & ioFieldWithValue)
268 ioFieldWithValue.push_back(temp);
274 vtkMySQLDatabase *iDatabaseConnector)
StringMapConstIterator ConstMapBegin()
void DeleteFromDB(vtkMySQLDatabase *iDatabaseConnector)
delete from the database the row which has the same TableID
std::string m_TableIDName
std::string PrintColumnNamesWithValues()
put all the keys and values of the map in a string as map[key] = value separated by '...
std::string GetTableIDName()
StringMapIterator MapBegin()
virtual bool SetValuesForSpecificID(int ID, vtkMySQLDatabase *iDatabaseConnector)
get the data from the database corresponding to the specific ID and put them in the map ...
StringMapIterator MapEnd()
std::string PrintColumnNames()
put all the keys of the map in a string separated by ','
StringMapType::const_iterator StringMapConstIterator
std::vector< std::string > ListSpecificValuesForOneColumn(vtkMySQLDatabase *iDatabaseConnector, const std::string &TableName, const std::string &ColumnName, const std::string &field, const std::string &value, bool ExcludeZero)
SELECT ColumnName FROM TableName WHERE field = value and ColumnName <> 0 (if excludezero) ...
StringMapConstIterator ConstMapEnd()
std::string GetTableName()
StringMapType::iterator StringMapIterator
std::vector< std::string > GetVectorColumnNames()
put all the keys of the map in a vector
void SetField(const std::string &key, const T &value)
convert the value into a string and assign it to the key in the map
void DeleteRow(vtkMySQLDatabase *DatabaseConnector, std::string TableName, std::string field, std::string value)
void AddConditions(const std::string &iNameOfField, std::vector< FieldWithValue > &ioFieldWithValue)
add as an element of ioFieldWithValue the name and value of the map with the key iNameOfField ...
std::string GetMapValue(const std::string &key)
return the value for the field map[key] after having removed the " at the beginning and at the end of...
std::string PrintValues()
put all the values of the map in a string separated by ','