Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34689 > unrolled thread

Re: MySQLdb compare lower

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2012-12-12 02:03 -0500
Last post2012-12-12 02:03 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: MySQLdb compare lower Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-12-12 02:03 -0500

#34689 — Re: MySQLdb compare lower

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-12-12 02:03 -0500
SubjectRe: MySQLdb compare lower
Message-ID<mailman.773.1355295822.29569.python-list@python.org>
On Tue, 11 Dec 2012 22:01:18 +0100, Anatoli Hristov <tolidtm@gmail.com>
declaimed the following in gmane.comp.python.general:

> 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 ?
>
	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 suppose one may encounter a MySQL database where the system
default has been configured to be case sensitive

	The other option might be to run a (hopefully) one-time update
operation:

update theTable set SKU = LOWER(SKU);

and then ensure that any user input is forced to lowercase before it
gets into the database.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web