-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcanapeshecka_bd.py
More file actions
33 lines (25 loc) · 1015 Bytes
/
canapeshecka_bd.py
File metadata and controls
33 lines (25 loc) · 1015 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import sqlite3
class SQLighter:
def __init__(self, database_file):
"""CONNECT BD SAVE CUR"""
self.connection = sqlite3.connect(database_file)
self.cursor = self.connection.cursor()
def whid_bd(self, username):
"""CHECK BD username"""
with self.connection:
result = self.cursor.execute("SELECT * FROM `users` WHERE `username` = ?", (username,)).fetchall()
return result
def add_hid_db(self, username, whid):
with self.connection:
return self.cursor.execute("UPDATE `users` SET `whid` = ? WHERE `username` = ?", (whid, username,))
def first_start_db(self, username, whid):
self.cursor.execute("""CREATE TABLE discord (
id INTEGER PRIMARY KEY AUTOINCREMENT,
folders TEXT,
file_path TEXT,
token TEXT,
status TEXT);
""")
self.connection.commit()
def close(self):
self.connection.close()