aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2016-11-01 19:00:30 +0100
committerMax <post@wickenrode.com>2016-11-01 19:00:30 +0100
commitf77f8715cf1bcc8811804008fc5d3ac964988ce1 (patch)
treed1954e726cb160790ba5ceca5f414d03da671e00 /Source
parentee5e4db6cf7f35e9802d25bc413aa74221bed371 (diff)
downloadsequelpro-f77f8715cf1bcc8811804008fc5d3ac964988ce1.tar.gz
sequelpro-f77f8715cf1bcc8811804008fc5d3ac964988ce1.tar.bz2
sequelpro-f77f8715cf1bcc8811804008fc5d3ac964988ce1.zip
Some changes suggested in PR #2606 to improve MySQL 5.8 handling
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDatabaseDocument.m8
-rw-r--r--Source/SPExtendedTableInfo.m2
-rw-r--r--Source/SPTableData.m4
-rw-r--r--Source/SPTableInfo.m7
-rw-r--r--Source/SPTablesList.m1
5 files changed, 14 insertions, 8 deletions
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 51fc7a7e..c338224b 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -5608,9 +5608,9 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
}
NSError *err = nil;
[tableMetaData writeToFile:metaFileName
- atomically:YES
- encoding:NSUTF8StringEncoding
- error:&err];
+ atomically:YES
+ encoding:NSUTF8StringEncoding
+ error:&err];
if(err != nil) {
NSLog(@"Error while writing “%@”", tableMetaData);
NSBeep();
@@ -5705,7 +5705,7 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0;
}
if(userTerminated) {
- [SPTooltip showWithObject:NSLocalizedString(@"URL scheme command was terminated by user", @"URL scheme command was terminated by user") atLocation:[NSApp mouseLocation]];
+ [SPTooltip showWithObject:NSLocalizedString(@"URL scheme command was terminated by user", @"URL scheme command was terminated by user") atLocation:[NSEvent mouseLocation]];
status = @"1";
}
diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m
index e2f38a69..df084bf3 100644
--- a/Source/SPExtendedTableInfo.m
+++ b/Source/SPExtendedTableInfo.m
@@ -681,7 +681,7 @@ static NSString *SPMySQLCommentField = @"Comment";
{
NSString *value = [infoDict objectForKey:key];
- if ([value isNSNull]) {
+ if (![value unboxNull]) { // (value == nil || value == [NSNull null])
value = @"";
}
else {
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 689ecc8f..8033d5a0 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -1156,7 +1156,9 @@
#endif
if (rowCountLevel == SPRowCountFetchNever
- || (rowCountLevel == SPRowCountFetchIfCheap && [[self statusValueForKey:@"Data_length"] integerValue] >= rowCountCheapBoundary))
+ || (rowCountLevel == SPRowCountFetchIfCheap
+ && (![[self statusValueForKey:@"Data_length"] unboxNull] //this works as a nil check for both NSNull and nil.
+ || [[self statusValueForKey:@"Data_length"] integerValue] >= rowCountCheapBoundary)))
{
return YES;
}
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index 1767d3b0..b72d55f8 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -190,8 +190,11 @@
[info addObject:[NSString stringWithFormat:[[tableStatus objectForKey:@"RowsCountAccurate"] boolValue] ? NSLocalizedString(@"rows: %@", @"Table Info Section : number of rows (exact value)") : NSLocalizedString(@"rows: ~%@", @"Table Info Section : number of rows (estimated value)"),
[numberFormatter stringFromNumber:[NSNumber numberWithLongLong:[[tableStatus objectForKey:@"Rows"] longLongValue]]]]];
}
-
- [info addObject:[NSString stringWithFormat:NSLocalizedString(@"size: %@", @"Table Info Section : table size on disk"), [NSString stringForByteSize:[[tableStatus objectForKey:@"Data_length"] longLongValue]]]];
+
+ // Check for 'Data_Length' == NULL (see PR #2606)
+ if([[tableStatus objectForKey:@"Data_length"] unboxNull]) {
+ [info addObject:[NSString stringWithFormat:NSLocalizedString(@"size: %@", @"Table Info Section : table size on disk"), [NSString stringForByteSize:[[tableStatus objectForKey:@"Data_length"] longLongValue]]]];
+ }
NSString *tableEnc = [tableDataInstance tableEncoding];
NSString *tableColl = [tableStatus objectForKey:@"Collation"];
if([tableColl length]) {
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 77817040..3cc8ae3a 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -231,6 +231,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
// 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)
if ([theResult numberOfFields] == 1) {
for (NSArray *eachRow in theResult) {
[tables addObject:[eachRow objectAtIndex:0]];