What steps will reproduce the problem?
1. name a property foo123
2. property->colName will give foo_1_2_3
3. colName foo_123->propName will give foo123
What is the expected output? What do you see instead?
I have a column named foo_123 and a property foo123.
When I save I get an error "...table XX has no column foo_1_2_3"...
The logic in NSString-SQLiteColumnName could be MUCH more robust
E.G. no checking for illegal characters. Assumes all characters, etc
What version of the product are you using? On what operating system?
latest, on OSX 10.5.6 / Phone OS 2.2.1
Please provide any additional information below.
As a quick hack I changed the code to:
- (NSString *)stringAsSQLColumnName
{
NSMutableString *ret = [NSMutableString string];
NSString *oneChar = nil;
NSString *lastChar = nil;
for (int i=0; i < [self length]; i++)
{
NSRange sRange = NSMakeRange(i,1);
oneChar = [self substringWithRange:sRange];
if ([[NSCharacterSet letterCharacterSet] characterIsMember:[oneChar
characterAtIndex:0]] &&
[oneChar isEqualToString:[oneChar uppercaseString]] && i > 0) {
[ret appendFormat:@"_%@", [oneChar lowercaseString]];
} else if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[oneChar
characterAtIndex:0]] &&
![[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[lastChar
characterAtIndex:0]] &&
i > 0) {
[ret appendFormat:@"_%@", oneChar];
} else {
[ret appendString:[oneChar lowercaseString]];
}
lastChar = oneChar;
}
return ret;
}
See useful java code from WO attached. When I get a chance I'll do a good
port...
Original issue reported on code.google.com by alexc...@gmail.com on 21 Feb 2009 at 4:52
Original issue reported on code.google.com by
alexc...@gmail.com
on 21 Feb 2009 at 4:52Attachments: