2022-11-06 17:42:28 +10:00
|
|
|
import sqlite3 as sq
|
2022-11-07 19:58:59 +10:00
|
|
|
|
2022-11-06 17:42:28 +10:00
|
|
|
|
2022-11-07 00:52:46 +10:00
|
|
|
async def db_start(): #подключение к бд
|
2022-11-06 17:42:28 +10:00
|
|
|
global db, cur
|
|
|
|
|
2022-11-07 20:09:09 +10:00
|
|
|
db = sq.connect('users.db')
|
2022-11-06 17:42:28 +10:00
|
|
|
cur = db.cursor()
|
|
|
|
|
2022-11-07 20:02:30 +10:00
|
|
|
cur.execute(''''CREATE TABLE IF NOT EXISTS users(id INTEGER PRIMARY KEY, users_id INTEGER, user_name TEXT)''')
|
2022-11-06 17:42:28 +10:00
|
|
|
db.commit()
|
|
|
|
|
2022-11-07 19:58:59 +10:00
|
|
|
async def add_user():
|
2022-11-07 20:11:37 +10:00
|
|
|
cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?, ?)''')
|
|
|
|
db.commit()
|
2022-11-06 17:42:28 +10:00
|
|
|
|
2022-11-07 19:58:59 +10:00
|
|
|
async def close():
|
2022-11-07 20:11:37 +10:00
|
|
|
db.commit()
|
|
|
|
db.close()
|
2022-11-07 17:04:34 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-06 17:42:28 +10:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-11-07 00:52:46 +10:00
|
|
|
|