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
This commit is contained in:
Worros 2011-02-25 17:46:10 +08:00
parent e41c0bc4e6
commit 3455b4ea69

View File

@ -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)