Page 1 of 1

sqlite administrator: querying boolean fields

Posted: 24.02.2009, 17:17
by JCollum
I've set up a table called Photos. In that table there are two boolean fields, Public and Active. No rocket science here. However, when I query on those fields I get no records back (within SQLite admin).

-- 4 rows, with Active and Public = true for all
SELECT pics$.Caption, pics$.Id, pics$.Path, pics$.Public, pics$.Active
FROM main.Pictures pics$

-- no rows
SELECT pics$.Caption, pics$.Id, pics$.Path, pics$.Public, pics$.Active
FROM main.Pictures pics$
where pics$.Active = 1

-- also no rows
SELECT pics$.Caption, pics$.Id, pics$.Path, pics$.Public, pics$.Active
FROM main.Pictures pics$
where pics$.Active = '1'


Is this a bug in the SQLite Admin tool? I'm going to try a different tool and see... But it could be my query that's the problem. Also, the dollar signs are weird, they're generated by DbLinq tho.

Posted: 24.02.2009, 21:22
by JCollum
Not a bug, but could be improved. When I assigned a default for the BOOLEAN field, I put in 1, when it should have been Y. So the fix for the query was to use ='Y'. Dblinq was generating ='TRUE' instead of ='Y'.