aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/SPMySQLFramework
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-10-08 14:52:23 +0200
committerMax <post@wickenrode.com>2015-10-08 14:52:23 +0200
commit71c013de73875aa69d727fe6a4dde8a23a381f23 (patch)
tree4b85cdb59e29191a99479868af063fe054d62579 /Frameworks/SPMySQLFramework
parent1dedadcaba2cd474a251a24d893dc3b7b2a719a7 (diff)
downloadsequelpro-71c013de73875aa69d727fe6a4dde8a23a381f23.tar.gz
sequelpro-71c013de73875aa69d727fe6a4dde8a23a381f23.tar.bz2
sequelpro-71c013de73875aa69d727fe6a4dde8a23a381f23.zip
Move a mysql_affected_rows() to see how the 0x338 crash behaves (#2258)
Diffstat (limited to 'Frameworks/SPMySQLFramework')
-rw-r--r--Frameworks/SPMySQLFramework/Source/SPMySQLConnection Categories/Querying & Preparation.m8
1 files changed, 7 insertions, 1 deletions
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