Message352533
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 |
|
Date |
User |
Action |
Args |
2019-09-16 10:00:11 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, ghaering, berker.peksag |
2019-09-16 10:00:11 | serhiy.storchaka | set | messageid: <1568628011.92.0.862406558941.issue38185@roundup.psfhosted.org> |
2019-09-16 10:00:11 | serhiy.storchaka | link | issue38185 messages |
2019-09-16 10:00:11 | serhiy.storchaka | create | |
|