From a8cd7c5c57ab1a1735d8670f5b87de79e00bdc8b Mon Sep 17 00:00:00 2001 From: emizzle Date: Mon, 23 Nov 2020 16:51:05 +1100 Subject: [PATCH] feat: handle bool option conversion --- sqlcipher.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sqlcipher.nim b/sqlcipher.nim index 63af0ac..0e467f2 100644 --- a/sqlcipher.nim +++ b/sqlcipher.nim @@ -145,7 +145,9 @@ proc fromDbValue*(val: DbValue, T: typedesc[seq[byte]]): seq[byte] = val.blobVal proc fromDbValue*(val: DbValue, T: typedesc[DbValue]): T = val proc fromDbValue*[T](val: DbValue, _: typedesc[Option[T]]): Option[T] = - if val.kind == sqliteNull: + if (val.kind == sqliteNull) or + (val.kind == sqliteText and val.strVal == "") or + (val.kind == sqliteInteger and val.intVal == 0): none(T) else: some(val.fromDbValue(T))