Author serhiy.storchaka
Recipients berker.peksag, ghaering, serhiy.storchaka
Date 2019-09-16.10:00:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1568628011.92.0.862406558941.issue38185@roundup.psfhosted.org>
In-reply-to
Content
sqlite3.Row can be indexed by integers and by strings. In the latter case string matching is case insensitive. But the code that implements this is too simple-minded. It compares UTF-8 representation of two strings ignoring some bit. It works for ASCII letters, but has weird behavior for digits, '_' and non-ASCII characters.

For example:

>>> import sqlite3
>>> con = sqlite3.connect(":memory:")
>>> con.row_factory = sqlite3.Row
>>> row = con.execute("select 1 as a_1").fetchone()
>>> row['a_1']
1
>>> row['A_1']
1
>>> row['A_\x11']
1
>>> row['A\x7f1']
1
>>> row = con.execute("select 1 as ÿ").fetchone()
>>> row["ÿ"]
1
>>> row["Ÿ"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: No item with that key
>>> row["ß"]
1
History
Date User Action Args
2019-09-16 10:00:11serhiy.storchakasetrecipients: + serhiy.storchaka, ghaering, berker.peksag
2019-09-16 10:00:11serhiy.storchakasetmessageid: <1568628011.92.0.862406558941.issue38185@roundup.psfhosted.org>
2019-09-16 10:00:11serhiy.storchakalinkissue38185 messages
2019-09-16 10:00:11serhiy.storchakacreate