]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Type lookup when reflecting the Firebird types LONG and
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Jun 2013 15:49:41 +0000 (11:49 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Jun 2013 15:50:27 +0000 (11:50 -0400)
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]

Conflicts:
doc/build/changelog/changelog_09.rst

doc/build/changelog/changelog_08.rst
lib/sqlalchemy/dialects/firebird/base.py

index 625b72c0b7841345e05551fcd71d5b995efab1b3..79f2ce738116bc2d58067ae3d48733ef8ff5ef48 100644 (file)
@@ -6,6 +6,16 @@
 .. changelog::
     :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
index 95196f44c40f52fc71c61692768db1842e5a86ea..682d20985513d87e2f82224a6e82b076b4a87b21 100644 (file)
@@ -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'):