Switching to a real inconsistent button
[multilist] / src / copydb.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 import time
5 import sqlite3
6 import uuid
7
8
9 def copydb(db):
10         conn = sqlite3.connect(db)
11         cur = conn.cursor()
12
13         sql = "UPDATE sync SET syncpartner=? WHERE syncpartner=?"
14         cur.execute(sql, (str(uuid.uuid4()), "self")) #Eigene Id ändern feststellen
15         conn.commit()
16
17         sql = "DELETE FROM sync WHERE syncpartner=?"
18         cur.execute(sql, ("self", ))
19         conn.commit()
20
21         sql = "INSERT INTO sync (syncpartner,uuid,pcdatum) VALUES (?,?,?)"
22         cur.execute(sql, ("self", str(uuid.uuid4()), int(time.time())))
23
24         sql = "UPDATE sync SET pcdatum=?"
25         cur.execute(sql, (int(time.time()), ))
26
27         conn.commit()
28
29
30 if __name__ == "__main__":
31         dbPath = "/home/chris/Documents/Schule/Schule/schulplaner/schuljahr200708enni.s3db"
32         copydb(dbPath)