diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-12-27 13:16:48 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-12-27 13:41:46 -0500 |
commit | b5b84ae20d186fc82fcba453626fe33cce5ef96b (patch) | |
tree | 521d409b9b60d489bdd1a9b4c3c74638da39d895 | |
parent | 2900b6e4ece23be4fe9e1479a23155094798e601 (diff) | |
download | sqlalchemy-b5b84ae20d186fc82fcba453626fe33cce5ef96b.tar.gz |
- 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
-rw-r--r-- | doc/build/changelog/changelog_08.rst | 8 | ||||
-rw-r--r-- | lib/sqlalchemy/dialects/firebird/kinterbasdb.py | 9 | ||||
-rw-r--r-- | test/requirements.py | 20 |
3 files changed, 36 insertions, 1 deletions
diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst index 6a9c5b1ba..85716444b 100644 --- a/doc/build/changelog/changelog_08.rst +++ b/doc/build/changelog/changelog_08.rst @@ -12,6 +12,14 @@ :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 :pullreq: github:51 diff --git a/lib/sqlalchemy/dialects/firebird/kinterbasdb.py b/lib/sqlalchemy/dialects/firebird/kinterbasdb.py index 9fdddfdb0..c9558cc6b 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 081ae0e09..7bf2c6641 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): |