diff options
| author | 2018-11-27 11:38:13 +0000 | |
|---|---|---|
| committer | 2018-11-27 11:39:50 +0000 | |
| commit | dce050aac5ceee19e6af598d844b4335e18b763a (patch) | |
| tree | 16b433775f718d48d56897ec5f2b027fa6aadd75 /src/Database.py | |
| parent | Nope, just combine previous color-char and current color-char and see if it's (diff) | |
| signature | ||
Convert BOOLEAN sqlite3 types to bool objects when retrieving them
Diffstat (limited to 'src/Database.py')
| -rw-r--r-- | src/Database.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Database.py b/src/Database.py index 8dcac9af..555f717a 100644 --- a/src/Database.py +++ b/src/Database.py @@ -1,6 +1,8 @@ import json, os, sqlite3, threading, time, typing from src import Logging +sqlite3.register_converter("BOOLEAN", lambda v: bool(int(v))) + class Table(object): def __init__(self, database): self.database = database @@ -275,7 +277,8 @@ class Database(object): self.log = log self.location = location self.database = sqlite3.connect(self.location, - check_same_thread=False, isolation_level=None) + check_same_thread=False, isolation_level=None, + detect_types=sqlite3.PARSE_DECLTYPES) self.database.execute("PRAGMA foreign_keys = ON") self._cursor = None self._lock = threading.Lock() |
