| List: | MySQL++ | « Previous MessageNext Message » | |
| From: | Jonathan Wakely | Date: | January 22 2008 12:34am |
| Subject: | Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 from a DECIMAL | ||
| View as plain text | |||
On 21/01/2008, Jonathan Wakely <mysql@stripped> wrote: > > That would get rid of the conv_promotion and proxy templates > completely and would also allow better names that typeid() provides on > some compilers. P.S. another benefit of the iostream version is that it would be easier to change the types used for the conversions in some future version. The C library doesn't offer strtoui or strtouc for unsigned ints or chars, so it would be difficult to detect overflow of e.g. "257" -> char using the C library functions. Using do_conv from the patch, you could easily add a String::checked_conv() member function, which would pass the unpromoted type directly to do_conv and have the stringstream do range checking. No changes would be needed to do_conv to make that work. It would be considerably harder to add a checked_conv() using the C strtoX functions :-) If any of the stream code in do_conv isn't obvious please ask and I'll explain what's checked for and what isn't. I've just noticed that I think the stream version would reject "1." -> int, which the current code accepts. That can be fixed by adding c = '0'; just before the while loop, so that "1." is treated the same as "1.0" Jon
| Thread | ||
|---|---|---|
| • Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 froma DECIMAL | Bart Verstraete | 20 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 froma DECIMAL | Warren Young | 21 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 from a DECIMAL | Jonathan Wakely | 21 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 froma DECIMAL | Warren Young | 21 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 from a DECIMAL | Jonathan Wakely | 22 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 from a DECIMAL | Jonathan Wakely | 22 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 froma DECIMAL | Warren Young | 24 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 from a DECIMAL | Jonathan Wakely | 26 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 froma DECIMAL | Warren Young | 28 Jan |
| • Re: Still gettiing a BadConversion thrown with mySQL++ 3.0 RC1 from a DECIMAL | Jonathan Wakely | 29 Jan |
