diff options
author | Jogi Hofmüller <jogi@mur.at> | 2011-08-01 09:21:12 +0000 |
---|---|---|
committer | Jogi Hofmüller <jogi@mur.at> | 2011-08-01 09:21:12 +0000 |
commit | 8f163642ecceac0e9eba916b1dfbd4d6d0ad63bb (patch) | |
tree | 00bd3232f9c89a12fdf019eb1035c6cffedbc2e5 /tools/mmd/MmdDb.py | |
parent | - have a confirmation request sent by email for registration now (diff) |
- found a way to handle encoding
- switched back to / as script handler
git-svn-id: https://svn.spreadspace.org/mur.sat@87 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'tools/mmd/MmdDb.py')
-rw-r--r-- | tools/mmd/MmdDb.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/mmd/MmdDb.py b/tools/mmd/MmdDb.py index 18a4df8..1065bb6 100644 --- a/tools/mmd/MmdDb.py +++ b/tools/mmd/MmdDb.py @@ -1,3 +1,4 @@ +# -*- encoding: utf-8 -*- """ sqlite3 database module for MURSAT1 Mission Dashboard """ @@ -8,6 +9,7 @@ class Db: def __init__ (self): self.conn = sqlite3.connect ('/usr/local/mmd/db/mmd.db') + self.conn.text_factory = str self.cursor = self.conn.cursor () def sessionFind (self, session_id): @@ -47,6 +49,14 @@ class Db: (user_id, firstname, lastname, email, callsign, password, confreg)) self.conn.commit () + def userDelete (self, user_id): + self.cursor.execute ('DELETE FROM user WHERE id=?', (user_id,)) + self.conn.commit () + + def userFindId (self, user_id): + self.cursor.execute ('SELECT * FROM user WHERE id=?', (user_id,)) + return self.cursor.fetchone () + def close (self): self.cursor.close () self.conn.close () @@ -54,11 +64,15 @@ class Db: if __name__ == "__main__": db = Db () print db.sessionFind ('1234567890') - db.sessionInit ('1234567890') + db.sessionInit ('1234567890', 'jogi@mur.at', '1') data = db.sessionFind ('1234567890') print data[0], data[1] db.sessionDelete ('1234567890') print db.sessionFind ('1234567890') + print db.userFindId ('1') + db.userCreate ('1', 'Jogi', 'Hofmüller', 'jogi@mur.at', '', '', '') + print db.userFindId ('1') + db.userDelete ('1') # vim: tw=0 ts=2 expandtab |