1.1 --- a/imiptools/freebusy/database.py Fri May 26 23:58:06 2017 +0200
1.2 +++ b/imiptools/freebusy/database.py Thu Jun 01 23:26:38 2017 +0200
1.3 @@ -90,6 +90,8 @@
1.4 self.cursor = cursor
1.5 self.table_name = table_name
1.6
1.7 + self.period_columns = self.period_class.period_columns
1.8 +
1.9 # List emulation methods.
1.10
1.11 def __nonzero__(self):
1.12 @@ -116,6 +118,15 @@
1.13 def __getitem__(self, i):
1.14 return list(iter(self))[i]
1.15
1.16 + # Dictionary emulation methods (even though this is not a mapping).
1.17 +
1.18 + def clear(self):
1.19 + query, values = self.get_query(
1.20 + "delete from %(table)s :condition" % {
1.21 + "table" : self.table_name
1.22 + })
1.23 + self.cursor.execute(query, values)
1.24 +
1.25 # Operations.
1.26
1.27 def insert_period(self, period):