List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:May 24 2010 4:48am
Subject:Re: About "Failed to find MySQL C API type ID for" Exception
View as plain text  
On May 23, 2010, at 7:10 PM, hu.ruyu@stripped wrote:

>                        mysqlpp::SQLQueryParms sqp;
>                        sqp.resize(2);
>                        mysqlpp::sql_int sqlint = 5
>                        sqp[0] = sqlint;  // throw mysqlpp::Exception here
>                        sqp[1] = 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.
Thread
About "Failed to find MySQL C API type ID for" Exceptionhu.ruyu24 May
  • Re: About "Failed to find MySQL C API type ID for" ExceptionWarren Young24 May