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
|
|
|
|
|
|
|
|
db = sq.connect('dickpick.db')
|
|
|
|
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:08:19 +10:00
|
|
|
await cur.execute('''INSERT INTO users (users_id, user_name) VALUES (?, ?)''',[id1, fullname1])
|
|
|
|
await 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:08:19 +10:00
|
|
|
await db.commit()
|
|
|
|
await 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
|
|
|
|