Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 794
shivam Avatar asked Jan 15 '23 01:01

shivam


1 Answers

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
}
like image 91
Pascal Avatar answered Jan 30 '23 23:01

Pascal