aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPStringAdditions.m
diff options
context:
space:
mode:
authorjakob <jakob@eggerapps.at>2009-03-24 18:43:58 +0000
committerjakob <jakob@eggerapps.at>2009-03-24 18:43:58 +0000
commita23bb9169015b21191bf072a7da6c668991907df (patch)
treee9077cf72f071f9f46299669f6535987b56ae402 /Source/SPStringAdditions.m
parentd09e3a2a855c80a5a69017a53a7d62e5324f0c26 (diff)
downloadsequelpro-a23bb9169015b21191bf072a7da6c668991907df.tar.gz
sequelpro-a23bb9169015b21191bf072a7da6c668991907df.tar.bz2
sequelpro-a23bb9169015b21191bf072a7da6c668991907df.zip
- fixed issue #203 (backticks in identifiers not supported)
- added a backtickQuotedString: method to SPStringAdditions - created the file SPArrayAdditions for a componentsJoinedAndBacktickQuoted: method In the future, we should use backtickQuotedString: to quote identifiers like this: [NSString stringWithFormat:@"SELECT * FROM %@", [tableName backtickQuotedString]]
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: