Hello,
I am using the following lines to insert statement .
[self initiateFMDB];
const char * sql =
"INSERT INTO DrawingInfo(title, data, size, red_comp, green_comp, blue_comp) VALUES(?, ?, ?, ?, ?, ?)";
sqlite3_stmt *insert_statement = nil;
int dbrc; // database return code
const char* dbFilePathUTF8 = [path UTF8String];
dbrc = sqlite3_open (dbFilePathUTF8, &database);
if (dbrc) {
NSLog (@"couldn't open db:");
return FALSE;
}
if (sqlite3_prepare_v2(database, sql, -1,&insert_statement, NULL) != SQLITE_OK) {
NSLog(@"Error, failed to prepare statement, normally handle error here.");
return FALSE;
}
initiateFMDB()
is the method used for Initiazing DB .
The problem is that in the line if (sqlite3_prepare_v2(database, sql, -1, &insert_statement, NULL) != SQLITE_OK)
no memory is allocated to &insert_statement
. Can anybody please help me in solving this issue?