Skip to content

Commit

Permalink
SqEntryList: rename pickle column to data
Browse files Browse the repository at this point in the history
  • Loading branch information
ilius committed Dec 6, 2024
1 parent 41a075a commit 21fb01e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyglossary/sq_entry_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def setSortKey(
return

colDefs = ",".join(
[f"{col[0]} {col[1]}" for col in sqliteSortKey] + ["pickle BLOB"],
[f"{col[0]} {col[1]}" for col in sqliteSortKey] + ["data BLOB"],
)
self._con.execute(
f"CREATE TABLE data ({colDefs})",
Expand All @@ -122,7 +122,7 @@ def _decode(self, data: bytes) -> EntryType:

def append(self, entry: EntryType) -> None:
self._cur.execute(
f"insert into data({self._columnNames}, pickle)"
f"insert into data({self._columnNames}, data)"
f" values (?{', ?' * len(self._sqliteSortKey)})",
[col[2](entry.l_word) for col in self._sqliteSortKey]
+ [self._encode(entry)],
Expand Down Expand Up @@ -204,6 +204,6 @@ def __del__(self) -> None:
def __iter__(self) -> Iterator[EntryType]:
if self._cur is None:
raise Error("SQLite cursor is closed")
self._cur.execute(f"SELECT pickle FROM data ORDER BY {self._orderBy}")
self._cur.execute(f"SELECT data FROM data ORDER BY {self._orderBy}")
for row in self._cur:
yield self._decode(row[0])

0 comments on commit 21fb01e

Please sign in to comment.