List:MySQL++« Previous MessageNext Message »
From:David Maple Date:February 16 2005 6:47pm
Subject:Problem with Template Queries (MySQL++1.7.28)
View as plain text  
Hi All,

I'm trying to use a template query and it's not working.  Here's the
query and relevant statements:

-- SNIP --
string sqlQuerySrc = "SELECT ip_src,SUM(bytes) AS src_bytes "
	"FROM acct_v2 WHERE ip_src!='' "
	"AND stamp_inserted=%q0:stamp "
	"GROUP BY ip_src";

mysqlpp::Query queryGetSrc = con.query();
queryGetSrc << sqlQuerySrc;

// the stamp_inserted below is from another query that is working
string stampInserted = 
mysqlpp::Result resGetSrc =;
-- SNIP --

This compiles fine, but I get this error back from MySQL:

Error: You have an error in your SQL syntax near '%q0:stamp GROUP BY
ip_src' at line 1

As far as I can tell, this is the correct way to use template queries
according to the docs that came with the distribution.  However, the
docs are ~4 years old.

Can anyone tell me what I'm doing wrong?

Thanks in advance,


Problem with Template Queries (MySQL++1.7.28)David Maple16 Feb
  • Re: Problem with Template Queries (MySQL++1.7.28)David Maple16 Feb