lundi 2 juillet 2018

create/mock a mysql ResultSet in C++11

I have a simple class Message that take the data from a MySQL table (version, message, type).

Message(sql::ResultSet &rs)
{
  version_ = rs.getInt("version");
  message_ = rs.getString("message");
  message_type_id_ = rs.getInt("message_type_id"); 
}

I would like to ask if there is a way to mock the creation of the ResultSet in C++11 and above.

Or even simpler if it is possible using C++ code to create and populate the result set. Eg

auto mset = sql::ResultSet(1, "hello", 1);

Aucun commentaire:

Enregistrer un commentaire