Re: Weird parsing of templated query
I tried this:
try
{
mysqlpp::Query q(TheDb::Instance().getConnection());
q <<"select * from `Mob` where objectId=%0:objectId";
q.parse();
mysqlpp::SQLQueryParms parms(&q);
parms["objectId"]=4;
mysqlpp::Result result;
result = q.store(parms);
[...]
}
catch(exception &e)
{
cout << string(e.what())<< endl;
}
but i get this exception:
std::exception: 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 'select * from `Mob` where objectId=4' at line 1
So the substitution is working correctly (yeah!) but something is still not correct..
If i try that query in mysql it works perfectly.. Maybe i don't catch correctly the exception?
roby
- Original Message ----
From: Steven Van Ingelgem <s.vaningelgem@gmail.com>
To: plusplus@lists.mysql.com
Sent: Monday, July 16, 2007 4:37:43 PM
Subject: Re: Weird parsing of templated query
Ok!
I'll try that :-).
Thanks!
On 7/16/07, Warren Young <mysqlpp@etr-usa.com> wrote:
> > Steven Van Ingelgem wrote: > > It would be ok however if I could pass a vector<SQLString>. But not > > entirely > > happy with it... Because I would like to use also named templated > values. > > And what if I want to bind parameters not in a logical order? > > I've got it: you want to call the execute(SQLQueryParams&) et al. > overloads. They're not documented, but they're trivial; just look at > them in lib/query.cpp. > > They're removed right now in svn, but I can see that we're just trying > to reinvent the need for them. I guess I'll just put them back. > Meanwhile, use them in good health. > > > Maybe you could add some feature for MySQL 5+ (prepared statements are > > possible from then right?) where you could build a prepared statement? > > This is orthogonal to the current discussion. It's already on the > Wishlist, but even if it existed now, it wouldn't solve your problem. > > -- > MySQL++ Mailing List > For list archives: http://lists.mysql.com/plusplus > To unsubscribe: > http://lists.mysql.com/plusplus?unsub=steven@vaningelgem.be > >
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
--
MySQL++ Mailing List
For list archives:
http://lists.mysql.com/plusplus
To unsubscribe:
http://lists.mysql.com/plusplus?unsub=lists@pantek.com
Received on Mon Jul 16 11:02:41 2007
This archive was generated by hypermail 2.1.8
: Thu Aug 09 2007 - 19:28:31 EDT
|