dbTalk Databases Forums  

Problem with Template Queries (MySQL++1.7.28)

mailing.database.mysql-plusplus mailing.database.mysql-plusplus


Discuss Problem with Template Queries (MySQL++1.7.28) in the mailing.database.mysql-plusplus forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Maple
 
Posts: n/a

Default Problem with Template Queries (MySQL++1.7.28) - 02-16-2005 , 12:46 PM






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!='0.0.0.0' "
"AND stamp_inserted=%q0:stamp "
"GROUP BY ip_src";

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

// the stamp_inserted below is from another query that is working
string stampInserted =
rowGetStamps.lookup_by_name("stamp_inserted").c_st r;
mysqlpp::Result resGetSrc = queryGetSrc.store(stampInserted);
-- 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,

Dave



--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
David Maple
 
Posts: n/a

Default Re: Problem with Template Queries (MySQL++1.7.28) - 02-16-2005 , 01:17 PM






Sorry, I found it... it's '%0q' not '%q0'

Thanks

On Wed, 2005-02-16 at 13:47 -0500, David Maple wrote:
Quote:
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!='0.0.0.0' "
"AND stamp_inserted=%q0:stamp "
"GROUP BY ip_src";

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

// the stamp_inserted below is from another query that is working
string stampInserted =
rowGetStamps.lookup_by_name("stamp_inserted").c_st r;
mysqlpp::Result resGetSrc = queryGetSrc.store(stampInserted);
-- 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,

Dave



--
Dave Maple
Senior Network Engineer
GMTI, Foundation Engineering
(757)624-2471
david.maple (AT) corp (DOT) infi.net


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsu...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.