diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMTextView.m | 13 | ||||
-rw-r--r-- | Source/TableDocument.m | 10 | ||||
-rw-r--r-- | Source/TableDump.m | 2 | ||||
-rw-r--r-- | Source/TableSource.m | 14 |
4 files changed, 13 insertions, 26 deletions
diff --git a/Source/CMTextView.m b/Source/CMTextView.m index 045c8ab6..6e55ec6b 100644 --- a/Source/CMTextView.m +++ b/Source/CMTextView.m @@ -311,7 +311,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) [allDbs addObject:db]; NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; - NSMutableArray *sortedDbs = [[NSMutableArray array] autorelease]; + NSMutableArray *sortedDbs = [NSMutableArray array]; [sortedDbs addObjectsFromArray:[allDbs sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]]; NSString *currentDb = nil; @@ -1113,6 +1113,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSArray *allTables = [[dbs objectForKey:currentDb] allKeys]; NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; NSArray *sortedTables = [allTables sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + [desc release]; for(id table in sortedTables) { NSDictionary * theTable = [[dbs objectForKey:currentDb] objectForKey:table]; NSInteger structtype = [[theTable objectForKey:@" struct_type "] intValue]; @@ -1164,6 +1165,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSArray *allFields = [theTable allKeys]; NSSortDescriptor *desc = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES selector:@selector(localizedCompare:)]; NSArray *sortedFields = [allFields sortedArrayUsingDescriptors:[NSArray arrayWithObject:desc]]; + [desc release]; for(id field in sortedFields) { if(![field hasPrefix:@" "]) { NSString *typ = [theTable objectForKey:field]; @@ -1191,7 +1193,6 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) } } } - [desc release]; } else { arr = [NSArray arrayWithArray:[[[[self window] delegate] valueForKeyPath:@"tableDataInstance"] valueForKey:@"columnNames"]]; if(arr == nil) { @@ -1584,23 +1585,21 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse) NSData *errdata = [stderr_file readDataToEndOfFile]; if(outdata != nil) { - NSString *stdout = [[[NSString alloc] initWithData:outdata encoding:NSUTF8StringEncoding] description]; - NSString *error = [[[NSString alloc] initWithData:errdata encoding:NSUTF8StringEncoding] description]; + NSString *stdout = [[NSString alloc] initWithData:outdata encoding:NSUTF8StringEncoding]; + NSString *error = [[[NSString alloc] initWithData:errdata encoding:NSUTF8StringEncoding] autorelease]; if(bashTask) [bashTask release]; if(stdout != nil) { if (status == 0) { return [stdout autorelease]; } else { - NSString *error = [[[NSString alloc] initWithData:errdata encoding:NSUTF8StringEncoding] description]; + NSString *error = [[[NSString alloc] initWithData:errdata encoding:NSUTF8StringEncoding] autorelease]; SPBeginAlertSheet(NSLocalizedString(@"BASH Error", @"bash error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, [self window], self, nil, nil, nil, [NSString stringWithFormat:@"%@ “%@”:\n%@", NSLocalizedString(@"Error for", @"error for message"), command, [error description]]); [stdout release]; - [error release]; NSBeep(); return @""; } } else { - if(stdout) [stdout release]; NSLog(@"Couldn't read return string from “%@” by using UTF-8 encoding.", command); NSBeep(); } diff --git a/Source/TableDocument.m b/Source/TableDocument.m index d021ae5c..24636bf3 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -1755,8 +1755,6 @@ // Process result if([selectedItems count] == 1) { - message = @""; - NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Check table successfully passed.",@"check table successfully passed message") : NSLocalizedString(@"Check table failed.", @"check table failed message"); @@ -1832,8 +1830,6 @@ // Process result if([selectedItems count] == 1) { - message = @""; - NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully analyzed table.",@"analyze table successfully passed message") : NSLocalizedString(@"Analyze table failed.", @"analyze table failed message"); @@ -1909,8 +1905,6 @@ // Process result if([selectedItems count] == 1) { - message = @""; - NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully optimized table.",@"optimize table successfully passed message") : NSLocalizedString(@"Optimize table failed.", @"optimize table failed message"); @@ -1985,8 +1979,6 @@ // Process result if([selectedItems count] == 1) { - message = @""; - NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully repaired table.",@"repair table successfully passed message") : NSLocalizedString(@"Repair table failed.", @"repair table failed message"); @@ -2061,8 +2053,6 @@ // Process result if([selectedItems count] == 1) { - message = @""; - NSDictionary *lastresult = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; message = ([[lastresult objectForKey:@"Msg_type"] isEqualToString:@"status"]) ? NSLocalizedString(@"Successfully flushed table.",@"flush table successfully passed message") : NSLocalizedString(@"Flush table failed.", @"flush table failed message"); diff --git a/Source/TableDump.m b/Source/TableDump.m index fb42c7f2..adc28259 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -2535,7 +2535,7 @@ NSMutableString *errors = [NSMutableString string]; NSStringEncoding connectionEncoding = [mySQLConnection encoding]; NSMutableString *csvLineEnd; - NSDictionary *tableDetails; + NSDictionary *tableDetails = nil; NSMutableArray *tableColumnNumericStatus; // Reset the interface diff --git a/Source/TableSource.m b/Source/TableSource.m index e6d2d170..4694d14c 100644 --- a/Source/TableSource.m +++ b/Source/TableSource.m @@ -1128,6 +1128,7 @@ returns a dictionary containing enum/set field names as key and possible values NSMutableArray *tempResult2 = [NSMutableArray array]; NSString *nullValue = [prefs stringForKey:SPNullValue]; + CFStringRef escapedNullValue = CFXMLCreateStringByEscapingEntities(NULL, ((CFStringRef)nullValue), NULL); MCPResult *structureQueryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM %@", [selectedTable backtickQuotedString]]]; MCPResult *indexesQueryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW INDEXES FROM %@", [selectedTable backtickQuotedString]]]; @@ -1156,9 +1157,7 @@ returns a dictionary containing enum/set field names as key and possible values for (j = 0; j < [row count]; j++) { if ([[row objectAtIndex:j] isNSNull]) { - - // Replace the NULL instance with an escaped version of the user's placeholder - [row replaceObjectAtIndex:j withObject:(NSString *)CFXMLCreateStringByEscapingEntities(NULL, ((CFStringRef)nullValue), NULL)]; + [row replaceObjectAtIndex:j withObject:(NSString *)escapedNullValue]; } } @@ -1166,7 +1165,7 @@ returns a dictionary containing enum/set field names as key and possible values [row release]; } - + for (i = 0; i < [indexesQueryResult numOfRows]; i++) { NSMutableArray *index = [[indexesQueryResult fetchRowAsArray] mutableCopy]; @@ -1177,9 +1176,7 @@ returns a dictionary containing enum/set field names as key and possible values for (j = 0; j < [index count]; j++) { if ([[index objectAtIndex:j] isNSNull]) { - - // Replace the NULL instance with an escaped version of the user's placeholder - [index replaceObjectAtIndex:j withObject:(NSString *)CFXMLCreateStringByEscapingEntities(NULL, ((CFStringRef)nullValue), NULL)]; + [index replaceObjectAtIndex:j withObject:(NSString *)escapedNullValue]; } } @@ -1187,7 +1184,8 @@ returns a dictionary containing enum/set field names as key and possible values [index release]; } - + + CFRelease(escapedNullValue); return [NSDictionary dictionaryWithObjectsAndKeys:tempResult, @"structure", tempResult2, @"indexes", nil]; } |