aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2011-01-26 22:24:46 +0000
committerBibiko <bibiko@eva.mpg.de>2011-01-26 22:24:46 +0000
commit05ac3cbd9c3eb6559ee1ca6ee7d4ff4e510e6542 (patch)
tree8cb5ce2a92083911258f97c902aff6d208b359e9 /Source
parent7cc062247ff23496dd0390cf07b5d45d6bc49777 (diff)
downloadsequelpro-05ac3cbd9c3eb6559ee1ca6ee7d4ff4e510e6542.tar.gz
sequelpro-05ac3cbd9c3eb6559ee1ca6ee7d4ff4e510e6542.tar.bz2
sequelpro-05ac3cbd9c3eb6559ee1ca6ee7d4ff4e510e6542.zip
• fixed table list querying by checking utf8 connection since we query info_schema
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableRelations.m23
1 files changed, 17 insertions, 6 deletions
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index b7a4bde6..b65f62fc 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -165,22 +165,33 @@
{
// Set up the controls
[addRelationTableBox setTitle:[NSString stringWithFormat:NSLocalizedString(@"Table: %@", @"Add Relation sheet title, showing table name"), [tablesListInstance tableName]]];
-
+
[columnPopUpButton removeAllItems];
[columnPopUpButton addItemsWithTitles:[tableDataInstance columnNames]];
-
+
[refTablePopUpButton removeAllItems];
-
+
+ BOOL changeEncoding = ![[connection encoding] isEqualToString:@"utf8"];
+
+ // Use UTF8 for identifier-based queries
+ if (changeEncoding) {
+ [connection storeEncodingForRestoration];
+ [connection setEncoding:@"utf8"];
+ }
+
// Get all InnoDB tables in the current database
MCPResult *result = [connection queryString:[NSString stringWithFormat:@"SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND engine = 'InnoDB' AND table_schema = %@", [[tableDocumentInstance database] tickQuotedString]]];
-
+
[result dataSeek:0];
-
+
for (NSInteger i = 0; i < [result numOfRows]; i++)
{
[refTablePopUpButton addItemWithTitle:[[result fetchRowAsArray] objectAtIndex:0]];
}
-
+
+ // Restore encoding if appropriate
+ if (changeEncoding) [connection restoreStoredEncoding];
+
[self selectReferenceTable:nil];
[NSApp beginSheet:addRelationPanel