sqlite3 update text in uitextview

Posted by summer on Stack Overflow See other posts from Stack Overflow or by summer
Published on 2010-03-22T03:53:39Z Indexed on 2010/03/22 4:01 UTC
Read the original article Hit count: 484

i had the sqlite statement ready for update..but i am confuse about grabbing text from uitextview and updating it..and i waned to update it using a uibutton..how do i carry on after creating the sql statement???kinda lost..any new solution is appreciate..

- (void) saveAllData {

if(isDirty) {

    if(updateStmt == nil) {
        const char *sql = "update Snap Set snapTitle = ?, snapDesc = ?, Where snapID = ?";
        if(sqlite3_prepare_v2(database, sql, -1, &updateStmt, NULL) != SQLITE_OK)
            NSAssert1(0, @"Error while creating update statement. '%s'", sqlite3_errmsg(database));
    }

    sqlite3_bind_text(updateStmt, 1, [snapTitle UTF8String], -1, SQLITE_TRANSIENT);
    sqlite3_bind_text(updateStmt, 2, [snapDescription UTF8String], -2, SQLITE_TRANSIENT);
    sqlite3_bind_int(updateStmt, 3, snapID);
        if(SQLITE_DONE != sqlite3_step(updateStmt))
        NSAssert1(0, @"Error while updating. '%s'", sqlite3_errmsg(database));

    sqlite3_reset(updateStmt);

    isDirty = NO;
}

//Reclaim all memory here.
[snapTitle release];
snapTitle = nil;
[snapDescription release];
snapDescription = nil;

//isDetailViewHydrated = NO;

}

© Stack Overflow or respective owner

Related posts about sqlite3

Related posts about iphone