aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPExtendedTableInfo.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-11-15 01:20:36 +0000
committerstuconnolly <stuart02@gmail.com>2009-11-15 01:20:36 +0000
commitb6630d67c87f48126d42d8f10e016220dc39a7a2 (patch)
treeed80f86b05108bc7765de5391e46b5274c853d63 /Source/SPExtendedTableInfo.m
parent14add4e57ca0b8625670440b251956fddb1f4e00 (diff)
downloadsequelpro-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.
Diffstat (limited to 'Source/SPExtendedTableInfo.m')
-rw-r--r--Source/SPExtendedTableInfo.m21
1 files changed, 13 insertions, 8 deletions
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 -