Add BOOL_AND and BOOL_OR to SQLite backend

issue10316
review330801002
This commit is contained in:
Cédric Krier
2021-05-16 18:09:28 +02:00
parent 0b1041b4c5
commit d8ddff1b9b
2 changed files with 12 additions and 0 deletions
+2
View File
@@ -1,3 +1,5 @@
* Add BOOL_AND and BOOL_OR to SQLite backend
Version 6.0.0 - 2021-05-03
* Bug fixes (see mercurial logs for details)
* Allow column sql types to be tested from the table handler
+10
View File
@@ -264,6 +264,14 @@ def least(*args):
return None
def bool_and(*args):
return all(args)
def bool_or(*args):
return any(args)
def cbrt(value):
return math.pow(value, 1 / 3)
@@ -354,6 +362,8 @@ class Database(DatabaseInterface):
self._conn.create_function('now', 0, now)
self._conn.create_function('greatest', -1, greatest)
self._conn.create_function('least', -1, least)
self._conn.create_function('bool_and', -1, bool_and)
self._conn.create_function('bool_or', -1, bool_or)
# Mathematical functions
self._conn.create_function('cbrt', 1, cbrt)