aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableContent.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-08-25 23:58:52 +0000
committerrowanbeentje <rowan@beent.je>2010-08-25 23:58:52 +0000
commitdc9d005f21b3e281294f61d4d8e49d0ad003e8fb (patch)
tree02ac106ff98341c4b87d420c5ec9c9c2f1acb130 /Source/SPTableContent.m
parent47b27a6d2b5d3cd7fa7152d2679283e7fba3e82d (diff)
downloadsequelpro-dc9d005f21b3e281294f61d4d8e49d0ad003e8fb.tar.gz
sequelpro-dc9d005f21b3e281294f61d4d8e49d0ad003e8fb.tar.bz2
sequelpro-dc9d005f21b3e281294f61d4d8e49d0ad003e8fb.zip
Encoding changes and improvements, particularly to increase compatibility with extended characters in MySQL identifiers (names of dbs/tables/cols):
- Move encoding queries and control into MCPKit, with newly cleaned-up methods, and switch a number of locations to using the new code. - Use UTF8 connections for many identifier-based queries (selecting and listing databases, tables, stored procs, table information). This fixes selection and creation of table and database names containing extended characters, also fixing exceptions and errors. - Improve UTF8 over Latin1 to correctly set the client character set encoding as well, fixing custom queries and edits; remove custom code in SPTableContent achieving the same thing in a single location. - Fix database encoding detection routines - Update localisable strings
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r--Source/SPTableContent.m27
1 files changed, 5 insertions, 22 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m
index 86a960e5..14150607 100644
--- a/Source/SPTableContent.m
+++ b/Source/SPTableContent.m
@@ -2342,24 +2342,7 @@
[queryString appendFormat:@" WHERE %@", [self argumentForRow:-2]];
}
- // If UTF-8 via Latin1 view encoding is set convert the queryString into Latin1 and
- // set the MySQL connection to Latin1 before executing this query to allow editing.
- // After executing reset all.
- if([tableDocumentInstance connectionEncodingViaLatin1:mySQLConnection]) {
-
- NSStringEncoding currentEncoding = [mySQLConnection encoding];
- NSString *latin1String = [[NSString alloc] initWithCString:[queryString UTF8String] encoding:NSISOLatin1StringEncoding];
- [mySQLConnection setEncoding:NSISOLatin1StringEncoding];
- [mySQLConnection queryString:@"SET NAMES 'latin1'"];
- [mySQLConnection queryString:latin1String];
- [mySQLConnection setEncoding:currentEncoding];
- [mySQLConnection queryString:@"SET NAMES 'utf8'"];
- [mySQLConnection queryString:@"SET CHARACTER_SET_RESULTS=latin1"];
- [latin1String release];
-
- } else {
- [mySQLConnection queryString:queryString];
- }
+ [mySQLConnection queryString:queryString];
[fieldValues release];
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"SMySQLQueryHasBeenPerformed" object:tableDocumentInstance];
@@ -3072,7 +3055,7 @@
return [prefs objectForKey:SPNullValue];
if ([theValue isKindOfClass:[NSData class]])
- return [theValue shortStringRepresentationUsingEncoding:[mySQLConnection encoding]];
+ return [theValue shortStringRepresentationUsingEncoding:[mySQLConnection stringEncoding]];
if ([theValue isSPNotLoaded])
return NSLocalizedString(@"(not loaded)", @"value shown for hidden blob and text fields");
@@ -3534,9 +3517,9 @@
id editData = [[fieldEditor editWithObject:cellValue
fieldName:[[aTableColumn headerCell] stringValue]
- usingEncoding:[mySQLConnection encoding]
- isObjectBlob:isBlob
- isEditable:isFieldEditable
+ usingEncoding:[mySQLConnection stringEncoding]
+ isObjectBlob:isBlob
+ isEditable:isFieldEditable
withWindow:[tableDocumentInstance parentWindow]] retain];
if (editData) {