shivam
shivam

Reputation: 1140

Getting the number of affected rows in FMDB updation query

I am updating my table with FMDB. How can i get total number of rows that updated. (Actually i have an issue. My update query is returning "true", even i have no data in that table.)

Thanks in Advance. :)

Upvotes: 4

Views: 2075

Answers (1)

Pascal
Pascal

Reputation: 16941

You are looking for:

- (int)changes;

Used like:

FMDatabase *db = [FMDatabase databaseWithPath:@"store.db"];
if ([db executeUpdate:@"UPDATE xy SET ..."]) {
    NSLog(@"Did change %d rows", [db changes]);
}
else {
    // handle error
}

Upvotes: 9

Related Questions