MySQL Forums
Forum List  »  Connector/C++

Re: Selecting a date column
Posted by: Brian Pontarelli
Date: September 25, 2009 10:43AM


you can fetch the date using getString. Connector/C++ doesn't have Date/Time support, still. We decided to postpone it and the plans are to add, at later stage, Datetime support by using Boost::Datetime library.

Using any type of String requires date parsing. I'm assuming that the C++ API doesn't provide any type of date parsing, which makes comparisons on the returned values really difficult. Therefore, using getString is not really a viable solution at all.

As long as you add the Boost dependency cleanly it could work nicely. I'd just be careful of not forcing users of the C++ API to pull in too much of Boost.

So, it seems that I'll need to hack up my SQL 99 compliant selects to be MySQL specific in the short term. I really don't understand why you didn't just return date columns as seconds since epoch UTC using unsigned ints. This seems the best method and most C++ libraries support this concept. The API would look like this:

unsigned int date = resultSet->getDate();

Then you could do comparisons and math on the values.

Options: ReplyQuote

Written By
September 24, 2009 08:31PM
September 25, 2009 09:46AM
Re: Selecting a date column
September 25, 2009 10:43AM
September 28, 2009 01:04AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.