]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Added BigInteger to global imports
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Oct 2009 21:23:45 +0000 (21:23 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 15 Oct 2009 21:23:45 +0000 (21:23 +0000)
- Oracle compiles BigInteger into NUMBER(19), finishes [ticket:1125]

CHANGES
lib/sqlalchemy/__init__.py
lib/sqlalchemy/dialects/informix/base.py
lib/sqlalchemy/dialects/oracle/base.py
lib/sqlalchemy/types.py

diff --git a/CHANGES b/CHANGES
index 0db98ae60dbe156a55030bbb750d188c73785bb5..583e56009c4452882035b3554d51b8f158e25930 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -388,7 +388,10 @@ CHANGES
 
     - using new dialect.initialize() feature to set up
       version-dependent behavior.
-
+    
+    - using types.BigInteger with Oracle will generate
+      NUMBER(19) [ticket:1125]
+      
 - firebird
     - the keys() method of RowProxy() now returns the result
       column names *normalized* to be SQLAlchemy case
@@ -463,7 +466,10 @@ CHANGES
 
     - AbstractType.get_search_list() is removed - the games
       that was used for are no longer necessary.
-
+    
+    - Added a generic BigInteger type, compiles to 
+      BIGINT or NUMBER(19). [ticket:1125]
+      
 0.5.7
 =====
 - orm
index 31469ee5ae45e186334aa1291948e59326e030fb..545214fcd4375cc7d799bb0e73ac03982b42b48f 100644 (file)
@@ -50,6 +50,7 @@ from sqlalchemy.sql import (
 from sqlalchemy.types import (
     BLOB,
     BOOLEAN,
+    BigInteger,
     Binary,
     Boolean,
     CHAR,
index a0ba292698e0dfd6806e1f2a16c6ed00ec80293e..bc48e6aa5700d10df3537fc2acba05b748febf42 100644 (file)
@@ -7,8 +7,11 @@
 # the MIT License: http://www.opensource.org/licenses/mit-license.php
 """Support for the Informix database.
 
+This dialect is *not* ported to SQLAlchemy 0.6.
+
 This dialect is *not* tested on SQLAlchemy 0.6.
 
+
 """
 
 
index 4f37412ebdcc5e4b0a1a774252035150354d4ea5..8af28c8e53f6b3f7c02b413f5edd224fb5cd9a68 100644 (file)
@@ -132,7 +132,6 @@ class NCLOB(sqltypes.Text):
 VARCHAR2 = VARCHAR
 NVARCHAR2 = NVARCHAR
 
-
 class NUMBER(sqltypes.Numeric, sqltypes.Integer):
     __visit_name__ = 'NUMBER'
     
@@ -220,16 +219,22 @@ class OracleTypeCompiler(compiler.GenericTypeCompiler):
     def visit_DOUBLE_PRECISION(self, type_):
         return self._generate_numeric(type_, "DOUBLE PRECISION")
         
-    def visit_NUMBER(self, type_):
-        return self._generate_numeric(type_, "NUMBER")
+    def visit_NUMBER(self, type_, **kw):
+        return self._generate_numeric(type_, "NUMBER", **kw)
     
-    def _generate_numeric(self, type_, name):
-        if type_.precision is None:
+    def _generate_numeric(self, type_, name, precision=None, scale=None):
+        if precision is None:
+            precision = type_.precision
+            
+        if scale is None:
+            scale = getattr(type_, 'scale', None)
+            
+        if precision is None:
             return name
-        elif type_.scale is None:
-            return "%(name)s(%(precision)s)" % {'name':name,'precision': type_.precision}
+        elif scale is None:
+            return "%(name)s(%(precision)s)" % {'name':name,'precision': precision}
         else:
-            return "%(name)s(%(precision)s, %(scale)s)" % {'name':name,'precision': type_.precision, 'scale' : type_.scale}
+            return "%(name)s(%(precision)s, %(scale)s)" % {'name':name,'precision': precision, 'scale' : scale}
         
     def visit_VARCHAR(self, type_):
         return "VARCHAR(%(length)s)" % {'length' : type_.length}
@@ -245,7 +250,10 @@ class OracleTypeCompiler(compiler.GenericTypeCompiler):
 
     def visit_binary(self, type_):
         return self.visit_BLOB(type_)
-    
+
+    def visit_big_integer(self, type_):
+        return self.visit_NUMBER(type_, precision=19)
+        
     def visit_boolean(self, type_):
         return self.visit_SMALLINT(type_)
     
index cdd5439db8f474a39a6f7e5a773bc6d073473ea4..9fa59600fc4ebbbd815616530722ad7ce9d1b00a 100644 (file)
@@ -15,7 +15,7 @@ __all__ = [ 'TypeEngine', 'TypeDecorator', 'AbstractType', 'UserDefinedType',
             'INT', 'CHAR', 'VARCHAR', 'NCHAR', 'NVARCHAR','TEXT', 'Text', 'FLOAT',
             'NUMERIC', 'DECIMAL', 'TIMESTAMP', 'DATETIME', 'CLOB', 'BLOB',
             'BOOLEAN', 'SMALLINT', 'INTEGER', 'DATE', 'TIME',
-            'String', 'Integer', 'SmallInteger',
+            'String', 'Integer', 'SmallInteger', 'BigInteger', 
             'Numeric', 'Float', 'DateTime', 'Date', 'Time', 'Binary',
             'Boolean', 'Unicode', 'MutableType', 'Concatenable', 'UnicodeText', 'PickleType', 'Interval',
             'type_map'