From: Warren Young Date: December 26 2007 10:11pm Subject: Re: Troubles wit DECIMAL(12,4) List-Archive: http://lists.mysql.com/plusplus/7304 Message-Id: <4772D1A2.7060809@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Bart Verstraete wrote: > > mysqlpp::longlong id = (mysqlpp::longlong)row["id"]; The casts aren't necessary. Or if they are, it means the implicit conversion rules aren't working, which would be a bug. > double total = (double)row["total"] //Throws an exception: Tried to > convert "6.3000" to a "d In that case, many of the examples should be showing the same symptom, because they do essentially this same thing. It works fine here on my main GCC/Linux development system. So, try the examples. If they fail there, I think the problem may be that your compiler isn't smart enough to create ColData::conv(double) and so is falling back to the default definition of conv() which only works for things that look sufficiently like integers. We'll need to know your compiler and platform to be able to test any fix that may be required. If the examples work but your program doesn't, you've got something very weird going on. Once you sort all this out, consider using mysqlpp::sql_decimal instead of double. They're typedef'd to the same thing, but may not be forever. This type is a good candidate for a specialized replacement because DECIMAL is a fixed-point type, so double isn't the best match. We really should have something in the mold of mysqlpp::tiny_int here.