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@stripped>
To: plusplus@stripped
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@stripped> 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=1
>
>
____________________________________________________________________________________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/