- fixes to types so that database-specific types more easily used;
fixes to mysql text types to work with this methodology
[ticket:269]
+- some fixes to sqlite date type organization
0.2.6
- big overhaul to schema to allow truly composite primary and foreign
class SLSmallInteger(sqltypes.Smallinteger):
def get_col_spec(self):
return "SMALLINT"
-class SLDateTime(sqltypes.DateTime):
- def get_col_spec(self):
- return "TIMESTAMP"
+class DateTimeMixin(object):
def convert_bind_param(self, value, dialect):
if value is not None:
return str(value)
except ValueError:
(value, microsecond) = (value, 0)
return time.strptime(value, fmt)[0:6] + (microsecond,)
+
+class SLDateTime(sqltypes.DateTime, DateTimeMixin):
+ def get_col_spec(self):
+ return "TIMESTAMP"
def convert_result_value(self, value, dialect):
tup = self._cvt(value, dialect, "%Y-%m-%d %H:%M:%S")
return tup and datetime.datetime(*tup)
-class SLDate(SLDateTime):
+class SLDate(sqltypes.Date, DateTimeMixin):
def get_col_spec(self):
return "DATE"
def convert_result_value(self, value, dialect):
tup = self._cvt(value, dialect, "%Y-%m-%d")
return tup and datetime.date(*tup[0:3])
-class SLTime(SLDateTime):
+class SLTime(sqltypes.Time, DateTimeMixin):
def get_col_spec(self):
return "TIME"
def convert_result_value(self, value, dialect):
book_id int PRIMARY KEY REFERENCES books(id),
user_name varchar(32) references users(name)
ON DELETE SET NULL ON UPDATE CASCADE,
- loan_date date DEFAULT current_timestamp
+ loan_date datetime DEFAULT current_timestamp
);
insert into users(name, email, password, admin)