views:

490

answers:

2

When I run the following query in an iPhone app

@"select name, identifier, score, delta from startups order by name ASC"

I get the following error in my logs:

sqlite error: no such column: score

However, running pragma table_info(startups) in my sqlite3 database yields the following:

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've run clean and build several times, triple-checked the db, and cannot figure out why this error is appearing. Any help would be awesome.

Thanks, StackOverflow!

A: 

Have you tried surrounding 'score' with square brackets? (in case it's a reserved word):

@"select name, identifier, [score], delta from startups order by name ASC"
Mitch Wheat
+2  A: 

Nevermind - problem was that the iPhone simulator was caching the sqlite3 database. Clean and build did not remove this cached sqlite3 version. Had to manually go in and rm -rf the app directory under

/Users/username/Library/Application Support/iPhone Simulator/User/Applications

Then it got rebuilt, the database was re-copied, and everything was hunky-dory.

Thanks for the help!

Andrew Evans