from aiomysql import Pool, DictCursor
from basa.db import db_pool
class dbsql():
pool: Pool = db_pool
async def register(self):
async with self.pool.acquire() as conn:
async with conn.cursor() as cur:
result = await cur.execute("SELECT * FROM profile WHERE uid")
row = await cur.fetchall()
if result == 0:
await cur.execute(f'INSERT INTO profile(uid) VALUES(uid)')
else:
return await row
main = dbsql()
raise ProgrammingError("Cursor closed")
pymysql.err.ProgrammingError: Cursor closed
from aiomysql import Pool, DictCursor
from basa.db import db_pool
class dbsql():
pool: Pool = db_pool
async def register(self):
async with self.pool.acquire() as conn:
async with conn.cursor() as cur:
result = await cur.execute("SELECT * FROM profile WHERE uid")
row = await cur.fetchall()
if result == 0:
await cur.execute(f'INSERT INTO profile(uid) VALUES(uid)')
else:
return await row
main = dbsql()