diff options
-rw-r--r-- | Frameworks/MCPKit/MCPEntrepriseKit/MCPObject.m | 4 | ||||
-rw-r--r-- | Source/CustomQuery.m | 4 | ||||
-rw-r--r-- | Source/SPTableData.m | 4 | ||||
-rw-r--r-- | Source/TableContent.m | 2 |
4 files changed, 7 insertions, 7 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 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]) |