From: Mike Bayer Date: Fri, 27 Dec 2013 18:16:48 +0000 (-0500) Subject: - The "asdecimal" flag used with the :class:`.Float` type will now X-Git-Tag: rel_0_8_5~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5b84ae20d186fc82fcba453626fe33cce5ef96b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - The "asdecimal" flag used with the :class:`.Float` type will now work with Firebird dialects; previously the decimal conversion was not occurring. - scale back some firebird FP numeric tests Conflicts: test/requirements.py --- diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst index 6a9c5b1ba7..85716444ba 100644 --- a/doc/build/changelog/changelog_08.rst +++ b/doc/build/changelog/changelog_08.rst @@ -11,6 +11,14 @@ .. changelog:: :version: 0.8.5 + .. change:: + :tags: bug, firebird + :versions: 0.9.0b2 + + The "asdecimal" flag used with the :class:`.Float` type will now + work with Firebird dialects; previously the decimal conversion was + not occurring. + .. change:: :tags: bug, mssql, pymssql :versions: 0.9.0b2 diff --git a/lib/sqlalchemy/dialects/firebird/kinterbasdb.py b/lib/sqlalchemy/dialects/firebird/kinterbasdb.py index 9fdddfdb01..c9558cc6b3 100644 --- a/lib/sqlalchemy/dialects/firebird/kinterbasdb.py +++ b/lib/sqlalchemy/dialects/firebird/kinterbasdb.py @@ -42,7 +42,7 @@ from re import match import decimal -class _FBNumeric_kinterbasdb(sqltypes.Numeric): +class _kinterbasdb_numeric(object): def bind_processor(self, dialect): def process(value): if isinstance(value, decimal.Decimal): @@ -51,6 +51,12 @@ class _FBNumeric_kinterbasdb(sqltypes.Numeric): return value return process +class _FBNumeric_kinterbasdb(_kinterbasdb_numeric, sqltypes.Numeric): + pass + +class _FBFloat_kinterbasdb(_kinterbasdb_numeric, sqltypes.Float): + pass + class FBExecutionContext_kinterbasdb(FBExecutionContext): @property @@ -74,6 +80,7 @@ class FBDialect_kinterbasdb(FBDialect): FBDialect.colspecs, { sqltypes.Numeric: _FBNumeric_kinterbasdb, + sqltypes.Float: _FBFloat_kinterbasdb, } ) diff --git a/test/requirements.py b/test/requirements.py index 081ae0e091..7bf2c66414 100644 --- a/test/requirements.py +++ b/test/requirements.py @@ -548,6 +548,26 @@ class DefaultRequirements(SuiteRequirements): ] ) + @property + def precision_generic_float_type(self): + """target backend will return native floating point numbers with at + least seven decimal places when using the generic Float type.""" + + return fails_if([ + ('mysql', None, None, + 'mysql FLOAT type only returns 4 decimals'), + ('firebird', None, None, + "firebird FLOAT type isn't high precision"), + ]) + + @property + def floats_to_four_decimals(self): + return fails_if([ + ("mysql+oursql", None, None, "Floating point error"), + ("firebird", None, None, + "Firebird still has FP inaccuracy even " + "with only four decimal places") + ]) @property def python2(self):