This (simplified) example shows case when cppdb stores random data in MySQL:
cppdb::session ses;
ses << "INSERT INTO stats(ip, referer) VALUES(?, ?)"
<< app.request().remote_addr()
<< app.request().http_referer()
<< cppdb::exec;
The reason is that cppdb only stores references to passed string. It does not create internal copies. In this examples values returned by remote_addr() and http_referer() are temporal string that disappear before the statement is executed; Internal cppdb reference references in this case some random memory in allocator and random data is stored in a database.
This behavior is highly unexpected and has generated multiple issues for me.
Anonymous