Salvar dados da imagem no banco de dados sqlite no iphone

Quero salvar os dados da imagem no meu banco de dados sqlite, mas não consigo ...

- (void) SaveData: (Article*) article :(NSMutableArray*) rssList
{
    sqlite3_stmt *statement;

    if (sqlite3_open([self.dataBasePath UTF8String], &articlesDB) == SQLITE_OK)
    {
        NSString* sqlFormat = @"INSERT INTO ARTICLES (guid, title, summary, mainLink, pubDate, author, imageLink, body, favorites, smallImage) VALUES ('%@', '%@', '%@', '%@', '%@', '%@', '%@', '%@', '%@', ?)";
        // Correct summary.
        NSString* summary = [NSString stringWithString:article.summary];
        summary           = [summary stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
        // Correct title
        NSString* title   = [NSString stringWithString:article.title];
        title             = [title stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
        // Correct Body
        NSString* body    = [NSString stringWithString:article.body];
        //body              = [body stringByReplacingOccurrencesOfString:@"'" withString:@"''"];
        // Create Insert SQL query.
        NSString* insertSQL = [NSString stringWithFormat:sqlFormat, article.guid, title, summary, article.mainLink, article.pubDate, article.author, article.imageLink, body, article.favorite ? @"YES" : @"NO"];
        // Add to database.
        sqlite3_prepare_v2(articlesDB, [insertSQL UTF8String], -1, &statement, NULL);
        if (sqlite3_step(statement) == SQLITE_DONE)
        {
            // Add to list.
            [rssList addObject:article];
            // Write Log.
            NSLog( @"Article added ... " );
        } 
        else
        {
            NSLog( @"Failed to add article. Error is:  %s", sqlite3_errmsg(articlesDB) );
        }

        sqlite3_finalize(statement);
        sqlite3_close(articlesDB);
    }
}

Você pode ver que tenho consulta e, no final, tenho smallimage e value (?)

@"INSERT INTO ARTICLES (guid, title, summary, mainLink, pubDate, author, imageLink, body, favorites, smallImage) VALUES ('%@', '%@', '%@', '%@', '%@', '%@', '%@', '%@', '%@', ?)";

Eu tenho uma função que deve atualizar o valor da imagem em algum lugar do meu programa: Nesta função, seleciono a linha com o URL do link da imagem quando tento gravar dados na última coluna "SMALLIMAGE", mas sem resultado ... Quando abro meu banco de dados arquivo com editor eu vejo na última linha apenas "NULL" como se meus dados não fossem salvos ...

- (void) SaveSmallImage: (NSData*) imgData :(NSString*) mainUrl
{
    if (sqlite3_open([self.dataBasePath UTF8String], &articlesDB) == SQLITE_OK) 
    {
        NSString* sqliteQuery = [NSString stringWithFormat:@"SELECT * FROM ARTICLES WHERE IMAGELINK =  '%@'", mainUrl]; 
        sqlite3_stmt* statement;

        if( sqlite3_prepare_v2(articlesDB, [sqliteQuery UTF8String], -1, &statement, NULL) == SQLITE_OK ) 
        {
            sqlite3_bind_blob(statement, 9, [imgData bytes], [imgData length], SQLITE_TRANSIENT);
            sqlite3_step(statement);
        }
        else
        {
            NSLog( @"SaveBody: Failed from sqlite3_prepare_v2. Error is:  %s", sqlite3_errmsg(articlesDB) );
        }

        // Finalize and close database.
        sqlite3_finalize(statement);
        sqlite3_close(articlesDB);
    }
    else 
    {
        NSLog(@"SaveSmallImage: Failed from sqlite3_open. Error is: %s", sqlite3_errmsg(articlesDB) );
    }
}

Quem pode me dizer o que eu faço de errado ...

questionAnswers(3)

yourAnswerToTheQuestion