##// END OF EJS Templates
fix null comparisons in sqlitedb backend...
MinRK -
Show More
@@ -293,7 +293,7 b' class SQLiteDB(BaseDB):'
293 293 op, join = op
294 294
295 295 if value is None and op in null_operators:
296 expr = "%s %s"%null_operators[op]
296 expr = "%s %s" % (name, null_operators[op])
297 297 else:
298 298 expr = "%s %s ?"%(name, op)
299 299 if isinstance(value, (tuple,list)):
@@ -308,7 +308,7 b' class SQLiteDB(BaseDB):'
308 308 else:
309 309 # it's an equality check
310 310 if sub_check is None:
311 expressions.append("%s IS NULL")
311 expressions.append("%s IS NULL" % name)
312 312 else:
313 313 expressions.append("%s = ?"%name)
314 314 args.append(sub_check)
@@ -171,6 +171,18 b' class TestDictBackend(TestCase):'
171 171 recs = self.db.find_records(query)
172 172 self.assertEquals(len(recs), 0)
173 173
174 def test_null(self):
175 """test None comparison queries"""
176 msg_ids = self.load_records(10)
177
178 query = {'msg_id' : None}
179 recs = self.db.find_records(query)
180 self.assertEquals(len(recs), 0)
181
182 query = {'msg_id' : {'$ne' : None}}
183 recs = self.db.find_records(query)
184 self.assertTrue(len(recs) >= 10)
185
174 186
175 187 class TestSQLiteBackend(TestDictBackend):
176 188
General Comments 0
You need to be logged in to leave comments. Login now