diff --git a/dbtools/__init__.py b/dbtools/__init__.py index 92f6699..4e6f3ad 100644 --- a/dbtools/__init__.py +++ b/dbtools/__init__.py @@ -63,6 +63,28 @@ class dbObject: except: return False + def deleteUser(self, cid): + self.executeQuery("DELETE FROM tokens WHERE cid = %i;" % int(cid)) + self.commit() + + def storeUser(self, cid, ato, ase): + self.executeQuery("INSERT INTO tokens VALUES(%i, '%s', '%s');" % (int(cid), ato, ase)) + self.commit() + + def ato(self, cid): + try: + self.executeQuery("SELECT ato FROM tokens WHERE cid = %i;" % int(cid)) + return self.cur.fetchone() + except: + return False + + def ase(self, cid): + try: + self.executeQuery("SELECT ase FROM tokens WHERE cid = %i;" % int(cid)) + return self.cur.fetchone() + except: + return False + def dbHelper(): if setuptools.dbtype() == SQLITE: return dbObject(dbtype=SQLITE, path=setuptools.dbpath())