Oleg Broytmann schrieb:
> On Sun, Sep 10, 2006 at 11:01:48PM +0200, Andres Freund wrote:
>
>> Currently sqlboject uses LIKE for all its comparisons which is case
>> sensitive
>> in some databases (eg. postgres) (I _think_ this is standard compliant, im
>> on
>> the road currently, so i cant check) others do not (eg mysql).
>> At least I sometimes need a case sensitive LIKE and sometimes not. Is there
>> interest in changing sqlobject to support both? Eg. either having something
>> like .istartswith(str) or .startswith(str, casesensitve = False)?
>>
>
> Why not just
>
> from sqlobject.sqlbuilder import func
> func.lower(MyTable.q.field).startswith(str.lower())
>
>
Speaking of that func function:
In [27]: Kunde.select(AND(func.lower(Kunde.q.vorname)=="matthias")).count()
1/QueryOne: SELECT COUNT(*) FROM kunde WHERE ((lower(kunde.vorname)) =
('matthias'))
1/QueryR : SELECT COUNT(*) FROM kunde WHERE ((lower(kunde.vorname)) =
('matthias'))
Out[27]: 25L
In [28]: Kunde.select(AND(func.lower(Kunde.q.vorname)==u"mathias")).count()
1/QueryOne: SELECT COUNT(*) FROM kunde WHERE ((lower(kunde.vorname)) =
('mathias'))
1/QueryR : SELECT COUNT(*) FROM kunde WHERE ((lower(kunde.vorname)) =
('mathias'))
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most recent
call last)
[...]
TypeError: argument 1 must be str, not unicode
Is this a known bug? Is there a workaround? Am I doing something wrong?
BTW: Most my SQLObject related Unicode problem disappeared after I switch to
postgresql.
Mathias
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss