Hi All, Ive tried to overload the operator described in http://www.tntnet.org/howto/tntdb.html at the part Using own types, so that I can write a std::set<std::string> in a mysql Database. Therefore I implemented this:
void operator <<(tntdb::Hostvar& hv, const std::set<std::string>& lists) {
std::ostringstream s;
for(auto element: lists) {
s << element << ";";
}
hv.set(s.str());
}
This should define how a set should be written in the Database. Ive tested
it with this example:
std::set<std::string> foobar ={"FOO","BAR"};
tntdb::Statement result = DB->connection.prepare(
"CREATE TABLE IF NOT EXISTS foo(bar TEXT)");
result.execute();
result = DB->connection.prepare(
"INSERT INTO foo(bar) values (:bar)");
result.set("bar",foobar);
result.execute();
So after this the table in the Database should look like :
+-------------+
| bar |
+-------------+
| FOO;BAR; |
+-------------+
But the database entry looks like:
+-------------+
| bar |
+-------------+
| NULL |
+-------------+
Can somebody reproduce this misbehaviour?
Kind regards,
Matthias Kraß
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------------ Don't Limit Your Business. Reach for the Cloud. GigeNET's Cloud Solutions provide you with the tools and support that you need to offload your IT needs and focus on growing your business. Configured For All Businesses. Start Your Cloud Today. https://www.gigenetcloud.com/
_______________________________________________ Tntnet-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tntnet-general
