keenlabs / KeenClient-iOS

Official iOS client for the Keen IO API. Build analytics features directly into your iOS apps.
https://keen.io/docs
MIT License
78 stars 56 forks source link

KIODBStore hasQueryWithMaxAttempts: closes DB unnecessarily #194

Closed baumatron closed 7 years ago

baumatron commented 7 years ago

This method closes the db when it doesn't find a query record that exceeds max query attempts. In this case SQLITE_ROW isn't returned, but rather SQLITE_DONE. When returning SQLITE_DONE, the method should not call handleSQLiteFailure:.

if (keen_io_sqlite3_step(get_query_with_attempts_stmt) == SQLITE_ROW) {
    hasFoundEventWithMaxAttempts = YES;
    } else {
        [self handleSQLiteFailure:@"find query with max attempts"];
        return;
}

It shouldn't close the db, but just return NO.