I am trying to update SQLite table but getting following error. Following is my code.
I have closed the database connection as suggested in earlier threads but getting the same error. Any help would be appreciated
-(bool)updateRecord:(NSString *)strRowID :(NSString *)strFilePath :(NSString *)strStatus
{
sqlite3 *objsqlite3temp;
const char *dbpath = [DATABASE_PATH UTF8String];
if (sqlite3_open(dbpath, &objsqlite3temp) == SQLITE_OK)
{
NSString *updatetSQL = [NSString stringWithFormat:@"UPDATE files set status='%@', path='%@' WHERE id = %@", strStatus,strFilePath,strRowID];
const char *insert_stmt = [updatetSQL UTF8String];
sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(objsqlite3temp, insert_stmt, -1, &selectstmt, NULL) == SQLITE_OK)
{
while(sqlite3_step(selectstmt) == SQLITE_ROW)
{
// NSLog(@"Entered and return");
sqlite3_close(objsqlite3temp);
}
}
else
{
NSLog(@"Error message %s",sqlite3_errmsg(objsqlite3temp));
}
//ADD THIS LINE TO YOUR CODE
sqlite3_finalize(selectstmt);
}
else
{
sqlite3_close(objsqlite3temp); //Even though the open call failed, close the database connection to release all the memory.
}
return YES;
}
Aucun commentaire:
Enregistrer un commentaire