My database is defined as
CREATE TABLE [problems] (
[p_id] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
[problem_name] VARCHAR(255) NOT NULL,
[mixed_t1] INT NOT NULL,
[mixed_t2] INT NOT NULL,
[mixed_flair] INT,
[mixed_gre] INT,
[mixed_diffusion] INT,
[mixed_adc] INT,
[fat_sat_post_t1] INT)
In my code, I am trying to run an SQL query that looks like
SELECT problem_name from problems WHERE mixed_t1=0
Then in the code, I try to assign the name of the problem to NSString and then add NSString to NUSMutableArray
if(sqlite3_step(statement) == SQLITE_ROW)
{
NSString *problemName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(statement, 1)];
[dataSet addObject:problemName];
[problemName release];
}
The problem is that I crashed on NSString * problemName
I get the following alarm message
Current language: auto; currently objective-c
2011-02-08 08:54:29.035 RadAppz[1332:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString'
* Call stack on first throw:
I know that I am receiving data because executing RAW SQL in the terminal returns 2 rows. Can someone please tell me why the data is returned as NULL?