Hello,

François Hervieux wrote:

> This is great thank you very much! I noticed a small problem though : 
> Postgresql allows the time values to contain fractional seconds (like 
> 12:45:05.6585 for example) and SOCI throws a soci::soci_error upon such 
> values (what():  Cannot convert data to std::tm). I know a std::tm 
> structure cannot store such values but would it be possible to just 
> truncate it and discard the fractional part ?

Done. Please update from the source repository.

> I had another problem when I tried to insert data into this "time" 
> column and I think it's related to this one. I want to insert data from 
> a std::tm in which the date part is set to 0 (year, month, day) and I 
> get an error (what():  ERROR:  date/time field value out of range: 
> "1900-01-00 12:45:00"). I may be wrong about that as this is an error 
> from Postgresql and not SOCI but I find it weird to get this kind of 
> error while inserting a time value.

Try to set the day component (tm_mday) to 1 instead of 0 - there was no 
January 0th that year. :-)

The problem is that the full std::tm value is transmitted to the 
database before it has a chance to ignore the data part. It has to be 
correct for the type cast to succeed.

Regards,

-- 
Maciej Sobczak * www.msobczak.com * www.inspirel.com

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to