コード例 #1
0
ファイル: db_helper.py プロジェクト: r3a10god/Scrapia-World
    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}")
コード例 #2
0
ファイル: db_helper.py プロジェクト: r3a10god/Scrapia-World
 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]