def updateCurrentChapterNumberOfNovel( self, con: sqlite3.Connection, cur: sqlite3.Cursor | None, table_name: str, novel_name: str, new_val: int, ): if cur is None: cur = con.cursor() with con: cur.execute(f"UPDATE {table_name} SET {novel_name}={new_val}")
def getChapterNumberFrmDB( self, con: sqlite3.Connection | None, cur: sqlite3.Cursor | None, table_name: str, novel_name: str, ) -> int: if (con, cur) == (None, None): return if con is not None: con.row_factory = sqlite3.Row cur = con.cursor() cur.execute(f"SELECT * from {table_name}") r = cur.fetchone() return r[novel_name]