From 71c013de73875aa69d727fe6a4dde8a23a381f23 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 8 Oct 2015 14:52:23 +0200 Subject: Move a mysql_affected_rows() to see how the 0x338 crash behaves (#2258) --- .../Source/SPMySQLConnection Categories/Querying & Preparation.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Frameworks/SPMySQLFramework') diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m index 1b7ec58e..2abb8a35 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m @@ -288,6 +288,7 @@ // 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 @@ -296,6 +297,11 @@ 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) { @@ -327,11 +333,11 @@ return nil; } [self _lockConnection]; + NSAssert(mySQLConnection != NULL, @"mySQLConnection has disappeared while checking it!"); queryAttemptsAllowed--; } - unsigned long long theAffectedRowCount = mysql_affected_rows(mySQLConnection); id theResult = nil; // On success, if there is a query result, retrieve the result data type -- cgit v1.2.3