aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CustomQuery.m
diff options
context:
space:
mode:
authorbamse16 <marius@marius.me.uk>2010-01-14 06:37:43 +0000
committerbamse16 <marius@marius.me.uk>2010-01-14 06:37:43 +0000
commit0b48b40370b5a49144f39ae95888f3fbcd1aa048 (patch)
treed8dbeff96d5c788b3342244eb122de235f7339be /Source/CustomQuery.m
parent08fb692301568e7143271ffad9bbcb3a5b247de5 (diff)
downloadsequelpro-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 'Source/CustomQuery.m')
-rw-r--r--Source/CustomQuery.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index 5540f198..de035270 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -1512,7 +1512,7 @@
// NSString *fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn];
// Check if the IDstring identifies the current field bijectively
- NSInteger numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue];
+ NSInteger numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue];
if(numberOfPossibleUpdateRows == 1) {
// [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:tableDocumentInstance];
@@ -1862,7 +1862,7 @@
fieldIDQueryString = [self argumentForRow:rowIndex ofTable:tableForColumn andDatabase:[columnDefinition objectForKey:@"db"]];
// Actual check whether field can be identified bijectively
- numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue];
+ numberOfPossibleUpdateRows = [[[[mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@.%@ %@", [[columnDefinition objectForKey:@"db"] backtickQuotedString], [tableForColumn backtickQuotedString], fieldIDQueryString]] fetchRowAsArray] objectAtIndex:0] integerValue];
isFieldEditable = (numberOfPossibleUpdateRows == 1) ? YES : NO;