aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-07-29 00:57:11 +0000
committerrowanbeentje <rowan@beent.je>2010-07-29 00:57:11 +0000
commit67bebbe2f9e6222c0a33be77c2d04495026f2437 (patch)
tree5ce673e3c9307a78686195d054f80205ac6c02a9 /Frameworks/MCPKit
parent550c112216171aa81487b32c41d7aa64adc2ec7f (diff)
downloadsequelpro-67bebbe2f9e6222c0a33be77c2d04495026f2437.tar.gz
sequelpro-67bebbe2f9e6222c0a33be77c2d04495026f2437.tar.bz2
sequelpro-67bebbe2f9e6222c0a33be77c2d04495026f2437.zip
- Add support for automatically converting \r and \r\n linebreaks in query syntax to \n. This addresses Issue #652.
- Clean up SPSQLParser, and use a few more CFString methods to avoid obj-c messaging in loops - When importing SQL using autodetect, perform a manual SET NAMES if possible to cope with poorly-exported files.
Diffstat (limited to 'Frameworks/MCPKit')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m52
1 files changed, 52 insertions, 0 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index 56073806..851bf936 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -1092,6 +1092,58 @@ void performThreadedKeepAlive(void *ptr)
}
/**
+ * Gets a MySQL charset for the given NSStringEncoding.
+ * If the NSStringEncoding was not matched, nil is returned.
+ */
++ (NSString *) mySQLEncodingForStringEncoding:(NSStringEncoding)stringEncoding
+{
+ switch (stringEncoding) {
+
+ // Unicode encodings:
+ case NSUTF8StringEncoding:
+ return @"utf8";
+ case NSUnicodeStringEncoding:
+ return @"ucs2";
+
+ // Roman alphabet encodings:
+ case NSASCIIStringEncoding:
+ return @"ascii";
+ case NSISOLatin1StringEncoding:
+ case NSWindowsCP1252StringEncoding:
+ return @"latin1";
+ case NSMacOSRomanStringEncoding:
+ return @"macroman";
+
+ // Roman alphabet with central/east european additions:
+ case NSISOLatin2StringEncoding:
+ return @"latin2";
+ case NSWindowsCP1250StringEncoding:
+ return @"cp1250";
+
+ // Turkish
+ case NSWindowsCP1254StringEncoding:
+ return @"latin5";
+
+ // Greek:
+ case NSWindowsCP1253StringEncoding:
+ return @"greek";
+
+ // Cyrillic:
+ case NSWindowsCP1251StringEncoding:
+ return @"cp1251";
+
+ // Asian:
+ case NSJapaneseEUCStringEncoding:
+ return @"ujis";
+ case NSShiftJISStringEncoding:
+ return @"sjis";
+
+ default:
+ return nil;
+ }
+}
+
+/**
* Returns the default charset of the library mysqlclient used.
*/
+ (NSStringEncoding)defaultMySQLEncoding