Use sqlite3_last_insert_rowid to get last row id (will only be called by one thread)