fixed singlethread reloading, and functional database system (still no ORM usage)
This commit is contained in:
parent
cdc9102694
commit
2ebb30d2d7
4 changed files with 16 additions and 9 deletions
|
@ -29,8 +29,8 @@ def horoscope(inp, db=None, notice=None, nick=None):
|
|||
db.execute("create table if not exists horoscope(nick primary key, sign)")
|
||||
|
||||
if not sign:
|
||||
sign = db.execute("select sign from horoscope where nick=lower(?)",
|
||||
(nick,)).fetchone()
|
||||
sign = db.execute("select sign from horoscope where nick=lower(:nick)",
|
||||
{'nick':nick}).fetchone()
|
||||
if not sign:
|
||||
notice("horoscope <sign> -- Get your horoscope")
|
||||
return
|
||||
|
@ -49,8 +49,8 @@ def horoscope(inp, db=None, notice=None, nick=None):
|
|||
return "Could not get the horoscope for {}.".format(inp)
|
||||
|
||||
if inp and not dontsave:
|
||||
db.execute("insert or replace into horoscope(nick, sign) values (?,?)",
|
||||
(nick.lower(), sign))
|
||||
db.execute("insert or replace into horoscope(nick, sign) values (:nick,:sign)",
|
||||
{'nick':nick.lower(), 'sign': sign})
|
||||
db.commit()
|
||||
|
||||
return result
|
||||
|
|
Reference in a new issue