IPhone SQLite3 problem - "No such column"
When I run the following request in the iPhone app
@"select name, identifier, score, delta from startups order by name ASC"
The following error appears in my logs:
sqlite error: no such column: score
However, running pragma table_info (startups) on my sqlite3 database gives this:
sqlite> pragma table_info(startups);
0|id|INTEGER|0||1
1|name|TEXT|0||0
2|identifier|TEXT|0||0
3|score|DOUBLE|0|'0'|0
4|delta|DOUBLE|0|'0'|0
5|cached|INTEGER|0|'0'|0
I run clean and build several times, checked the db three times and can't figure out why this error appears. Any help would be awesome.
Thanks StackOverflow!
Nevermind - The problem was the iPhone simulator was caching the sqlite3 database. Cleanliness and build did not remove this cached sqlite3 version. Had to manually enter and rm -rf into the application directory in
/ Users / username / Library / Application Support / iPhone Simulator / User / Applications
Then it was rebuilt, the database was reprogrammed, and things were tough.
Thanks for the help!
Have you tried to surround the "count" with square brackets? (in case it is a reserved word):
@"select name, identifier, [score], delta from startups order by name ASC"