aboutsummaryrefslogtreecommitdiffstats
path: root/SPTableInfo.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2008-12-09 01:45:51 +0000
committerrowanbeentje <rowan@beent.je>2008-12-09 01:45:51 +0000
commit566e04bf7f43a3c81ad7de0df5e3d1e1eec0bfb4 (patch)
treedab4f730eb11013c828afe1f0139ed77667b6fd5 /SPTableInfo.m
parentcfdfa08afba12c115d8d423ece0ae6d747c3ba0e (diff)
downloadsequelpro-566e04bf7f43a3c81ad7de0df5e3d1e1eec0bfb4.tar.gz
sequelpro-566e04bf7f43a3c81ad7de0df5e3d1e1eec0bfb4.tar.bz2
sequelpro-566e04bf7f43a3c81ad7de0df5e3d1e1eec0bfb4.zip
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.
Diffstat (limited to 'SPTableInfo.m')
-rw-r--r--SPTableInfo.m26
1 files 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"]]];