of a datetime or time object when sent to the DB.
- dialects
+ - sqlite SLDate type will not erroneously render "microseconds" portion
+ of a datetime or time object.
+
- MSSQL
- PyODBC no longer has a global "set nocount on".
- Fix non-identity integer PKs on autload [ticket:824]
# pass string values thru
return value
elif value is not None:
- if getattr(value, 'microsecond', None) is not None:
+ if self.__microsecond__ and getattr(value, 'microsecond', None) is not None:
return value.strftime(self.__format__ + "." + str(value.microsecond))
else:
return value.strftime(self.__format__)
class SLDateTime(DateTimeMixin,sqltypes.DateTime):
__format__ = "%Y-%m-%d %H:%M:%S"
+ __microsecond__ = True
def get_col_spec(self):
return "TIMESTAMP"
class SLDate(DateTimeMixin, sqltypes.Date):
__format__ = "%Y-%m-%d"
+ __microsecond__ = False
def get_col_spec(self):
return "DATE"
class SLTime(DateTimeMixin, sqltypes.Time):
__format__ = "%H:%M:%S"
+ __microsecond__ = True
def get_col_spec(self):
return "TIME"
self.assert_(x.adate.__class__ == datetime.date)
self.assert_(x.adatetime.__class__ == datetime.datetime)
+ t.delete().execute()
+
+ # test mismatched date/datetime
+ t.insert().execute(adate=d2, adatetime=d2)
+ self.assertEquals(select([t.c.adate, t.c.adatetime], t.c.adate==d1).execute().fetchall(), [(d1, d2)])
+ self.assertEquals(select([t.c.adate, t.c.adatetime], t.c.adate==d1).execute().fetchall(), [(d1, d2)])
+
finally:
t.drop(checkfirst=True)