Add functions to add/delete users and retrieve ato/ase from database
This commit is contained in:
parent
5c2c7d1a5e
commit
e2de6dac6a
1 changed files with 22 additions and 0 deletions
|
@ -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())
|
||||
|
|
Loading…
Reference in a new issue