On Wednesday 13 February 2008 17:24:51 Oleg Broytmann wrote:
>    Couldn't we get an incorrect result trying to compare right-padding
> "009.11" and "2112.123456789"? I.e., could we rely solely on the size, not
> counting the number of digits in fraction?

Is there a case where ORDER BY would operate on quantities with different 
size/precision parameters?

If you're always doing ORDER BY a single column with a fixed size/precision, 
then the case above (for size=13, precision=9) would actually be
"0009.110000000" and "2112.123456789"; I think all strings of that format 
should sort the same way as the numbers they represent.

Actually you'd need some special handling for negative numbers.  So you'd need 
to make the padded width size+2, and make sure that the dash for the negative 
sign stayed in front of the zero-padding.  You couldn't just use 
str.rjust(size+2, '0') on a negative decimal.  But this isn't very 
complicated logic.

cs

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to