diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CustomQuery.m | 4 | ||||
-rw-r--r-- | Source/SPTableData.m | 4 | ||||
-rw-r--r-- | Source/TableContent.m | 2 |
3 files changed, 5 insertions, 5 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; diff --git a/Source/SPTableData.m b/Source/SPTableData.m index 0411458a..0c8d2517 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -779,10 +779,10 @@ [status setObject:@"n" forKey:@"RowsCountAccurate"]; } - // [status objectForKey:@"Rows"] is NULL then try to get the number of rows via SELECT COUNT(*) FROM `foo` + // [status objectForKey:@"Rows"] is NULL then try to get the number of rows via SELECT COUNT(1) FROM `foo` // this happens e.g. for db "information_schema" if([[status objectForKey:@"Rows"] isKindOfClass:[NSNull class]]) { - tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@", [escapedTableName backtickQuotedString] ]]; + tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@", [escapedTableName backtickQuotedString] ]]; if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) [status setObject:[[tableStatusResult fetchRowAsArray] objectAtIndex:0] forKey:@"Rows"]; [status setObject:@"y" forKey:@"RowsCountAccurate"]; diff --git a/Source/TableContent.m b/Source/TableContent.m index 594822ec..5f3f7759 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -2103,7 +2103,7 @@ NSInteger numberOfRows = 0; // Get the number of rows in the table MCPResult *r; - r = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(*) FROM %@", [selectedTable backtickQuotedString]]]; + r = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@", [selectedTable backtickQuotedString]]]; if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) { NSArray *a = [r fetchRowAsArray]; if([a count]) |