Skip to content


Browse files Browse the repository at this point in the history
Move a mysql_affected_rows() to see how the 0x338 crash behaves (#2258)
  • Loading branch information
dmoagx committed Oct 8, 2015
1 parent 1dedadc commit 71c013d
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -288,6 +288,7 @@ - (id)queryString:(NSString *)theQueryString usingEncoding:(NSStringEncoding)the
// Lock the connection while it's actively in use
[self _lockConnection];

unsigned long long theAffectedRowCount;
while (queryAttemptsAllowed > 0) {

// While recording the overall execution time (including network lag!), run
Expand All @@ -296,6 +297,11 @@ - (id)queryString:(NSString *)theQueryString usingEncoding:(NSStringEncoding)the
queryStatus = mysql_real_query(mySQLConnection, queryBytes, queryBytesLength);
queryExecutionTime = _elapsedSecondsSinceAbsoluteTime(queryStartTime);
lastConnectionUsedTime = mach_absolute_time();

// "An integer greater than zero indicates the number of rows affected or retrieved.
// Zero indicates that no records were updated for an UPDATE statement, no rows matched the WHERE clause in the query or that no query has yet been executed.
// -1 indicates that the query returned an error or that, for a SELECT query, mysql_affected_rows() was called prior to calling mysql_store_result()."
theAffectedRowCount = mysql_affected_rows(mySQLConnection);

// If the query succeeded, no need to re-attempt.
if (!queryStatus) {
Expand Down Expand Up @@ -327,11 +333,11 @@ - (id)queryString:(NSString *)theQueryString usingEncoding:(NSStringEncoding)the
return nil;
[self _lockConnection];
NSAssert(mySQLConnection != NULL, @"mySQLConnection has disappeared while checking it!");


unsigned long long theAffectedRowCount = mysql_affected_rows(mySQLConnection);
id theResult = nil;

// On success, if there is a query result, retrieve the result data type
Expand Down

0 comments on commit 71c013d

Please sign in to comment.