GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Loss of scale when reading numeric with zero value · Issue #53 · FirebirdSQL/python3-driver Closed DescriptionHello! When reading a numeric column with zero value the scale of the numeric value is not preserved: import firebird.driver as firebird import decimal con = firebird.connect('employee') cur = con.cursor() cur.execute("select cast('0.00' as NUMERIC(9,2)) from rdb$database") val_from_db = cur.fetchone()[0] val_from_py = decimal.Decimal('0.00') val_from_db_str = format(val_from_db, 'f') val_from_py_str = format(val_from_py, 'f') print(val_from_db_str) print(val_from_py_str) assert val_from_db_str == val_from_py_str cur.close() con.close() Output: While investigating the issue I found that a python import decimal print(format(decimal.Decimal('0') / 1000, 'f')) Output: but if the zero value is scaled using the builtin import decimal print(format(decimal.Decimal('0').scaleb(-3), 'f')) Output: Regards, Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |