diff options
Diffstat (limited to 'SPTableInfo.m')
-rw-r--r-- | SPTableInfo.m | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/SPTableInfo.m b/SPTableInfo.m index 5e777429..b2b81c05 100644 --- a/SPTableInfo.m +++ b/SPTableInfo.m @@ -114,27 +114,37 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn // Process result theRow = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject]; - // Add the table name to the infoTable - [info addObject:[NSString stringWithFormat:@"name: %@", [tableListInstance table]]]; - // 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"]]]; [info addObject:[NSString stringWithFormat:@"size: %@", [self sizeFromBytes:[[theRow objectForKey:@"Data_length"] intValue]]]]; + [info addObject:[NSString stringWithFormat:@"encoding: %@", [[[theRow objectForKey:@"Collation"] componentsSeparatedByString:@"_"] objectAtIndex:0]]]; [info addObject:[NSString stringWithFormat:@"auto_increment: %@", [theRow objectForKey:@"Auto_increment"]]]; // Notify that we've finished performing the query |