From edd1f54a3bd1fc85a9218ec3c2fd3233a97ba972 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 23 Jul 2018 00:29:40 +0200 Subject: [PATCH] * Fix truncation behavior of lines in Console * Workaround view info being displayed as hex data in mysql 8.0 --- Interfaces/English.lproj/Console.xib | 2 +- Source/SPTableData.m | 2 +- Source/SPTableInfo.m | 14 +++++++------- Source/SPTablesList.m | 2 +- Source/SPTextView.m | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Interfaces/English.lproj/Console.xib b/Interfaces/English.lproj/Console.xib index b39332270..4efa92b39 100644 --- a/Interfaces/English.lproj/Console.xib +++ b/Interfaces/English.lproj/Console.xib @@ -108,7 +108,7 @@ - + diff --git a/Source/SPTableData.m b/Source/SPTableData.m index c065d4d15..4dc0f0798 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -1007,8 +1007,8 @@ - (BOOL)updateStatusInformationForCurrentTable else if ([tableListInstance tableType] == SPTableTypeTable) { [escapedTableName replaceOccurrencesOfRegex:@"\\\\(?=\\Z|[^\'])" withString:@"\\\\\\\\"]; tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE '%@'", escapedTableName ]]; - [tableStatusResult setReturnDataAsStrings:YES]; } + [tableStatusResult setReturnDataAsStrings:YES]; //TODO: workaround for #2700 (#2699) // Check for any errors, only displaying them if the connection hasn't been terminated if ([mySQLConnection queryErrored]) { diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m index 6846639fd..3b046964b 100644 --- a/Source/SPTableInfo.m +++ b/Source/SPTableInfo.m @@ -134,7 +134,6 @@ - (void)updateActivities */ - (void)tableChanged:(NSNotification *)notification { - NSDictionary *tableStatus; NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease]; [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; @@ -160,7 +159,7 @@ - (void)tableChanged:(NSNotification *)notification if ([tableListInstance tableName]) { // Retrieve the table status information via the data cache - tableStatus = [tableDataInstance statusValues]; + NSDictionary *tableStatus = [tableDataInstance statusValues]; // Check for errors if (![tableStatus count]) { @@ -228,7 +227,7 @@ - (void)tableChanged:(NSNotification *)notification if ([tableListInstance tableName]) { // Retrieve the table status information via the data cache - tableStatus = [tableDataInstance statusValues]; + NSDictionary *tableStatus = [tableDataInstance statusValues]; // Check for errors if (![tableStatus count]) { @@ -282,7 +281,7 @@ - (void)tableChanged:(NSNotification *)notification if ([tableListInstance tableName]) { // Retrieve the table status information via the data cache - tableStatus = [tableDataInstance statusValues]; + NSDictionary *tableStatus = [tableDataInstance statusValues]; // Check for errors if (![tableStatus count]) { @@ -290,10 +289,11 @@ - (void)tableChanged:(NSNotification *)notification return; } - // Check for 'CREATED' == NULL - if (![[tableStatus objectForKey:@"DEFINER"] isNSNull]) { + // Check for 'DEFINER' == NULL + // Note: In mysql 8.0 definer and all the other following fields are missing in the result set for information_schema system views! + if ([[tableStatus objectForKey:@"DEFINER"] unboxNull]) { - // Add the creation date to the infoTable + // Add the definer to the infoTable [info addObject:[NSString stringWithFormat:NSLocalizedString(@"definer: %@", @"definer: %@"), [tableStatus objectForKey:@"DEFINER"]]]; // Check for 'SECURITY_TYPE' diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index eda38fb46..210d82c6a 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -191,7 +191,7 @@ - (IBAction)updateTables:(nullable id)sender // views; on MySQL versions >= 5.0.02 select the "full" list to also select the table type column. theResult = [mySQLConnection queryString:@"SHOW /*!50002 FULL*/ TABLES"]; [theResult setDefaultRowReturnType:SPMySQLResultRowAsArray]; - [theResult setReturnDataAsStrings:YES]; // MySQL 5.8 (beta) seems to return Table_type as data (see PR #2606) + [theResult setReturnDataAsStrings:YES]; // TODO: workaround for bug #2700 (#2699) if ([theResult numberOfFields] == 1) { for (NSArray *eachRow in theResult) { [tables addObject:[eachRow objectAtIndex:0]]; diff --git a/Source/SPTextView.m b/Source/SPTextView.m index 9a848437a..07f5217a2 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -1428,12 +1428,12 @@ - (void)showCompletionListFor:(NSString*)kind atRange:(NSRange)aRange fuzzySearc NSArray *arr = nil; if([kind isEqualToString:@"$SP_ASLIST_ALL_TABLES"]) { - NSString *currentDb = nil; - - if (tablesListInstance && [tablesListInstance selectedDatabase]) - currentDb = [tablesListInstance selectedDatabase]; - // TODO HansJB + // NSString *currentDb = nil; + // + // if (tablesListInstance && [tablesListInstance selectedDatabase]) + // currentDb = [tablesListInstance selectedDatabase]; + // // NSDictionary *dbs = [NSDictionary dictionaryWithDictionary:[[mySQLConnection getDbStructure] objectForKey:connectionID]]; // // if(currentDb != nil && dbs != nil && [dbs count] && [dbs objectForKey:currentDb]) {