Hello,
I'm trying out the DataSet.filter() method, and I don't find a way to
filter for records with NULL / NOT NULL or '' / 'any non empty string'
in a given column. The wiki doesn't mention this, and it doesn't mention
any operator for "not equal".
ds = MyBizobj.getDataSet()
1. Filtering for records with NULL in column "textinfo":
ds2 = ds.filter("textinfo", None)
Error message:
s...@elend:~/bin/dabo_sib> python ds_test.py
Traceback (most recent call last):
File
"/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line
14551, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
File "/usr/lib/python2.6/site-packages/dabo/ui/uiwx/dPemMixin.py",
line 328, in _afterInitAll
self.afterInitAll()
File "ds_test.py", line 58, in afterInitAll
ds2 = ds.filter("textinfo", None)
File "/usr/lib/python2.6/site-packages/dabo/db/dDataSet.py", line 175,
in filter
ret = self.execute(stmnt, params=param)
File "/usr/lib/python2.6/site-packages/dabo/db/dDataSet.py", line 345,
in execute
self._cursor.execute(sqlExpr, params)
ValueError: parameters are of unsupported type
The field can be varchar or blob, subtype text, no difference.
2. Filtering for records with the empty string in the same column:
ds2 = ds.filter("textinfo", "")
Error message:
s...@elend:~/bin/dabo_sib> python ds_test.py
Traceback (most recent call last):
File
"/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line14551, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
File "/usr/lib/python2.6/site-packages/dabo/ui/uiwx/dPemMixin.py",
line 328, in _afterInitAll
self.afterInitAll()
File "ds_test.py", line 59, in afterInitAll
ds2 = ds.filter("bemerk", "")
File "/usr/lib/python2.6/site-packages/dabo/db/dDataSet.py", line 175,
in filter
ret = self.execute(stmnt, params=param)
File "/usr/lib/python2.6/site-packages/dabo/db/dDataSet.py", line 345,
in execute
self._cursor.execute(sqlExpr, params)
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The
current statement uses 1, and there are 0 supplied.
Again no difference between varchar or blob.
I can understand that filtering for NULL / NOT NULL may not be as simple
as I tried to do it. And of course filtering for the empty string must
give other results. But filtering for the empty string doesn't seem to
work at all, and that doesn't look right to me.
Of course I don't have to use filter(), ds.execute("SELECT ...") works
perfectly for both cases. But if this is a limitation of the filter()
method, it belongs into the documentation, together with the question of
filtering for inequality.
Thank you for hints,
Sibylle
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[email protected]