I have looked at this until I'm blue. I need fresh eyes:
Code:
string cameraId;
string tms;
try {
mysqlpp::Connection con (cDBName.c_str (), countryIp.c_str (),
cUsrName.c_str (), cUsrPass.c_str ());
Query query = con.query ();
string sql = "update cameras set last_image = %0q: where camera_id =
%1:";
query << sql;
cameraId = node->cameraID;
tms = node->datetime;
string sqld = "update cameras set last_image = "+tms+" where camera_id =
"+cameraId;
cout <<sqld<<endl;
SimpleResult reslt = query.execute (tms,cameraId);
}
catch (const mysqlpp::Exception & er)
{
cout<< "Mysql error: "<<er.what()<<" for camera
"<<cameraId<<" and date "<<tms<<endl;
}
Output looks like:
update cameras set last_image = 2013-01-26 22:07:12 where camera_id = 57
Mysql error: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '%0q: where camera_id = %1:'
at line 1 for camera 57 and date 2013-01-26 22:07:12
The update as printed (with inclusion of the ' delimiters around the
date) works fine in mysql.
Thanks,
Jim.