Kirill Simonov  committed 44016dc

Normalize Boolean values produced by SQLite.

  • Participants
  • Parent commits 4e5721e

Comments (0)

Files changed (1)

File src/htsql_sqlite/

 from htsql.connect import Connect, Normalize, DBError
 from htsql.adapter import adapts, find_adapters
 from htsql.context import context
-from htsql.domain import StringDomain
+from htsql.domain import BooleanDomain, StringDomain
 # In Python 2.6, the `sqlite3` module is built-in, but
 # for Python 2.5, we need to import a third-party module.
         return super(SQLiteConnect, self).normalize_error(exception)
+class NormalizeSQLiteBoolean(Normalize):
+    adapts(BooleanDomain)
+    def __call__(self, value):
+        if value is None:
+            return None
+        return (value != 0)
 class NormalizeSQLiteString(Normalize):