From: Warren Young Date: July 13 2011 8:37pm Subject: Re: update fails... any suggestions? List-Archive: http://lists.mysql.com/plusplus/9397 Message-Id: <4E1E01FB.5070300@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 7/13/2011 2:04 PM, Jay Sprenkle wrote: > > mysqlpp::Query query = conn.query( "UPDATE customer SET > AccountName=%2q, Active=%3, Password=%1 WHERE CustomerId=%0" ); > query.parse(); > mysqlpp::SQLQueryParms parms; > ....noise noise noise... Why are you bothering with direct use of SQLQueryParms? This does the same thing, with less code: mysqlpp::SimpleResult res = query.execute( mysqlpp::sql_int(CustomerId), mysqlpp::sql_blob(data, sizeof(data)), ...etc...); > If I turn off exceptions for the connection it fails silently (the > result.info() method returns nothing). That just gets you "additional information". To check for errors, test res in bool context instead: if (res) { // query was successful } else { // FAIL } > if I turn exceptions on it seg faults here when trying to convert to a > string: You need to quote and escape BLOBs. Your binary password is being inserted into the query string raw, as-is. Consider using SSQLSes instead of template queries. It handles quoting and escaping for you automatically.