def visit_function(self, func): func.name = self.function_rewrites.get(func.name, func.name) res = super(SybaseSQLCompiler, self).visit_function(func) if func.name.lower() == 'getdate': # apply CAST operator # FIXME: what about _pyodbc ? cast = expression._Cast(func, SybaseDate_mxodbc) # infinite recursion # res = self.visit_cast(cast) res = "CAST(%s AS %s)" % (res, self.process(cast.typeclause)) return res
def visit_function(self, func): func.name = self.function_rewrites.get(func.name, func.name) res = super(SybaseSQLCompiler, self).visit_function(func) if func.name.lower() == 'getdate': # apply CAST operator # FIXME: what about _pyodbc ? cast = expression._Cast(func, SybaseDate_mxodbc) # infinite recursion # res = self.visit_cast(cast) if self.stack and self.stack[-1].get('select'): # not sure if we want to set the typemap here... self.typemap.setdefault("CAST", cast.type) # res = "CAST(%s AS %s)" % (self.process(cast.clause), self.process(cast.typeclause)) res = "CAST(%s AS %s)" % (res, self.process(cast.typeclause)) # elif func.name.lower() == 'count': # res = 'count(*)' return res