On May 23, 2010, at 7:10 PM, hu.ruyu@stripped wrote:
> mysqlpp::SQLQueryParms sqp;
> mysqlpp::sql_int sqlint = 5
> sqp = sqlint; // throw mysqlpp::Exception here
> sqp = mysqlpp::SQLTypeAdapter(string("test5"));
> mysqlpp::UseQueryResult res = query.use(sqp);
Do you have a good reason to build the template query this way? Those six lines can be
replaced with one:
UseQueryResult res = query.use(5, "test5");
It's less verbose to pass the parameters into the query execution function (store*(),
use(), exec*()...) instead of building a SQLQueryParms object each time.
If that still causes an exception, I'd guess it's because you're saying "%0q" for the
integer parameter, which doesn't have to be quoted. Say "%0" instead.