53 lines
999 B
Python
53 lines
999 B
Python
|
|
class Cursor:
|
|
def __init__(self, cursor):
|
|
pass
|
|
|
|
def execute(self, sql: str, params: list = None) -> None:
|
|
pass
|
|
|
|
def fetchone(self, sql: str, params: list = None) -> dict:
|
|
pass
|
|
|
|
def fetchmany(self, sql: str = None, params: list = None) -> list[dict]:
|
|
pass
|
|
|
|
def fetchall(self, sql: str, params: list = None) -> list[dict]:
|
|
pass
|
|
|
|
def lastrowid(self):
|
|
pass
|
|
|
|
|
|
class Database:
|
|
|
|
def __init__(self, name: str):
|
|
self.name = name
|
|
self.connected = False
|
|
|
|
def commit(self):
|
|
pass
|
|
|
|
def cursor(self) -> Cursor:
|
|
pass
|
|
|
|
|
|
class DBContainer:
|
|
def __init__(self, db: Database):
|
|
self.db: Database = db
|
|
|
|
def switch_db(self, db: Database):
|
|
self.db.commit()
|
|
self.db: Database = db
|
|
|
|
@property
|
|
def connected(self) -> bool:
|
|
return self.db.connected
|
|
|
|
def commit(self):
|
|
self.db.commit()
|
|
|
|
def cursor(self) -> Cursor:
|
|
return self.db.cursor()
|
|
|