Search code examples
iphoneobjective-ciossqlitefmdb

SQLite. Can't add more than 1000 rows


I'm trying to add to my SQLite database (with fmdb) 10k rows but writing is stopped on 1000 row. And I have no any errors or warnings. My code:

NSString *queryString = [NSString stringWithFormat:@"insert into histories (storyid, text, date, storyurl) values (%li, ?, ?, ?)",history.storyIndex];
if ([self.db open]) {
    if([self.db executeUpdate:queryString, history.storyText, history.storyDate, history.storyUrl]) {
        NSLog(@"history added");
    } 
}

Any suggestions?


Solution

  • Can you try the following code and see if there is any change:

    NSString *queryString = @"INSERT INTO histories (storyid, text, date, storyurl) 
    VALUES ( ?, ?, ?, ?)";
    
    BOOL executeUpdateStatus = NO;
    
    if ([self.db open]) 
    {
        executeUpdateStatus = [self.db executeUpdate:queryString, 
        [NSNumber numberWithLong:history.storyIndex], history.storyText,
        history.storyDate, history.storyUrl];
    
    
            if(executeUpdateStatus == YES)   
                NSLog(@"history added");
            else
                NSLog(@"history NOT added");
    }