aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar jesopo2018-11-27 11:38:13 +0000
committerGravatar jesopo2018-11-27 11:39:50 +0000
commitdce050aac5ceee19e6af598d844b4335e18b763a (patch)
tree16b433775f718d48d56897ec5f2b027fa6aadd75 /src
parentNope, 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')
-rw-r--r--src/Database.py5
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()