From 566e04bf7f43a3c81ad7de0df5e3d1e1eec0bfb4 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 9 Dec 2008 01:45:51 +0000 Subject: Separate update_date checks from create_date checks, as InnoDB tables have a create_date but not an update_date. Fixes the Table Information pane on InnoDB tables and associated draw errors. --- SPTableInfo.m | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/SPTableInfo.m b/SPTableInfo.m index 5f395c59..b2b81c05 100644 --- a/SPTableInfo.m +++ b/SPTableInfo.m @@ -117,17 +117,29 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn // Check for "Create_time" == NULL if (![[theRow objectForKey:@"Create_time"] isNSNull]) { // Setup our data formatter - NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; - [dateFormatter setDateStyle:NSDateFormatterShortStyle]; - [dateFormatter setTimeStyle:NSDateFormatterNoStyle]; + NSDateFormatter *createDateFormatter = [[[NSDateFormatter alloc] init] autorelease]; + [createDateFormatter setDateStyle:NSDateFormatterShortStyle]; + [createDateFormatter setTimeStyle:NSDateFormatterNoStyle]; - // Convert our string dates from the results to NSDates. + // Convert our string date from the result to an NSDate. NSDate *create_date = [NSDate dateWithNaturalLanguageString:[theRow objectForKey:@"Create_time"]]; + + // Add the creation date to the infoTable + [info addObject:[NSString stringWithFormat:@"created: %@", [createDateFormatter stringFromDate:create_date]]]; + } + + // Check for "Update_time" == NULL - InnoDB tables don't have an update time + if (![[theRow objectForKey:@"Update_time"] isNSNull]) { + // Setup our data formatter + NSDateFormatter *updateDateFormatter = [[[NSDateFormatter alloc] init] autorelease]; + [updateDateFormatter setDateStyle:NSDateFormatterShortStyle]; + [updateDateFormatter setTimeStyle:NSDateFormatterNoStyle]; + + // Convert our string date from the result to an NSDate. NSDate *update_date = [NSDate dateWithNaturalLanguageString:[theRow objectForKey:@"Update_time"]]; - // Add the create date and update date to the infoTable - [info addObject:[NSString stringWithFormat:@"created: %@", [dateFormatter stringFromDate:create_date]]]; - [info addObject:[NSString stringWithFormat:@"updated: %@", [dateFormatter stringFromDate:update_date]]]; + // Add the update date to the infoTable + [info addObject:[NSString stringWithFormat:@"updated: %@", [updateDateFormatter stringFromDate:update_date]]]; } [info addObject:[NSString stringWithFormat:@"rows: %@", [theRow objectForKey:@"Rows"]]]; -- cgit v1.2.3