Re: [sqlite] Query Problems - Keyword? Encoding?

2011-09-29 Thread Eric Anderson
On Thu, Sep 29, 2011 at 8:42 PM, David Garfield wrote: > If the value in key is a blob, then like matches it and = does not. Thanks. This suggestion helped me track down the issue. I was actually going through ActiveRecord (the ORM for Ruby on Rails). Was upgrading

Re: [sqlite] Query Problems - Keyword? Encoding?

2011-09-29 Thread Jay A. Kreibich
On Thu, Sep 29, 2011 at 08:32:04PM -0400, Eric Anderson scratched on the wall: > The below statement returns records: > > SELECT * FROM recordings WHERE "key" LIKE > '4df0247ce1a97685a782d2cb051b48ed952e666c'; > > But this one does not: > > SELECT * FROM recordings WHERE "key" = >

Re: [sqlite] Query Problems - Keyword? Encoding?

2011-09-29 Thread David Garfield
If the value in key is a blob, then like matches it and = does not. Because like has to do a string conversion on key, it also doesn't use the index. Try: SELECT * FROM recordings WHERE "key" = cast('4df0247ce1a97685a782d2cb051b48ed952e666c' as blob); Or try inserting the key as text in the

[sqlite] Query Problems - Keyword? Encoding?

2011-09-29 Thread Eric Anderson
The below statement returns records: SELECT * FROM recordings WHERE "key" LIKE '4df0247ce1a97685a782d2cb051b48ed952e666c'; But this one does not: SELECT * FROM recordings WHERE "key" = '4df0247ce1a97685a782d2cb051b48ed952e666c'; The only difference is that = and LIKE have been swapped. I