From f6da47de43fce8af785dfdc4672ebbb18f7ff118 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Fri, 12 Jun 2009 18:23:34 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20position=20for=20scanning=20error?= =?UTF-8?q?=202006=20to=20increase=20max=5Fallowed=5Fpacket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMMCPConnection.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/CMMCPConnection.m b/Source/CMMCPConnection.m index 624ad6c3..db45a3d8 100644 --- a/Source/CMMCPConnection.m +++ b/Source/CMMCPConnection.m @@ -664,16 +664,16 @@ static void forcePingTimeout(int signalNumber); // If there was an error, check whether it was a connection-related error if (0 != queryResultCode && [CMMCPConnection isErrorNumberConnectionError:[self getLastErrorID]]) { - // Check the connection and see if it can be restored. This triggers reconnects as necessary, and - // should only return false if a disconnection has been requested - in which case return nil. - if (![self checkConnection]) return nil; - - // Try to increase max_allowed_packet for error 2006 + // Try to increase max_allowed_packet for error 2006 BEFORE check connection if(isMaxAllowedPacketEditable && queryResultCode == 1 && [self getLastErrorID] == 2006) { currentMaxAllowedPacket = [self getMaxAllowedPacket]; - [self setMaxAllowedPacketTo:strlen([self cStringFromString:query])+1024]; + [self setMaxAllowedPacketTo:strlen(theCQuery)+1024]; } + // Check the connection and see if it can be restored. This triggers reconnects as necessary, and + // should only return false if a disconnection has been requested - in which case return nil. + if (![self checkConnection]) return nil; + // The connection has been restored - re-run the query queryStartDate = [NSDate date]; queryResultCode = mysql_query(mConnection, theCQuery); -- cgit v1.2.3