|XP is just a number|
"Cannot use index" with DBD::SQLiteby LonelyPilgrim (Beadle)
|on Jan 29, 2013 at 20:24 UTC||Need Help??|
LonelyPilgrim has asked for the
wisdom of the Perl Monks concerning the following question:
Hail, great masters. I have returned after a long sojourn, in which I have traveled far in the paths of Perl, but am still very much a novice.
I am especially a newb to database work, and am trying to catch myself up. I feel like I am probably making a very simple and laughable mistake, so I only come to you after hours spent beating my head against this in futility, much google-searching, and throwing up my hands.
I am working with SQLite3 and DBD::SQLite (on WinXP, with ActivePerl 5.14.2), and have a fairly simple situation in which I have a table "profile," with integer primary key "profile_id", and another column "name". I want to do lookups on this table by "name", so I created an index "idx_name":CREATE INDEX idx_name ON profile (name COLLATE NOCASE DESC);
Queries on this index work just fine when testing them on the SQLite command line:SELECT profile_id ON profile INDEXED BY idx_name WHERE name == 'William';
However, when I try to run this in Perl, I get an error:
DBD::SQLite::db prepare failed: cannot use index: idx_name
What am I doing wrong? I appreciate your patience.