mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Need to make sure we set the nickeq function even if we're using an already
created database.
This commit is contained in:
parent
4ba005ddf6
commit
019a53cdae
@ -106,14 +106,18 @@ class SqliteQuoteGrabsDB(object):
|
|||||||
'use this plugin. Download it at ' \
|
'use this plugin. Download it at ' \
|
||||||
'<http://pysqlite.sf.net/>'
|
'<http://pysqlite.sf.net/>'
|
||||||
filename = plugins.makeChannelFilename(self.filename, channel)
|
filename = plugins.makeChannelFilename(self.filename, channel)
|
||||||
|
def p(s1, s2):
|
||||||
|
return int(ircutils.nickEqual(s1, s2))
|
||||||
if filename in self.dbs:
|
if filename in self.dbs:
|
||||||
return self.dbs[filename]
|
return self.dbs[filename]
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
self.dbs[filename] = sqlite.connect(filename,
|
self.dbs[filename] = sqlite.connect(filename,
|
||||||
converters={'bool': bool})
|
converters={'bool': bool})
|
||||||
|
self.dbs[filename].create_function('nickeq', 2, p)
|
||||||
return self.dbs[filename]
|
return self.dbs[filename]
|
||||||
db = sqlite.connect(filename, converters={'bool': bool})
|
db = sqlite.connect(filename, converters={'bool': bool})
|
||||||
self.dbs[filename] = db
|
self.dbs[filename] = db
|
||||||
|
self.dbs[filename].create_function('nickeq', 2, p)
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("""CREATE TABLE quotegrabs (
|
cursor.execute("""CREATE TABLE quotegrabs (
|
||||||
id INTEGER PRIMARY KEY,
|
id INTEGER PRIMARY KEY,
|
||||||
@ -123,9 +127,6 @@ class SqliteQuoteGrabsDB(object):
|
|||||||
added_at TIMESTAMP,
|
added_at TIMESTAMP,
|
||||||
quote TEXT
|
quote TEXT
|
||||||
);""")
|
);""")
|
||||||
def p(s1, s2):
|
|
||||||
return int(ircutils.nickEqual(s1, s2))
|
|
||||||
db.create_function('nickeq', 2, p)
|
|
||||||
db.commit()
|
db.commit()
|
||||||
return db
|
return db
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user