aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/DBView.xib23
-rw-r--r--Source/TableRelations.h2
-rw-r--r--Source/TableRelations.m30
3 files changed, 34 insertions, 21 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib
index f7b7cacd..e0f011c3 100644
--- a/Interfaces/English.lproj/DBView.xib
+++ b/Interfaces/English.lproj/DBView.xib
@@ -387,10 +387,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <object class="NSCustomResource" key="NSImage" id="704280970">
- <string key="NSClassName">NSImage</string>
- <string key="NSResourceName">button_action</string>
- </object>
+ <reference key="NSImage" ref="1071832453"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="753352469"/>
</object>
@@ -2943,7 +2940,7 @@
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
- <reference key="NSImage" ref="704280970"/>
+ <reference key="NSImage" ref="1071832453"/>
<string key="NSAction">_popUpItemAction:</string>
<reference key="NSTarget" ref="984501775"/>
</object>
@@ -14731,6 +14728,14 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<int key="connectionID">5668</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">refreshButton</string>
+ <reference key="source" ref="885866030"/>
+ <reference key="destination" ref="962247647"/>
+ </object>
+ <int key="connectionID">5669</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -23501,8 +23506,8 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{61, 288}, {944, 550}}</string>
- <string>{{61, 288}, {944, 550}}</string>
+ <string>{{140, 343}, {944, 550}}</string>
+ <string>{{140, 343}, {944, 550}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
@@ -24231,7 +24236,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">5668</int>
+ <int key="maxID">5669</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -25182,6 +25187,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>onUpdateSelect</string>
<string>refColumnSelect</string>
<string>refTableSelect</string>
+ <string>refreshButton</string>
<string>relationSheet</string>
<string>relationsView</string>
<string>removeButton</string>
@@ -25210,6 +25216,7 @@ Y2hhbmdlIHRoZSBvcmRlcg</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
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