aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPStringAdditions.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPStringAdditions.m')
-rw-r--r--Source/SPStringAdditions.m12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m
index ad6972ce..ef595dcc 100644
--- a/Source/SPStringAdditions.m
+++ b/Source/SPStringAdditions.m
@@ -111,6 +111,18 @@
}
+// -------------------------------------------------------------------------------
+// backtickQuotedString
+//
+// Returns the string quoted with backticks as required for MySQL identifiers
+// eg.: tablename => `tablename`
+// my`table => `my``table`
+// -------------------------------------------------------------------------------
+- (NSString *)backtickQuotedString
+{
+ return [NSString stringWithFormat: @"`%@`", [self stringByReplacingOccurrencesOfString: @"`" withString: @"``"] ];
+}
+
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
// -------------------------------------------------------------------------------
// componentsSeparatedByCharactersInSet: