fix update and insert checking change bug

The sqlite3_changes should be called to see if there are any changes or not before calling sqlite3_last_insert_rowid.