Re: MySQLdb compare lower

2012-12-14 Thread Chris Angelico
On Sat, Dec 15, 2012 at 8:49 AM, Dennis Lee Bieber wrote: > On Fri, 14 Dec 2012 15:16:54 +1100, Chris Angelico > declaimed the following in gmane.comp.python.general: > >> Yeah, it's one of the things that tripped me up when I did a >> MySQL->PostgreSQL conversion earlier this year. The code was

Re: MySQLdb compare lower

2012-12-13 Thread Frank Millman
On 14/12/2012 06:16, Chris Angelico wrote: Yeah, it's one of the things that tripped me up when I did a MySQL->PostgreSQL conversion earlier this year. The code was assuming case insensitivity, and began failing on PG. Fortunately the simple change of LIKE to ILIKE solved that. I'd MUCH rather

Re: MySQLdb compare lower

2012-12-13 Thread Chris Angelico
On Fri, Dec 14, 2012 at 2:35 PM, Cameron Simpson wrote: > On 13Dec2012 18:39, Dennis Lee Bieber wrote: > | On Thu, 13 Dec 2012 18:00:48 +1100, Cameron Simpson > | declaimed the following in gmane.comp.python.general: > | > On 12Dec2012 02:03, Dennis Lee Bieber wrote: > | > | According to the

Re: MySQLdb compare lower

2012-12-13 Thread Cameron Simpson
On 13Dec2012 18:39, Dennis Lee Bieber wrote: | On Thu, 13 Dec 2012 18:00:48 +1100, Cameron Simpson | declaimed the following in gmane.comp.python.general: | > On 12Dec2012 02:03, Dennis Lee Bieber wrote: | > | According to the old "MySQL Language Reference" | > | """ | > | By default, string

Re: MySQLdb compare lower

2012-12-12 Thread Cameron Simpson
On 12Dec2012 02:03, Dennis Lee Bieber wrote: | According to the old "MySQL Language Reference" | """ | By default, string comparisons are not case sensitive and will use the | current character set (ISO-8859-1 Latin1 by default, which also works | excellently for English). | """ I'm flabbe

Re: MySQLdb compare lower

2012-12-11 Thread Cameron Simpson
On 11Dec2012 22:01, Anatoli Hristov wrote: | Excuse me for the noob question, but is there a way to compare a field | in mysql as lower() somehow? | | I have a situation where I compare the SKU in my DB and there are some | SKU that are with lowercase and some with uppercase, how can I solve | th

Re: MySQLdb compare lower

2012-12-11 Thread Anatoli Hristov
> I think this will work: > > sql = 'UPDATE product SET price=%s WHERE LOWER(sku)=%s' > cursor.execute(sql, (price, sku.lower()) > Thanks John, this works, I was about to make double check with lower and upper, but this saves me :) Thanks a lot. -- http://mail.python.org/mailman/listinfo/

Re: MySQLdb compare lower

2012-12-11 Thread John Gordon
In Anatoli Hristov writes: > I have a situation where I compare the SKU in my DB and there are some > SKU that are with lowercase and some with uppercase, how can I solve > this in your opinion ? > def Update_SQL(price, sku): > db = MySQLdb.connect("localhost","getit","opencart", > use_un

MySQLdb compare lower

2012-12-11 Thread Anatoli Hristov
Hello guys, Excuse me for the noob question, but is there a way to compare a field in mysql as lower() somehow? I have a situation where I compare the SKU in my DB and there are some SKU that are with lowercase and some with uppercase, how can I solve this in your opinion ? def Update_SQL(price,