diff options
author | stuconnolly <stuart02@gmail.com> | 2009-11-15 01:20:36 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-11-15 01:20:36 +0000 |
commit | b6630d67c87f48126d42d8f10e016220dc39a7a2 (patch) | |
tree | ed80f86b05108bc7765de5391e46b5274c853d63 | |
parent | 14add4e57ca0b8625670440b251956fddb1f4e00 (diff) | |
download | sequelpro-b6630d67c87f48126d42d8f10e016220dc39a7a2.tar.gz sequelpro-b6630d67c87f48126d42d8f10e016220dc39a7a2.tar.bz2 sequelpro-b6630d67c87f48126d42d8f10e016220dc39a7a2.zip |
When viewing the information_schema database, disable all controls on the table information view as all table in this database are not modifiable by anyone.
-rw-r--r-- | Interfaces/English.lproj/Console.xib | 8 | ||||
-rw-r--r-- | Source/SPExtendedTableInfo.m | 21 | ||||
-rw-r--r-- | Source/SPQueryController.m | 1 |
3 files changed, 18 insertions, 12 deletions
diff --git a/Interfaces/English.lproj/Console.xib b/Interfaces/English.lproj/Console.xib index c8238d10..5578ac8a 100644 --- a/Interfaces/English.lproj/Console.xib +++ b/Interfaces/English.lproj/Console.xib @@ -12,8 +12,7 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="4"/> - <integer value="49"/> + <integer value="14"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -296,7 +295,7 @@ <string key="NSIdentifier">message</string> <double key="NSWidth">367</double> <double key="NSMinWidth">10</double> - <double key="NSMaxWidth">1000</double> + <double key="NSMaxWidth">10000</double> <object class="NSTableHeaderCell" key="NSHeaderCell"> <int key="NSCellFlags">75628096</int> <int key="NSCellFlags2">2048</int> @@ -581,6 +580,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{10, 6}, {151, 18}}</string> <reference key="NSSuperview" ref="841319465"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="570624841"> <int key="NSCellFlags">-2080244224</int> @@ -608,6 +608,7 @@ <int key="NSvFlags">268</int> <string key="NSFrame">{{10, 30}, {154, 18}}</string> <reference key="NSSuperview" ref="841319465"/> + <reference key="NSWindow"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="640143248"> <int key="NSCellFlags">-2080244224</int> @@ -628,6 +629,7 @@ </object> <string key="NSFrameSize">{178, 54}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> <string key="NSClassName">NSView</string> </object> <object class="NSMenu" id="1011399888"> diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index aee45569..7140320e 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -351,7 +351,6 @@ */ - (void)startDocumentTaskForTab:(NSNotification *)aNotification { - // Only proceed if this view is selected. if (![[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:MAIN_TOOLBAR_TABLE_INFO]) return; @@ -367,28 +366,34 @@ */ - (void)endDocumentTaskForTab:(NSNotification *)aNotification { - // Only proceed if this view is selected. if (![[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:MAIN_TOOLBAR_TABLE_INFO]) return; NSDictionary *statusFields = [tableDataInstance statusValues]; + if (!selectedTable || ![selectedTable length] || [[statusFields objectForKey:@"Engine"] isEqualToString:@"View"]) return; - if ([[databaseDataInstance getDatabaseStorageEngines] count] && [statusFields objectForKey:@"Engine"]) - [tableTypePopUpButton setEnabled:YES]; + // If we are viewing tables in the information_schema database, then disable all controls that cause table + // changes as these tables are not modifiable by anyone. + BOOL isInformationSchemaDb = [[tableDocumentInstance database] isEqualToString:@"information_schema"]; + + if ([[databaseDataInstance getDatabaseStorageEngines] count] && [statusFields objectForKey:@"Engine"]) { + [tableTypePopUpButton setEnabled:(!isInformationSchemaDb)]; + } - if ([[databaseDataInstance getDatabaseCharacterSetEncodings] count] && [tableDataInstance tableEncoding]) - [tableEncodingPopUpButton setEnabled:YES]; + if ([[databaseDataInstance getDatabaseCharacterSetEncodings] count] && [tableDataInstance tableEncoding]) { + [tableEncodingPopUpButton setEnabled:(!isInformationSchemaDb)]; + } if ([[databaseDataInstance getDatabaseCollationsForEncoding:[tableDataInstance tableEncoding]] count] && [statusFields objectForKey:@"Collation"]) { - [tableCollationPopUpButton setEnabled:YES]; + [tableCollationPopUpButton setEnabled:(!isInformationSchemaDb)]; } - [tableCommentsTextView setEditable:YES]; + [tableCommentsTextView setEditable:(!isInformationSchemaDb)]; } #pragma mark - diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 891f4fb5..6e9e561e 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -372,7 +372,6 @@ static SPQueryController *sharedQueryController = nil; return [[[NSAttributedString alloc] initWithString:returnValue attributes:stringAtributes] autorelease]; } - #pragma mark - #pragma mark Other |