diff options
author | stuconnolly <stuart02@gmail.com> | 2009-05-17 17:50:56 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-05-17 17:50:56 +0000 |
commit | dec07134b76f9b014a9ee96ee8c7d1cb88a3dad0 (patch) | |
tree | 0fe66cd4cc90abbe6497e89ef598054e86e1b4e0 /Source | |
parent | 2b2d30320d043d03e75b4d5013f127716386c261 (diff) | |
download | sequelpro-dec07134b76f9b014a9ee96ee8c7d1cb88a3dad0.tar.gz sequelpro-dec07134b76f9b014a9ee96ee8c7d1cb88a3dad0.tar.bz2 sequelpro-dec07134b76f9b014a9ee96ee8c7d1cb88a3dad0.zip |
Only editing of relations for InnoDB tables.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/TableRelations.h | 2 | ||||
-rw-r--r-- | Source/TableRelations.m | 30 |
2 files changed, 19 insertions, 13 deletions
diff --git a/Source/TableRelations.h b/Source/TableRelations.h index 60f00074..c593dc6d 100644 --- a/Source/TableRelations.h +++ b/Source/TableRelations.h @@ -36,6 +36,7 @@ IBOutlet id tableDataInstance; IBOutlet id addButton; IBOutlet id removeButton; + IBOutlet id refreshButton; IBOutlet id labelText; IBOutlet id relationsView; IBOutlet id relationSheet; @@ -46,7 +47,6 @@ IBOutlet id refColumnSelect; IBOutlet id onUpdateSelect; IBOutlet id onDeleteSelect; - CMMCPConnection *mySQLConnection; diff --git a/Source/TableRelations.m b/Source/TableRelations.m index d95cf471..daff2e52 100644 --- a/Source/TableRelations.m +++ b/Source/TableRelations.m @@ -239,15 +239,16 @@ */ - (IBAction)refresh:(id)sender { - [relData removeAllObjects]; - if( [tablesListInstance tableType] == SP_TABLETYPE_TABLE ) { + if([tablesListInstance tableType] == SP_TABLETYPE_TABLE) { // update the top label [labelText setStringValue:[NSString stringWithFormat:@"Relations for table: %@",[tablesListInstance tableName]]]; [tableDataInstance updateInformationForCurrentTable]; + NSArray *constraints = [tableDataInstance getConstraints]; + for( int i = 0; i < [constraints count]; i++ ) { [relData addObject:[NSDictionary dictionaryWithObjectsAndKeys: [tablesListInstance tableName], @"table", @@ -260,13 +261,9 @@ nil]]; } - } else { - // update the top label - [labelText setStringValue:@""]; - } + } [relationsView reloadData]; - } /* @@ -275,16 +272,26 @@ */ - (void)tableChanged:(NSNotification *)notification { - if( [tablesListInstance tableType] == SP_TABLETYPE_TABLE ) { + // To begin enable all interface elements + [addButton setEnabled:YES]; + [refreshButton setEnabled:YES]; + + // Get the current table's storage engine + NSString *engine = [tableDataInstance statusValueForKey:@"Engine"]; + + if (([tablesListInstance tableType] == SP_TABLETYPE_TABLE) && ([[engine lowercaseString] isEqualToString:@"innodb"])) { [addButton setEnabled:YES]; + [refreshButton setEnabled:YES]; + + [self refresh:self]; } else { [addButton setEnabled:NO]; + [refreshButton setEnabled:NO]; + + [labelText setStringValue:([tablesListInstance tableType] == SP_TABLETYPE_TABLE) ? @"This table does not support relations" : @""]; } - - [self refresh:nil]; } - //tableView datasource methods - (int)numberOfRowsInTableView:(NSTableView *)aTableView { @@ -341,5 +348,4 @@ return FALSE; } - @end |