Commits

Mike Bayer committed 2db46b7

- Applied patches from [ticket:1904] to get
basic Informix functionality up again. We
rely upon end-user testing to ensure that
Informix is working to some degree.

  • Participants
  • Parent commits d928096
  • Tags rel_0_6_4

Comments (0)

Files changed (3)

     mode and must run isinstance() on every value
     to check if its Decimal already. Reopen of
     [ticket:1840]
+
+- informix
+  - Applied patches from [ticket:1904] to get
+    basic Informix functionality up again.  We
+    rely upon end-user testing to ensure that
+    Informix is working to some degree.
     
 0.6.2
 =====

lib/sqlalchemy/dialects/informix/base.py

             s += ""
         return s
 
-    def visit_select(self, select):
-        # the column in order by clause must in select too
-
-        def __label(c):
-            try:
-                return c._label.lower()
-            except:
-                return ''
-
-        # TODO: dont modify the original select, generate a new one
-        a = [__label(c) for c in select._raw_columns]
-        for c in select._order_by_clause.clauses:
-            if __label(c) not in a:
-                select.append_column(c)
-
-        return compiler.SQLCompiler.visit_select(self, select)
+    def visit_select(self, select, asfrom=False, parens=True, **kw):
+        text = compiler.SQLCompiler.visit_select(self, select, asfrom, parens, **kw)
+        if asfrom and parens and self.dialect.server_version_info < (11,):
+            #assuming that 11 version doesn't need this, not tested
+            return "table(multiset" + text + ")"
+        else:
+            return text
 
     def limit_clause(self, select):
         if select._offset is not None and select._offset > 0:
             raise NotImplementedError("Informix does not support OFFSET")
         return ""
 
-    def visit_function(self, func):
+    def visit_function(self, func, **kw):
         if func.name.lower() == 'current_date':
             return "today"
         elif func.name.lower() == 'current_time':
         elif func.name.lower() in ('current_timestamp', 'now'):
             return "CURRENT YEAR TO SECOND"
         else:
-            return compiler.SQLCompiler.visit_function(self, func)
+            return compiler.SQLCompiler.visit_function(self, func, **kw)
 
 
 class InfoDDLCompiler(compiler.DDLCompiler):

lib/sqlalchemy/dialects/informix/informixdb.py

 
     def _get_server_version_info(self, connection):
         # http://informixdb.sourceforge.net/manual.html#inspecting-version-numbers
-        vers = connection.dbms_version
-        
-        # TODO: not tested
-        return tuple([int(x) for x in vers.split('.')])
+        version = []
+        for n in connection.connection.dbms_version.split('.'):
+          try:
+            version.append(int(n))
+          except ValueError:
+            version.append(n)
+        return tuple(version)
 
     def is_disconnect(self, e):
         if isinstance(e, self.dbapi.OperationalError):