| 37 | | NSPredicate *fetchPredicate = [NSPredicate predicateWithFormat:@"movie != nil"]; |
| 38 | | NSPredicate *finalPred; |
| 39 | | if(filterPredicate == nil) |
| 40 | | finalPred = fetchPredicate; |
| 41 | | else |
| 42 | | finalPred = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:filterPredicate, fetchPredicate, nil]]; |
| 43 | | NSArray *files = doFetchRequest(SapphireFileMetaDataName, moc, finalPred); |
| 44 | | NSSet *movieIds = [NSSet setWithArray:[files valueForKeyPath:@"movie.objectID"]]; |
| 45 | | |
| 46 | | NSPredicate *entPred; |
| 47 | | if([SapphireFrontRowCompat usingTakeTwo] || ![SapphireFrontRowCompat usingFrontRow]) |
| | 37 | NSPredicate *entPred = nil; |
| | 38 | if(filterPredicate != nil) |
| 49 | | /* Damn you Apple for not making take 2 Leopard. Not only does this make obj C 2 not available, |
| 50 | | but it also means that I have to content with a crippled and slower core data. The else block here |
| 51 | | executes on Leopard at several times the speed, but on Tiger throws the exception: |
| 52 | | "to-many key not allowed here" even though it can be done through a JOIN in the SQL!!!!!*/ |
| 53 | | NSPredicate *moviePred = [NSPredicate predicateWithFormat:@"SELF IN %@", movieIds]; |
| 54 | | NSArray *movies = doFetchRequest(SapphireMovieName, moc, moviePred); |
| 55 | | NSArray *entSet = [movies valueForKeyPath:[NSString stringWithFormat:@"@distinctUnionOfSets.%@.objectID", keyFromMovie]]; |
| | 40 | NSPredicate *fetchPredicate = [NSPredicate predicateWithFormat:@"movie != nil"]; |
| | 41 | NSPredicate *finalPred; |
| | 42 | if(filterPredicate == nil) |
| | 43 | finalPred = fetchPredicate; |
| | 44 | else |
| | 45 | finalPred = [NSCompoundPredicate andPredicateWithSubpredicates:[NSArray arrayWithObjects:filterPredicate, fetchPredicate, nil]]; |
| | 46 | NSArray *files = doFetchRequest(SapphireFileMetaDataName, moc, finalPred); |
| | 47 | NSSet *movieIds = [NSSet setWithArray:[files valueForKeyPath:@"movie.objectID"]]; |
| 57 | | entPred = [NSPredicate predicateWithFormat:@"SELF IN %@", entSet]; |
| | 49 | if([SapphireFrontRowCompat usingTakeTwo] || ![SapphireFrontRowCompat usingFrontRow]) |
| | 50 | { |
| | 51 | /* Damn you Apple for not making take 2 Leopard. Not only does this make obj C 2 not available, |
| | 52 | but it also means that I have to content with a crippled and slower core data. The else block here |
| | 53 | executes on Leopard at several times the speed, but on Tiger throws the exception: |
| | 54 | "to-many key not allowed here" even though it can be done through a JOIN in the SQL!!!!!*/ |
| | 55 | NSPredicate *moviePred = [NSPredicate predicateWithFormat:@"SELF IN %@", movieIds]; |
| | 56 | NSArray *movies = doFetchRequest(SapphireMovieName, moc, moviePred); |
| | 57 | NSArray *entSet = [movies valueForKeyPath:[NSString stringWithFormat:@"@distinctUnionOfSets.%@.objectID", keyFromMovie]]; |
| | 58 | |
| | 59 | entPred = [NSPredicate predicateWithFormat:@"SELF IN %@", entSet]; |
| | 60 | } |
| | 61 | else |
| | 62 | entPred = [NSPredicate predicateWithFormat:@"ANY movies IN %@", movieIds]; |