diff --git a/pylib/anki/dbproxy.py b/pylib/anki/dbproxy.py index 428be4c1b..394fb7044 100644 --- a/pylib/anki/dbproxy.py +++ b/pylib/anki/dbproxy.py @@ -62,9 +62,6 @@ class DBProxy: def close(self) -> None: self._db.close() - def totalChanges(self) -> Any: - return self._db.total_changes - def setAutocommit(self, autocommit: bool) -> None: if autocommit: self._db.isolation_level = None diff --git a/pylib/anki/importing/noteimp.py b/pylib/anki/importing/noteimp.py index 364d13bcd..69d6a306a 100644 --- a/pylib/anki/importing/noteimp.py +++ b/pylib/anki/importing/noteimp.py @@ -287,7 +287,7 @@ content in the text file to the correct fields.""" return [intTime(), self.col.usn(), n.fieldsStr, id, n.fieldsStr] def addUpdates(self, rows: List[List[Union[int, str]]]) -> None: - old = self.col.db.totalChanges() + changes = self.col.db.scalar("select total_changes()") if self._tagsMapped: self.col.db.executemany( """ @@ -309,7 +309,8 @@ update notes set mod = ?, usn = ?, flds = ? where id = ? and flds != ?""", rows, ) - self.updateCount = self.col.db.totalChanges() - old + changes2 = self.col.db.scalar("select total_changes()") + self.updateCount = changes2 - changes def processFields( self, note: ForeignNote, fields: Optional[List[str]] = None