diff options
Diffstat (limited to 'Frameworks')
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h | 1 | ||||
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m | 11 | ||||
-rw-r--r-- | Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m | 5 |
3 files changed, 16 insertions, 1 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h index 0442bf9f..e5de0713 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.h @@ -196,6 +196,7 @@ void performThreadedKeepAlive(void *ptr); - (void)setLastErrorMessage:(NSString *)theErrorMessage; - (NSUInteger)getLastErrorID; + (BOOL)isErrorNumberConnectionError:(NSInteger)theErrorNumber; +- (void)updateErrorStatuses; // Queries - (NSString *)prepareBinaryData:(NSData *)theData; diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m index 7db3ec2d..07ea4c39 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m @@ -1126,6 +1126,15 @@ void performThreadedKeepAlive(void *ptr) return NO; } +/** + * Update error messages - for example after a streaming result has finished processing. + */ +- (void)updateErrorStatuses +{ + [self setLastErrorMessage:nil]; + lastQueryErrorId = mysql_errno(mConnection); +} + #pragma mark - #pragma mark Queries @@ -1405,7 +1414,7 @@ void performThreadedKeepAlive(void *ptr) if (queryCancelled) { queryErrorMessage = [[NSString alloc] initWithString:NSLocalizedString(@"Query cancelled.", @"Query cancelled error")]; - queryErrorId = 1152; + queryErrorId = 1317; } else { queryErrorMessage = [[NSString alloc] initWithString:[self stringWithCString:mysql_error(mConnection)]]; queryErrorId = mysql_errno(mConnection); diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m index 99150527..4fde472d 100644 --- a/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m +++ b/Frameworks/MCPKit/MCPFoundationKit/MCPStreamingResult.m @@ -170,6 +170,11 @@ // once all memory has been freed if (processedRowCount == downloadedRowCount) { while (!dataFreed) usleep(1000); + + // Update the connection's error statuses in case of error during content download + [parentConnection updateErrorStatuses]; + + // Unlock the connection and return [parentConnection unlockConnection]; connectionUnlocked = YES; return nil; |