diff options
author | rowanbeentje <rowan@beent.je> | 2010-03-13 21:38:30 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-03-13 21:38:30 +0000 |
commit | eb10ee0dd4759e18ed1aee8b119d6e2bafeba8ef (patch) | |
tree | 75d414338786ee33c3f171da480ab4bc40762a2b | |
parent | dd219f0d58aa14230ce64c144c4238a081810d06 (diff) | |
download | sequelpro-eb10ee0dd4759e18ed1aee8b119d6e2bafeba8ef.tar.gz sequelpro-eb10ee0dd4759e18ed1aee8b119d6e2bafeba8ef.tar.bz2 sequelpro-eb10ee0dd4759e18ed1aee8b119d6e2bafeba8ef.zip |
- Fix an exception when following a foreign key relationship to a null value in another table (this addresses http://log.sequelpro.com/view/53 )
- Fix filtering within the same table when following foreign key relationships
-rw-r--r-- | Source/TableContent.m | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m index f41df80a..793883f8 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1556,6 +1556,7 @@ { NSAutoreleasePool *linkPool = [[NSAutoreleasePool alloc] init]; NSUInteger dataColumnIndex = [[[[tableContentView tableColumns] objectAtIndex:[theArrowCell getClickedColumn]] identifier] integerValue]; + BOOL tableFilterRequired = NO; // Ensure the clicked cell has foreign key details available NSDictionary *refDictionary = [[dataColumns objectAtIndex:dataColumnIndex] objectForKey:@"foreignkeyreference"]; @@ -1579,8 +1580,7 @@ } else { [argumentField setStringValue:targetFilterValue]; } - [self filterTable:self]; - + tableFilterRequired = YES; } else { // Store the filter details to use when loading the target table @@ -1602,8 +1602,14 @@ [spHistoryControllerInstance setModifyingState:NO]; [spHistoryControllerInstance updateHistoryEntries]; - // Empty the loading pool and exit the thread + // End the task [tableDocumentInstance endTask]; + + // If the same table is the target, trigger a filter task on the main thread + if (tableFilterRequired) + [self performSelectorOnMainThread:@selector(filterTable:) withObject:self waitUntilDone:NO]; + + // Empty the loading pool and exit the thread [linkPool drain]; } @@ -2525,7 +2531,7 @@ if ([filterSettings objectForKey:@"secondBetweenField"]) secondBetweenValueToRestore = [[NSString alloc] initWithString:[filterSettings objectForKey:@"secondBetweenField"]]; } else { - if ([filterSettings objectForKey:@"filterValue"]) + if ([filterSettings objectForKey:@"filterValue"] && ![[filterSettings objectForKey:@"filterValue"] isNSNull]) filterValueToRestore = [[NSString alloc] initWithString:[filterSettings objectForKey:@"filterValue"]]; } } |