loading record into detailview

Posted by summer on Stack Overflow See other posts from Stack Overflow or by summer
Published on 2010-03-12T06:40:18Z Indexed on 2010/03/12 6:47 UTC
Read the original article Hit count: 157

Filed under:
|
|

please please i need help..i think i am lost somewhere..basically i followed the example http://www.iphonesdkarticles.com/2008/10/sqlite-tutorial-loading-data-as.html, but i was stuck with error on reading description..something must had gone wrong some well but i am not very sure how should i solve it. this is my code, actually i dun really have an idea on wat's really going in this code..help please..2days!! no solution!!

- (void) hydrateDetailViewData {
//if detail view is hydrated then do not get it from database
if(isDetailViewHydrated) return;

if(detailStmt == nil) {
    const char *sql = "select snapTitle, snapDesc from Snap where snapID =?";
    if(sqlite3_prepare_v2(database, sql, -1, &detailStmt, NULL) != SQLITE_OK)
        NSAssert1(0, @"Error while creating detail view statement. '%s'", sqlite3_errmsg(database));
    NSLog(@"SQLite= %d", sqlite3_step(detailStmt)); 

}


if(SQLITE_DONE != sqlite3_step(detailStmt)) {


//  NSString *descStr = [[NSString alloc]
                            //initWithString:sqlite3_column_text(detailStmt, 2)];
    NSString *descStr = [NSString stringWithUTF8String:(char *)sqlite3_column_text(detailStmt,2)];
self.snapDescription = descStr;

[descStr release];
}
else
    NSAssert1(0, @"Error getting description of snap2play. '%s'", sqlite3_errmsg(database));

    sqlite3_reset(detailStmt);

    isDetailViewHydrated = YES; //if hydrated, make sure do not get from database again. 
}
}

© Stack Overflow or respective owner

Related posts about sqlite3

Related posts about iphone