Commits

Michael Trier  committed b52427f

Forgot to sqash a commit. Follow up on mssql dates refactoring.

  • Participants
  • Parent commits e73c494

Comments (0)

Files changed (1)

File lib/sqlalchemy/databases/mssql.py

 
     """
 
-    def __init__(self, *args, **kwargs):
-        super(MSDate, self).__init__(False)
-
     def get_col_spec(self):
         return "DATETIME"
 
 
     __zero_date = datetime.date(1900, 1, 1)
 
-    def __init__(self, *a, **kw):
-        super(MSTime, self).__init__(False)
-
     def get_col_spec(self):
         return "DATETIME"
 
             util.warn("pymssql does not support unicode")
             self.encoding = params.get('encoding', 'ascii')
 
+        self.colspecs = MSSQLDialect.colspecs.copy()
+        self.ischema_names = MSSQLDialect.ischema_names.copy()
+        self.ischema_names['date'] = MSDateTimeAsDate
+        self.colspecs[sqltypes.Date] = MSDateTimeAsDate
+        self.ischema_names['time'] = MSDateTimeAsTime
+        self.colspecs[sqltypes.Time] = MSDateTimeAsTime
+
     def create_connect_args(self, url):
         r = super(MSSQLDialect_pymssql, self).create_connect_args(url)
         if hasattr(self, 'query_timeout'):
         super(MSSQLDialect_pyodbc, self).__init__(**params)
         self.description_encoding = description_encoding
 
-        self.colspecs = MSSQLDialect.colspecs.copy()
-        self.ischema_names = MSSQLDialect.ischema_names.copy()
         if self.server_version_info < (10,):
+            self.colspecs = MSSQLDialect.colspecs.copy()
+            self.ischema_names = MSSQLDialect.ischema_names.copy()
+            self.ischema_names['date'] = MSDateTimeAsDate
             self.colspecs[sqltypes.Date] = MSDateTimeAsDate
+            self.ischema_names['time'] = MSDateTimeAsTime
             self.colspecs[sqltypes.Time] = MSDateTimeAsTime
 
         # FIXME: scope_identity sniff should look at server version, not the ODBC driver