From: Mike Bayer Date: Tue, 7 Sep 2010 16:37:43 +0000 (-0400) Subject: - Applied patches from [ticket:1904] to get X-Git-Tag: rel_0_6_4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=992dd2c055dcff75953695d20813f43d858997d9;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - 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. --- diff --git a/CHANGES b/CHANGES index 5565d3451e..bc8abaf193 100644 --- a/CHANGES +++ b/CHANGES @@ -409,6 +409,12 @@ CHANGES 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 ===== diff --git a/lib/sqlalchemy/dialects/informix/base.py b/lib/sqlalchemy/dialects/informix/base.py index bc7b6c3e79..242b8a3289 100644 --- a/lib/sqlalchemy/dialects/informix/base.py +++ b/lib/sqlalchemy/dialects/informix/base.py @@ -105,29 +105,20 @@ class InfoSQLCompiler(compiler.SQLCompiler): 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': @@ -135,7 +126,7 @@ class InfoSQLCompiler(compiler.SQLCompiler): 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): diff --git a/lib/sqlalchemy/dialects/informix/informixdb.py b/lib/sqlalchemy/dialects/informix/informixdb.py index 54e5a994a7..8edcc953b5 100644 --- a/lib/sqlalchemy/dialects/informix/informixdb.py +++ b/lib/sqlalchemy/dialects/informix/informixdb.py @@ -31,10 +31,13 @@ class InformixDialect_informixdb(InformixDialect): 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):