Message83369
FWIW, there is a public API to get at the same information:
Decimal.as_tuple().
That being said, I don't see how your len(value._int) test could be
correct. The exponent will potentially shift the value way
out-of-bounds for a database. Consider Decimal('999E+10') or
Decimal('999E-10') whose database storage sizes do not fit in a
DECIMAL(7,4) field eventhough their len(value._int) is three.
To see if the fractional part of a decimal number fits in a database,
set the context precision to the database precision and quantize the
decimal to the allowed number of decimal places. If the Inexact flag
gets set, then it didn't fit.
-1 on extending the API any further from the underlying IBM specification. |
|
Date |
User |
Action |
Args |
2009-03-09 11:30:11 | rhettinger | set | recipients:
+ rhettinger, dlesco |
2009-03-09 11:30:10 | rhettinger | set | messageid: <1236598210.46.0.807950706921.issue5448@psf.upfronthosting.co.za> |
2009-03-09 11:30:08 | rhettinger | link | issue5448 messages |
2009-03-09 11:30:07 | rhettinger | create | |
|