summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-06-28 11:49:41 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-06-28 11:49:41 -0400
commitbccf8ff5b1b17fd093308b40e726051256ec14ae (patch)
tree380cbfc245484b4c2a48519e5ba91316e30e5f1c
parent04b66bc5e7b8e8e93d78e9c70a533cd39e367aaf (diff)
downloadsqlalchemy-bccf8ff5b1b17fd093308b40e726051256ec14ae.tar.gz
Type lookup when reflecting the Firebird types LONG and
INT64 has been fixed so that LONG is treated as INTEGER, INT64 treated as BIGINT, unless the type has a "precision" in which case it's treated as NUMERIC. Patch courtesy Russell Stuart. [ticket:2757]
-rw-r--r--doc/build/changelog/changelog_08.rst10
-rw-r--r--doc/build/changelog/changelog_09.rst10
-rw-r--r--lib/sqlalchemy/dialects/firebird/base.py13
3 files changed, 26 insertions, 7 deletions
diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst
index 625b72c0b..79f2ce738 100644
--- a/doc/build/changelog/changelog_08.rst
+++ b/doc/build/changelog/changelog_08.rst
@@ -7,6 +7,16 @@
:version: 0.8.2
.. change::
+ :tags: bug, firebird
+ :tickets: 2757
+
+ Type lookup when reflecting the Firebird types LONG and
+ INT64 has been fixed so that LONG is treated as INTEGER,
+ INT64 treated as BIGINT, unless the type has a "precision"
+ in which case it's treated as NUMERIC. Patch courtesy
+ Russell Stuart.
+
+ .. change::
:tags: bug, postgresql
:tickets: 2766
diff --git a/doc/build/changelog/changelog_09.rst b/doc/build/changelog/changelog_09.rst
index 85fd69d8d..905132736 100644
--- a/doc/build/changelog/changelog_09.rst
+++ b/doc/build/changelog/changelog_09.rst
@@ -7,6 +7,16 @@
:version: 0.9.0
.. change::
+ :tags: bug, firebird
+ :tickets: 2757
+
+ Type lookup when reflecting the Firebird types LONG and
+ INT64 has been fixed so that LONG is treated as INTEGER,
+ INT64 treated as BIGINT, unless the type has a "precision"
+ in which case it's treated as NUMERIC. Patch courtesy
+ Russell Stuart. Also in 0.8.2.
+
+ .. change::
:tags: bug, postgresql
:tickets: 2766
diff --git a/lib/sqlalchemy/dialects/firebird/base.py b/lib/sqlalchemy/dialects/firebird/base.py
index bb60a591e..ab832178e 100644
--- a/lib/sqlalchemy/dialects/firebird/base.py
+++ b/lib/sqlalchemy/dialects/firebird/base.py
@@ -78,9 +78,8 @@ from sqlalchemy.engine import base, default, reflection
from sqlalchemy.sql import compiler
-from sqlalchemy.types import (BIGINT, BLOB, BOOLEAN, DATE,
- FLOAT, INTEGER, NUMERIC, SMALLINT,
- TEXT, TIME, TIMESTAMP)
+from sqlalchemy.types import (BIGINT, BLOB, DATE, FLOAT, INTEGER, NUMERIC,
+ SMALLINT, TEXT, TIME, TIMESTAMP, Integer)
RESERVED_WORDS = set([
@@ -162,13 +161,13 @@ colspecs = {
ischema_names = {
'SHORT': SMALLINT,
- 'LONG': BIGINT,
+ 'LONG': INTEGER,
'QUAD': FLOAT,
'FLOAT': FLOAT,
'DATE': DATE,
'TIME': TIME,
'TEXT': TEXT,
- 'INT64': NUMERIC,
+ 'INT64': BIGINT,
'DOUBLE': FLOAT,
'TIMESTAMP': TIMESTAMP,
'VARYING': VARCHAR,
@@ -593,8 +592,8 @@ class FBDialect(default.DefaultDialect):
util.warn("Did not recognize type '%s' of column '%s'" %
(colspec, name))
coltype = sqltypes.NULLTYPE
- elif colspec == 'INT64':
- coltype = coltype(
+ elif issubclass(coltype, Integer) and row['fprec'] != 0:
+ coltype = NUMERIC(
precision=row['fprec'],
scale=row['fscale'] * -1)
elif colspec in ('VARYING', 'CSTRING'):