diff options
author | bamse16 <marius@marius.me.uk> | 2010-01-14 06:37:43 +0000 |
---|---|---|
committer | bamse16 <marius@marius.me.uk> | 2010-01-14 06:37:43 +0000 |
commit | 0b48b40370b5a49144f39ae95888f3fbcd1aa048 (patch) | |
tree | d8dbeff96d5c788b3342244eb122de235f7339be /Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m | |
parent | 08fb692301568e7143271ffad9bbcb3a5b247de5 (diff) | |
download | sequelpro-0b48b40370b5a49144f39ae95888f3fbcd1aa048.tar.gz sequelpro-0b48b40370b5a49144f39ae95888f3fbcd1aa048.tar.bz2 sequelpro-0b48b40370b5a49144f39ae95888f3fbcd1aa048.zip |
Replace COUNT(*) with COUNT(1) which is usually faster, and much faster in certain conditions
Diffstat (limited to 'Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m')
-rw-r--r-- | Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m | 4 |
1 files changed, 2 insertions, 2 deletions
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 |