aboutsummaryrefslogtreecommitdiffstats
path: root/TableDocument.m
diff options
context:
space:
mode:
authoravenjamin <avenjamin@gmail.com>2008-08-30 17:12:45 +0000
committeravenjamin <avenjamin@gmail.com>2008-08-30 17:12:45 +0000
commit50404d84388ed339dc929ac1cbb27aae3a29cb51 (patch)
tree134df17df4caccf171ed8b8f40ee3c52aacb62ec /TableDocument.m
parent3346039f0a92087d9c45cc8b20ff99fb95f85c38 (diff)
downloadsequelpro-50404d84388ed339dc929ac1cbb27aae3a29cb51.tar.gz
sequelpro-50404d84388ed339dc929ac1cbb27aae3a29cb51.tar.bz2
sequelpro-50404d84388ed339dc929ac1cbb27aae3a29cb51.zip
• Fixed Credits
• Added grabber images • Removed small icon of table and replaced with new one • Added "Checksum Table" to MainMenu • Added extra splitter grab handles • Few other bits cleaned up
Diffstat (limited to 'TableDocument.m')
-rw-r--r--TableDocument.m64
1 files changed, 48 insertions, 16 deletions
diff --git a/TableDocument.m b/TableDocument.m
index faeffe34..bce2a7c6 100644
--- a/TableDocument.m
+++ b/TableDocument.m
@@ -535,7 +535,7 @@ reused when user hits the close button of the variablseSheet or of the createTab
/**
* shows or hides the console
*/
-- (void)toggleConsole:(id)sender;
+- (void)toggleConsole:(id)sender
{
NSDrawerState state = [consoleDrawer state];
if (NSDrawerOpeningState == state || NSDrawerOpenState == state) {
@@ -549,7 +549,7 @@ reused when user hits the close button of the variablseSheet or of the createTab
/**
* clears the console
*/
-- (void)clearConsole:(id)sender;
+- (void)clearConsole:(id)sender
{
[consoleTextView setString:@""];
}
@@ -824,7 +824,7 @@ reused when user hits the close button of the variablseSheet or of the createTab
// Process result
theRow = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
- NSRunInformationalAlertPanel(@"Check Table", [NSString stringWithFormat:@"Check: %@", [theRow objectForKey:@"Msg_text"]], @"OK", nil, nil);
+ NSRunInformationalAlertPanel([NSString stringWithFormat:@"Check '%@' table", [self table]], [NSString stringWithFormat:@"Check: %@", [theRow objectForKey:@"Msg_text"]], @"OK", nil, nil);
}
- (IBAction)analyzeTable:(id)sender
@@ -845,7 +845,7 @@ reused when user hits the close button of the variablseSheet or of the createTab
// Process result
theRow = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
- NSRunInformationalAlertPanel(@"Analyze Table", [NSString stringWithFormat:@"Analyze: %@", [theRow objectForKey:@"Msg_text"]], @"OK", nil, nil);
+ NSRunInformationalAlertPanel([NSString stringWithFormat:@"Analyze '%@' table", [self table]], [NSString stringWithFormat:@"Analyze: %@", [theRow objectForKey:@"Msg_text"]], @"OK", nil, nil);
}
- (IBAction)optimizeTable:(id)sender
@@ -865,7 +865,7 @@ reused when user hits the close button of the variablseSheet or of the createTab
// Process result
theRow = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
- NSRunInformationalAlertPanel(@"Optimize Table", [NSString stringWithFormat:@"Optimize: %@", [theRow objectForKey:@"Msg_text"]], @"OK", nil, nil);
+ NSRunInformationalAlertPanel([NSString stringWithFormat:@"Optimize '%@' table", [self table]], [NSString stringWithFormat:@"Optimize: %@", [theRow objectForKey:@"Msg_text"]], @"OK", nil, nil);
}
- (IBAction)repairTable:(id)sender
@@ -885,7 +885,7 @@ reused when user hits the close button of the variablseSheet or of the createTab
// Process result
theRow = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
- NSRunInformationalAlertPanel(@"Repair Table", [NSString stringWithFormat:@"Repair: %@", [theRow objectForKey:@"Msg_text"]], @"OK", nil, nil);
+ NSRunInformationalAlertPanel([NSString stringWithFormat:@"Repair '%@' table", [self table]], [NSString stringWithFormat:@"Repair: %@", [theRow objectForKey:@"Msg_text"]], @"OK", nil, nil);
}
- (IBAction)flushTable:(id)sender
@@ -904,7 +904,27 @@ reused when user hits the close button of the variablseSheet or of the createTab
}
// Process result
- NSRunInformationalAlertPanel(@"Flush Table", @"Flushed", @"OK", nil, nil);
+ NSRunInformationalAlertPanel([NSString stringWithFormat:@"Flush '%@' table", [self table]], @"Flushed", @"OK", nil, nil);
+}
+
+- (IBAction)checksumTable:(id)sender
+{
+ NSString *query;
+ CMMCPResult *theResult;
+ NSDictionary *theRow;
+
+ //Create the query and get results
+ query = [NSString stringWithFormat:@"CHECKSUM TABLE `%@`", [self table]];
+ theResult = [mySQLConnection queryString:query];
+
+ // Check for errors
+ if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ NSRunAlertPanel(@"Error", [NSString stringWithFormat:@"An error occured while performming checksum on table.\n\n: %@",[mySQLConnection getLastErrorMessage]], @"OK", nil, nil);
+ }
+
+ // Process result
+ theRow = [[theResult fetch2DResultAsType:MCPTypeDictionary] lastObject];
+ NSRunInformationalAlertPanel([NSString stringWithFormat:@"Checksum '%@' table", [self table]], [NSString stringWithFormat:@"Checksum: %@", [theRow objectForKey:@"Checksum"]], @"OK", nil, nil);
}
#pragma mark Other Methods
@@ -1107,14 +1127,16 @@ passes the request to the tableDump object
}
// table menu items
- if ([menuItem action] == @selector(createTableSyntax:) ||
+ if ([menuItem action] == @selector(showCreateTableSyntax:) ||
+ [menuItem action] == @selector(copyCreateTableSyntax:) ||
[menuItem action] == @selector(checkTable:) ||
[menuItem action] == @selector(analyzeTable:) ||
[menuItem action] == @selector(optimizeTable:) ||
[menuItem action] == @selector(repairTable:) ||
- [menuItem action] == @selector(flushTable:))
+ [menuItem action] == @selector(flushTable:) ||
+ [menuItem action] == @selector(checksumTable:))
{
- return ([self table] != nil);
+ return ([self table] != nil && [[self table] isNotEqualTo:@""]);
}
return [super validateMenuItem:menuItem];
}
@@ -1272,14 +1294,14 @@ passes the request to the tableDump object
@"ToggleConsoleIdentifier",
@"ClearConsoleIdentifier",
@"FlushPrivilegesIdentifier",
- NSToolbarCustomizeToolbarItemIdentifier,
- NSToolbarFlexibleSpaceItemIdentifier,
- NSToolbarSpaceItemIdentifier,
- NSToolbarSeparatorItemIdentifier,
@"SwitchToTableStructureToolbarItemIdentifier",
@"SwitchToTableContentToolbarItemIdentifier",
@"SwitchToRunQueryToolbarItemIdentifier",
@"SwitchToTableStatusToolbarItemIdentifier",
+ NSToolbarCustomizeToolbarItemIdentifier,
+ NSToolbarFlexibleSpaceItemIdentifier,
+ NSToolbarSpaceItemIdentifier,
+ NSToolbarSeparatorItemIdentifier,
nil];
}
@@ -1290,10 +1312,11 @@ passes the request to the tableDump object
{
return [NSArray arrayWithObjects:
@"DatabaseSelectToolbarItemIdentifier",
- NSToolbarSpaceItemIdentifier,
+ NSToolbarFlexibleSpaceItemIdentifier,
@"SwitchToTableStructureToolbarItemIdentifier",
@"SwitchToTableContentToolbarItemIdentifier",
@"SwitchToRunQueryToolbarItemIdentifier",
+ NSToolbarFlexibleSpaceItemIdentifier,
nil];
}
@@ -1342,7 +1365,7 @@ code that need to be executed once the windowController has loaded the document'
sets upt the interface (small fonts)
*/
{
- [aController setShouldCascadeWindows:NO];
+ [aController setShouldCascadeWindows:YES];
[super windowControllerDidLoadNib:aController];
NSEnumerator *theCols = [[variablesTableView tableColumns] objectEnumerator];
@@ -1458,6 +1481,15 @@ invoked when query gave an error
[self updateChooseDatabaseToolbarItemWidth];
}
+- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(int)dividerIndex
+{
+ if (sidebarGrabber != nil) {
+ return [sidebarGrabber convertRect:[sidebarGrabber bounds] toView:splitView];
+ } else {
+ return NSZeroRect;
+ }
+}
+
- (void)updateChooseDatabaseToolbarItemWidth
{
// make sure the toolbar item is actually in the toolbar