Quote:
Originally Posted by nestedloop
Please post code of your Update method (the one where you update the data in the DB).
|
- (void) updateData {
if(updateStmt == nil) {
const char *sql = "update tbl Set f1 = ?,f2 = ?,f3 = ?,f4 = ?,f5= ?,f6 = ? Where ID = ?";
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, [name UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 2, [a UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 3, [b UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 4, [c UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 5, [d UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_text(updateStmt, 6, [he UTF8String], -1, SQLITE_TRANSIENT);
sqlite3_bind_int(updateStmt, 7, uniqueId);
if(SQLITE_DONE != sqlite3_step(updateStmt))
NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database));
else
//SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid
//uniqueId = sqlite3_last_insert_rowid(database);
//Reset the add statement.
sqlite3_reset(updateStmt);