diff options
author | Max <post@wickenrode.com> | 2015-10-31 02:54:59 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-10-31 02:54:59 +0100 |
commit | 2f2aafb4f5675282a37d16dce96027706096df40 (patch) | |
tree | 288d91f15322a88eb4335d13bf2c3832108d1313 /Source/SPTableData.m | |
parent | 57955871fb174eefc56dfedcd8222d2e68272ca5 (diff) | |
download | sequelpro-2f2aafb4f5675282a37d16dce96027706096df40.tar.gz sequelpro-2f2aafb4f5675282a37d16dce96027706096df40.tar.bz2 sequelpro-2f2aafb4f5675282a37d16dce96027706096df40.zip |
* Basic math is hard sometimes (fixes an issue introduced by me in b2d798ba9282d3acf1a2d65de30849e529d4d255)
* Fix an exception that could occur when trying to view a damaged table
* Fix a theoretical use-after-free issue by a wrongly structured retain/release in a setter
Diffstat (limited to 'Source/SPTableData.m')
-rw-r--r-- | Source/SPTableData.m | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m index a40225d0..51c6a274 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -1004,7 +1004,7 @@ SPOnewayAlertSheet( NSLocalizedString(@"Error", @"error"), [NSApp mainWindow], - [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving status data.\nMySQL said: %@", @"message of panel when retrieving view information failed"), [mySQLConnection lastErrorMessage]] + [NSString stringWithFormat:NSLocalizedString(@"An error occured while retrieving status data.\n\nMySQL said: %@", @"message of panel when retrieving view information failed"), [mySQLConnection lastErrorMessage]] ); if (changeEncoding) [mySQLConnection restoreStoredEncoding]; } @@ -1041,9 +1041,19 @@ // this happens e.g. for db "information_schema" if([[status objectForKey:@"Rows"] isNSNull]) { tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT COUNT(1) FROM %@", [escapedTableName backtickQuotedString] ]]; - if (![mySQLConnection queryErrored]) + // this query can fail e.g. if a table is damaged + if (tableStatusResult && ![mySQLConnection queryErrored]) { [status setObject:[[tableStatusResult getRowAsArray] objectAtIndex:0] forKey:@"Rows"]; [status setObject:@"y" forKey:@"RowsCountAccurate"]; + } + else { + //FIXME that error should really show only when trying to view the table content, but we don't even try to load that if Rows==NULL + SPOnewayAlertSheet( + NSLocalizedString(@"Querying row count failed", @"table status : row count query failed : error title"), + [NSApp mainWindow], + [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to determine the number of rows for “%@”.\nMySQL said: %@ (%lu)", @"table status : row count query failed : error message"),[tableListInstance tableName],[mySQLConnection lastErrorMessage],[mySQLConnection lastErrorID]] + ); + } } } |