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:
parent
e41c0bc4e6
commit
3455b4ea69
|
@ -454,7 +454,7 @@ class Database:
|
||||||
self.connection = sqlite3.connect(self.db_path, detect_types=sqlite3.PARSE_DECLTYPES )
|
self.connection = sqlite3.connect(self.db_path, detect_types=sqlite3.PARSE_DECLTYPES )
|
||||||
self.__connected = True
|
self.__connected = True
|
||||||
sqlite3.register_converter("bool", lambda x: bool(int(x)))
|
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)
|
self.connection.create_function("floor", 1, math.floor)
|
||||||
tmp = sqlitemath()
|
tmp = sqlitemath()
|
||||||
self.connection.create_function("mod", 2, tmp.mod)
|
self.connection.create_function("mod", 2, tmp.mod)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user