Why doesn't the following example using parameter ? substitution variable use an index?
I've tried a few different methods for but none of them work, what am I missing here?
Python 2.7.15 (default, Jun 17 2018, 12:51:03)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin
>>> import sqlite3
>>> sqlite3.sqlite_version_info
(3, 24, 0)
>>> sqlite3.version_info
(2, 6, 0)
>>> con = sqlite3.connect("/Users/Ade/test.db")
>>> csr = con.cursor()
>>> artist = 'half man half biscuit'
>>> # This works
>>> csr.execute('EXPLAIN QUERY PLAN SELECT Tracktitle FROM tracks WHERE CleanName LIKE ' + '"' + artist + '%' + '"' + '').fetchone()
(3, 0, 0, u'SEARCH TABLE tracks USING INDEX tracks_CleanName_NoCase (CleanName>? AND CleanName<?)')
>>> # This doesn't work
>>> csr.execute('EXPLAIN QUERY PLAN SELECT TrackTitle FROM tracks WHERE CleanName LIKE ?', [artist+'%']).fetchone()
(2, 0, 0, u'SCAN TABLE tracks')