List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:October 16 2008 10:03pm
Subject:Re: SUBTIME
View as plain text  
Demetris Zavorotnichenko wrote:
> SELECT SUBTIME('2007-12-31 23:59:59.999999','1 1:1:1.000002')
> 
>  
> 
> So how would I get a result from this query ?

The MySQL manual says SUBTIME returns a value in the same form as the 
first parameter, which looks like DATETIME:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_subtime

> mysqlpp::SimpleResult res = query.execute();

No.  SimpleResult is for queries that return no value, like INSERT, 
CHANGE, DROP, ALTER....

I would use Query::store() for this:

	StoreQueryResult res = query.store();
	if (res) {
		DateTime dt = res[0][0];
		// do something with dt....
	}
Thread
SUBTIMEDemetris Zavorotnichenko16 Oct
  • Re: SUBTIMERick Gutleber16 Oct
  • Re: SUBTIMEWarren Young17 Oct