[Tutor] Strange sqlite3 behavior
mail at timgolden.me.uk
Sat Jul 17 11:04:49 CEST 2010
On 17/07/2010 8:10 AM, Lang Hurst wrote:
> I just had the weirdest issue with sqlite3. I was trying to update a
> field to "Active". I have a little database of students and sometimes
> they get sent to juvi, or just check out for a couple of months and show
> back up. Anyway, I wanted to just have a field that had either "Active"
> or "Inactive". I know, could go all boolean, but wanted to leave my
> options open.
> Anyway, my code was along the lines of
> UPDATE students SET active="Inactive" where id="123456"
> That would work, but
> UPDATE students SET active="Active" where id="123456"
> wouldn't. It wouldn't do anything, the field still held "Inactive".
My guess -- without bothering to check the sqlite docs -- is that
sqlite uses single quotes to delimit strings and double quotes to
delimit column. Or at least that it can be set up to do that. If
that is the case then "Active" is taken to refer to the column
active and not to the string active. So you're just setting it
Try it with 'Active' instead.
More information about the Tutor