]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Couple more corrections to get mssql tests to pass.
authorMichael Trier <mtrier@gmail.com>
Fri, 30 Jan 2009 04:28:35 +0000 (04:28 +0000)
committerMichael Trier <mtrier@gmail.com>
Fri, 30 Jan 2009 04:28:35 +0000 (04:28 +0000)
lib/sqlalchemy/dialects/mssql/base.py
test/ext/compiler.py

index 5398149c4da717b122e93dceac39dbc1a1cf7ff0..bbde62bbac8d2797d6a6262eabaac9dab6cf3484 100644 (file)
@@ -1184,14 +1184,14 @@ class MSDialect(default.DefaultDialect):
                 if coltype == MSText or (coltype in (MSString, MSNVarchar) and charlen == -1):
                     kwargs.pop('length')
 
-            if issubclass(coltype, sqltypes.Numeric):
-                kwargs['scale'] = numericscale
-                kwargs['precision'] = numericprec
-
             if coltype is None:
                 util.warn("Did not recognize type '%s' of column '%s'" % (type, name))
                 coltype = sqltypes.NULLTYPE
 
+            if issubclass(coltype, sqltypes.Numeric) and coltype is not MSReal:
+                kwargs['scale'] = numericscale
+                kwargs['precision'] = numericprec
+
             coltype = coltype(**kwargs)
             colargs = []
             if default is not None:
index 0d1d220abf17ac55b24ef11313f7e0492e7bec46..7116725036921fdc225ed59ff021aa65f6949607 100644 (file)
@@ -9,22 +9,22 @@ from testlib import *
 import gc
 
 class UserDefinedTest(TestBase, AssertsCompiledSQL):
-    
+
     def test_column(self):
-        
+
         class MyThingy(ColumnClause):
             __visit_name__ = 'thingy'
-            
+
             def __init__(self, arg= None):
                 super(MyThingy, self).__init__(arg or 'MYTHINGY!')
-                
+
         class MyCompiler(UserDefinedCompiler):
             compile_elements = [MyThingy]
-            
+
             def visit_thingy(self, thingy, **kw):
                 return ">>%s<<" % thingy.name
-                
-        
+
+
         self.assert_compile(
             select([column('foo'), MyThingy()]),
             "SELECT foo, >>MYTHINGY!<<"
@@ -38,17 +38,17 @@ class UserDefinedTest(TestBase, AssertsCompiledSQL):
     def test_stateful(self):
         class MyThingy(ColumnClause):
             __visit_name__ = 'thingy'
-            
+
             def __init__(self):
                 super(MyThingy, self).__init__('MYTHINGY!')
-                
+
         class MyCompiler(UserDefinedCompiler):
             compile_elements = [MyThingy]
-            
+
             def __init__(self, parent_compiler):
                 UserDefinedCompiler.__init__(self, parent_compiler)
                 self.counter = 0
-                
+
             def visit_thingy(self, thingy, **kw):
                 self.counter += 1
                 return str(self.counter)
@@ -69,16 +69,16 @@ class UserDefinedTest(TestBase, AssertsCompiledSQL):
             def __init__(self, table, select):
                 self.table = table
                 self.select = select
-        
+
         class MyCompiler(UserDefinedCompiler):
             compile_elements = [InsertFromSelect]
-            
+
             def visit_insert_from_select(self, element):
                 return "INSERT INTO %s (%s)" % (
                     self.process(element.table, asfrom=True),
                     self.process(element.select)
                 )
-        
+
         t1 = table("mytable", column('x'), column('y'), column('z'))
         self.assert_compile(
             InsertFromSelect(
@@ -104,11 +104,11 @@ class UserDefinedTest(TestBase, AssertsCompiledSQL):
             def visit_drop_thingy(self, thingy, **kw):
                 return "DROP THINGY"
 
-        class MyPGCompiler(MyCompiler):
-            dialect = 'postgres'
-            
+        class MySqliteCompiler(MyCompiler):
+            dialect = 'sqlite'
+
             def visit_add_thingy(self, thingy, **kw):
-                return "ADD SPECIAL PG THINGY"
+                return "ADD SPECIAL SL THINGY"
 
         self.assert_compile(AddThingy(),
             "ADD THINGY"
@@ -120,15 +120,24 @@ class UserDefinedTest(TestBase, AssertsCompiledSQL):
         
         from sqlalchemy.dialects.postgres import base
         self.assert_compile(AddThingy(),
+<<<<<<< HEAD:test/ext/compiler.py
             "ADD SPECIAL PG THINGY",
             dialect=base.dialect()
+=======
+            "ADD SPECIAL SL THINGY",
+            dialect=create_engine('sqlite://', _initialize=False).dialect
+>>>>>>> Couple more corrections to get mssql tests to pass.:test/ext/compiler.py
         )
 
         self.assert_compile(DropThingy(),
             "DROP THINGY",
+<<<<<<< HEAD:test/ext/compiler.py
             dialect=base.dialect()
+=======
+            dialect=create_engine('sqlite://', _initialize=False).dialect
+>>>>>>> Couple more corrections to get mssql tests to pass.:test/ext/compiler.py
         )
-        
-        
+
+
 if __name__ == '__main__':
-    testenv.main()
\ No newline at end of file
+    testenv.main()