Hello. I think I fixed a longstanding problem with UnicodeCol - at last you
can use unicode strings in .select() and .selectBy() queries. There are
some limitations, though:
- only simple q-magic fields are supported; no expressions;
- only == and <> operators are supported;
The following will work::
MyTable.select(u'value' == MyTable.q.name)
MyTable.select(MyTable.q.name <> u'value')
MyTable.selectBy(name = u'value')
The following will not work::
MyTable.select((MyTable.q.name + MyTable.q.surname) == u'value')
The patch with tests is attached. I am eagerly waiting for feedback.
Technically, I've found a way to pass dbEncoding to __sqlrepr__ so that
the column can convert the value to a string - for this I have created a
special field that only overrides __eq__ and __ne__ - I believe these are
the most frequent cases.
Oleg.
--
Oleg Broytmann http://phd.pp.ru/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|