aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorjakob <jakob@eggerapps.at>2009-03-26 13:50:20 +0000
committerjakob <jakob@eggerapps.at>2009-03-26 13:50:20 +0000
commitdcf2748abe446d6fcb0e0e622502f066759c258c (patch)
tree4d7bd664582bcaffa19e8890a32cbd8e39ee054a /Source
parent5aaadd3f2d83ada69d60b30fbe91888777fbc3dd (diff)
downloadsequelpro-dcf2748abe446d6fcb0e0e622502f066759c258c.tar.gz
sequelpro-dcf2748abe446d6fcb0e0e622502f066759c258c.tar.bz2
sequelpro-dcf2748abe446d6fcb0e0e622502f066759c258c.zip
- updated the backtickQuotedString method to be 10.4 compatible
Diffstat (limited to 'Source')
-rw-r--r--Source/SPStringAdditions.m17
1 files changed, 16 insertions, 1 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index ef595dcc..80498d91 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -120,7 +120,22 @@
// -------------------------------------------------------------------------------
- (NSString *)backtickQuotedString
{
- return [NSString stringWithFormat: @"`%@`", [self stringByReplacingOccurrencesOfString: @"`" withString: @"``"] ];
+ // mutableCopy automatically retains the returned string, so don't forget to release it later...
+ NSMutableString *workingCopy = [self mutableCopy];
+
+ // First double all backticks in the string to escape them
+ // I don't want to use "stringByReplacingOccurrencesOfString:withString:" because it's only available in 10.5
+ [workingCopy replaceOccurrencesOfString: @"`"
+ withString: @"``"
+ options: NSLiteralSearch
+ range: NSMakeRange(0, [quotedString length]) ];
+
+ // Add the quotes around the string
+ NSString *quotedString = [NSString stringWithFormat: @"`%@`", workingCopy];
+
+ [workingCopy release];
+
+ return quotedString;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5