From 3455b4ea6975857b9a2e2eec7e6d42e4dc0c67ec Mon Sep 17 00:00:00 2001 From: Worros Date: Fri, 25 Feb 2011 17:46:10 +0800 Subject: [PATCH] Database: Make sqlite bool adapter use ints not strings Scott Wolchok noted that the adapater was using strings, and possibly only working by luck. Appears to give a 10-15% boost on a 10k hand import --- pyfpdb/Database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index 6340660d..a459c883 100644 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -454,7 +454,7 @@ class Database: self.connection = sqlite3.connect(self.db_path, detect_types=sqlite3.PARSE_DECLTYPES ) self.__connected = True sqlite3.register_converter("bool", lambda x: bool(int(x))) - sqlite3.register_adapter(bool, lambda x: "1" if x else "0") + sqlite3.register_adapter(bool, lambda x: 1 if x else 0) self.connection.create_function("floor", 1, math.floor) tmp = sqlitemath() self.connection.create_function("mod", 2, tmp.mod)