Opened 15 years ago
Last modified 11 years ago
#4243 closed enhancement
SQL for sqlite3 — at Initial Version
Reported by: | James Petry | Owned by: | Martin Aspeli |
---|---|---|---|
Priority: | normal | Component: | TeamCalendarPlugin |
Severity: | normal | Keywords: | sql calendar |
Cc: | Robert Rossmair | Trac Release: | 0.11 |
Description
I've got the TeamCalendarPlugin to work with sqlite3 by changing just one function. I don't use MySQL so I'm not sure if this will work with that too.
def update_timetable(self, tuples):
db = self.env.get_db_cnx() cursor = db.cursor() for t in tuples:
sql = "SELECT * FROM %s WHERE username='%s' AND ondate='%s'" % (self.table_name, t[1], t[0]) cursor.execute(sql) if cursor.fetchone():
sql = "UPDATE %s SET availability=%d WHERE username='%s' AND ondate='%s'" % (self.table_name, t[2], t[1], t[0]) cursor.execute(sql)
else:
sql = "INSERT INTO %s (ondate, username, availability) VALUES ('%s', '%s', %d)" % (self.table_name, t[0], t[1], t[2]) cursor.execute(sql)
db.commit()