|
|||||||||||
|
Re: Weird parsing of templated query
From: roberto previdi <hariseldon78(at)yahoo.it>
Date: Mon Jul 16 2007 - 13:16:25 EDT
mysqlpp::Query q(TheDb::Instance().getConnection()); q <<"select * from `Mob` where %0:dummy and objectId= %1:objectId ;";
q.parse();
q.def["dummy"]=1;
q.def["objectId"]=3;
mysqlpp::SQLQueryParms parms(&q); parms["dummy"]=1; parms["objectId"]=4; mysqlpp::Result result; cout << q.preview()<<endl; result = q.store(parms); cout << result.at(0)["objectId"]; output: select * from `Mob` where 1 and objectId= 3 ; 4
yeah, it works!!!
I will just keep care to remove the "where %0:dummy " when there are no fields to put in the where condition. roby
roberto previdi wrote:
Single parameter queries don't work right with the SQLQueryParms mechanism. This has been discussed again and again and again and again on this list, and it's even documented. You can use the %1 workaround, or the Query streams interface. -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=hariseldon78@yahoo.it ____________________________________________________________________________________ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=lists@pantek.comReceived on Mon Jul 16 13:16:45 2007 This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:28:31 EDT |
||||||||||
|
|||||||||||