diff options
author | rowanbeentje <rowan@beent.je> | 2009-07-18 17:05:43 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-07-18 17:05:43 +0000 |
commit | 277f1dabb351701d5912057dce82eb6690726eeb (patch) | |
tree | 85d1c9b87fb2506d1724518a9111e98551095989 /Source/TableContent.m | |
parent | 11e10321f97577204b74f84b528029490e64ef47 (diff) | |
download | sequelpro-277f1dabb351701d5912057dce82eb6690726eeb.tar.gz sequelpro-277f1dabb351701d5912057dce82eb6690726eeb.tar.bz2 sequelpro-277f1dabb351701d5912057dce82eb6690726eeb.zip |
- Update WHERE string buildup - the code now uses equals comparisons rather than LIKE, so the quote methods were incorrect. We now use standard escaping without additional LIKE preparation. This resolves Issue #338
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r-- | Source/TableContent.m | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m index d308fd6a..c84ee3c7 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1464,29 +1464,10 @@ } else { if (! [tempValue isKindOfClass:[NSData class]] ) { - // Escape special characters (in WHERE statement!) - for ( j = 0 ; j < [value length] ; j++ ) { - if ( [value characterAtIndex:j] == '\\' ) { - [value insertString:@"\\" atIndex:j]; - j++; - } - } - [value setString:[mySQLConnection prepareString:value]]; - for ( j = 0 ; j < [value length] ; j++ ) { - if ( [value characterAtIndex:j] == '%' || - [value characterAtIndex:j] == '_' ) { - [value insertString:@"\\" atIndex:j]; - j++; - } - } - [value setString:[NSString stringWithFormat:@"'%@'", value]]; + [value setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:value]]]; } - // columnType = [[tableDataInstance columnWithName:[keys objectAtIndex:i]] objectForKey:@"typegrouping"]; - // if ( [columnType isEqualToString:@"integer"] || [columnType isEqualToString:@"float"] || [columnType isEqualToString:@"bit"] ) { - [argument appendString:[NSString stringWithFormat:@"%@ = %@", [NSArrayObjectAtIndex(keys, i) backtickQuotedString], value]]; - // } else { - // [argument appendString:[NSString stringWithFormat:@"%@ LIKE %@", [NSArrayObjectAtIndex(keys, i) backtickQuotedString], value]]; - // } + + [argument appendString:[NSString stringWithFormat:@"%@ = %@", [NSArrayObjectAtIndex(keys, i) backtickQuotedString], value]]; } } if ( setLimit ) |