From fd16fc8212a706ab6de53863862b5bb28ddc5c71 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 15 Oct 2009 14:48:41 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20issue=20while=20copying=20a=20very?= =?UTF-8?q?=20large=20number=20queries=20from=20the=20Console=20Log=20wind?= =?UTF-8?q?ow=20-=20make=20usage=20of=20a=20NSMutableString=20to=20speed?= =?UTF-8?q?=20it=20up=20and=20to=20avoid=20crashes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPQueryController.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 3a3a2982..25b972bb 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -172,11 +172,15 @@ static SPQueryController *sharedQueryController = nil; if ((firstResponder == consoleTableView) && ([consoleTableView numberOfSelectedRows] > 0)) { - NSString *string = @""; + NSMutableString *string = [NSMutableString string]; NSIndexSet *rows = [consoleTableView selectedRowIndexes]; NSUInteger i = [rows firstIndex]; + BOOL dateColumnIsHidden = [[consoleTableView tableColumnWithIdentifier:TABLEVIEW_DATE_COLUMN_IDENTIFIER] isHidden]; + + [string setString:@""]; + while (i != NSNotFound) { if (i < [messagesVisibleSet count]) { @@ -185,14 +189,14 @@ static SPQueryController *sharedQueryController = nil; NSString *consoleMessage = [message message]; // If the timestamp column is not hidden we need to include them in the copy - if (![[consoleTableView tableColumnWithIdentifier:TABLEVIEW_DATE_COLUMN_IDENTIFIER] isHidden]) { + if (!dateColumnIsHidden) { NSString *dateString = [[message messageDate] descriptionWithCalendarFormat:MESSAGE_TIME_STAMP_FORMAT timeZone:nil locale:nil]; consoleMessage = [NSString stringWithFormat:@"/* MySQL %@ */ %@", dateString, consoleMessage]; } - string = [string stringByAppendingFormat:@"%@\n", consoleMessage]; + [string appendFormat:@"%@\n", consoleMessage]; } i = [rows indexGreaterThanIndex:i]; -- cgit v1.2.3