Skip to content
Permalink
Browse files

Fix an exception when trying to add relations on MySQL 8.0+ (#2699)

  • Loading branch information...
dmoagx committed Nov 1, 2018
1 parent 98cec9a commit a2e6c1198daec562f17fedb75a267eae25cf632e
Showing with 2 additions and 1 deletion.
  1. +2 −1 Source/SPTableRelations.m
@@ -274,6 +274,7 @@ - (IBAction)addRelation:(id)sender
//MySQL 5.0+
SPMySQLResult *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 setDefaultRowReturnType:SPMySQLResultRowAsArray];
[result setReturnDataAsStrings:YES]; // TODO: Workaround for #2699/#2700
for (NSArray *eachRow in result) {
[refTablePopUpButton addItemWithTitle:[eachRow objectAtIndex:0]];
}
@@ -282,7 +283,7 @@ - (IBAction)addRelation:(id)sender
//this will work back to 3.23.0, innodb was added in 3.23.49
SPMySQLResult *result = [connection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS FROM %@", [[tableDocumentInstance database] backtickQuotedString]]];
[result setDefaultRowReturnType:SPMySQLResultRowAsArray];
[result setReturnDataAsStrings:YES]; // some mysql versions would return NSData for string fields otherwise
[result setReturnDataAsStrings:YES]; // TODO: Workaround for #2699/#2700
for (NSArray *eachRow in result) {
// col[1] was named "Type" < 4.1, "Engine" afterwards
if(![[[eachRow objectAtIndex:1] uppercaseString] isEqualToString:@"INNODB"]) continue;

0 comments on commit a2e6c11

Please sign in to comment.
You can’t perform that action at this time.