4

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. :)

shivam
  • 1,148
  • 1
  • 12
  • 28

1 Answers1

9

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
}
Pascal
  • 16,846
  • 4
  • 60
  • 69
  • Great! Please also accept the answer (click the checkmark) so your question is marked as resolved. :) – Pascal Mar 02 '13 at 05:15