This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients dlesco, rhettinger
Date 2009-03-09.11:30:07
SpamBayes Score 6.4375587e-07
Marked as misclassified No
Message-id <1236598210.46.0.807950706921.issue5448@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-03-09 11:30:11rhettingersetrecipients: + rhettinger, dlesco
2009-03-09 11:30:10rhettingersetmessageid: <1236598210.46.0.807950706921.issue5448@psf.upfronthosting.co.za>
2009-03-09 11:30:08rhettingerlinkissue5448 messages
2009-03-09 11:30:07rhettingercreate