I am not sure if this is your issue exactly but I had similar problems when I 
started on SQLite a while ago. It turned out that my table definition was 
case-sensitive and therefore = was not working for me and I had to use LIKE. I 
changed my table definition with COLLATE NO CASE and the problem was solved, 
that is, = worked. Another problem in using LIKE was very slow search (as 
indices do not work with LIKE).


-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Davies
Sent: Friday, April 30, 2010 9:06 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] WHERE = does not work

On 30 April 2010 16:56, ecforu <ecforus...@gmail.com> wrote:
> this was my first thought so I did a dump to a file and looked at in hex -
> there were no extra characters.  I even tried looking at the db file with a
> hex editor and I could see the PSM text and no extra characters around it
> (except the NULLs on either side which I assume separates the columns).
>
>

.dump does not preserve nulls in text fields:

SQLite version 3.6.11
Enter ".help" for instructions
sqlite>
sqlite> create table tst( t timestamp, resType text );
sqlite> insert into tst values( datetime( 'now' ), 'PSM' );
sqlite> insert into tst values( datetime( 'now' ), 'PSM'||X'00' );
sqlite>
sqlite> insert into tst values( datetime( 'now' ), 'PSM'||X'00'||'more text' );
sqlite>
sqlite> .dump
BEGIN TRANSACTION;
CREATE TABLE tst( t timestamp, resType text );
INSERT INTO "tst" VALUES('2010-04-30 16:01:07','PSM');
INSERT INTO "tst" VALUES('2010-04-30 16:01:07','PSM');
INSERT INTO "tst" VALUES('2010-04-30 16:03:40','PSM');
COMMIT;
sqlite>
sqlite> select hex( resType ) from tst;
50534D
50534D00
50534D006D6F72652074657874
sqlite>

try
SELECT hex( resType ) FROM MyTable;

Regards,
Simon
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to