From 0b48b40370b5a49144f39ae95888f3fbcd1aa048 Mon Sep 17 00:00:00 2001 From: bamse16 Date: Thu, 14 Jan 2010 06:37:43 +0000 Subject: Replace COUNT(*) with COUNT(1) which is usually faster, and much faster in certain conditions --- Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m') diff --git a/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m b/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m index 16d0695b..dba963c6 100644 --- a/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m +++ b/Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m @@ -903,7 +903,7 @@ Finally, you can use setTarget:nil forRelation:... to 'delete' a previously esta return 0; } theJoinArray = [iRelation joins]; - theQuery = [[NSMutableString alloc] initWithFormat:@"SELECT COUNT(*) FROM %@ WHERE ", [[iRelation destination] externalName]]; + theQuery = [[NSMutableString alloc] initWithFormat:@"SELECT COUNT(1) FROM %@ WHERE ", [[iRelation destination] externalName]]; for (i=0; [theJoinArray count] != i; ++i) { MCPJoin *theJoin = (MCPJoin *)[theJoinArray objectAtIndex:i]; if (i) { @@ -914,7 +914,7 @@ Finally, you can use setTarget:nil forRelation:... to 'delete' a previously esta theResult = [connection queryString:theQuery]; [theQuery release]; theRow = [theResult fetchRowAsDictionary]; - return [(NSNumber *)[theRow objectForKey:@"COUNT(*)"] unsignedIntegerValue]; + return [(NSNumber *)[theRow objectForKey:@"COUNT(1)"] unsignedIntegerValue]; } - (NSUInteger) countTargetForRelationNamed:(NSString *) iRelationName -- cgit v1.2.3