Let's collect more data.

This commit is contained in:
Alexandr
2019-01-09 23:18:19 +03:00
parent 7e7a4e3cc6
commit 62ad832396
3 changed files with 57 additions and 5 deletions

View File

@ -89,15 +89,20 @@ class DataBase:
)
self.execute(sql)
def add_relation(self, word, user_id, conf_id):
def add_relation(self, word, user_id, conf_id, text):
word_id = self.save_word(word)
date = int(dt.datetime.now().strftime("%s"))
sql2 = "INSERT OR IGNORE INTO xxx_message('text') VALUES ('%s')" % text
self.execute(sql2)
sql3 = "SELECT id FROM `xxx_message` WHERE text = '%s'" % text
msg_id = self.execute(sql3)[0][0]
sql = """INSERT OR IGNORE INTO
relations('word_id', 'user_id', 'conf_id', 'date')
VALUES ('%s','%s','%s','%s')""" % (
relations('word_id', 'user_id', 'conf_id', 'msg_id', 'date')
VALUES ('%s','%s','%s','%s', '%s')""" % (
word_id,
user_id,
conf_id,
msg_id,
date
)
self.execute(sql)